Drug-Safety Agent on Databricks · Architecture · Sixteen layers, a table
The sixteen layers, one row each
The same sixteen layers as a table. The "provided by" column names the part of the shared library that does the work; the "this agent adds" column is code written in this repository; the last column is the honest gap.
| Layer | Provided by | This agent adds | Status | Gap |
|---|---|---|---|---|
| L1 Context assembly | library: context | Label text is marked as data in the standing instruction | partly built | No test yet that an instruction planted in label text is ignored |
| L2 Model invocation | library: llm | Which model, via a setting | built | The approved-model list is stated, not yet enforced by a test |
| L3 Tool layer | library: tools | Three read-only tools, typed | built | The tools that write a draft are specified, not built |
| L4 Control loop | library: loop | Six steps, five cents, one repair turn | built | None |
| L5 State | library: state (not wired) | Drafts, hand-offs and an audit trail in a local SQLite store | partly built | A stand-in for the Delta table; the Delta version is not built |
| L6 Input and output contracts | library: contracts | The draft's JSON shape and one repair turn | built | Could move onto the library's contract layer |
| L7 Policy | library: policy | Three refusals decided by rules in the router | partly built | The model's draft is checked after the fact, not by a policy engine |
| L8 Flow control | library: flow | Nothing of ours | partly built | Rate limits and backoff are the library's, untested here |
| L9 Determinism and replay | library: cassette | Scripted models in tests | partly built | No recorded real-model runs to replay |
| L10 Failure handling | library: resilience | A failed loop becomes a hand-off to a person | partly built | Mapped to the spec's escalation reasons only in the reply text |
| L11 Observability | library: telemetry | Nothing yet | not built | MLflow tracing is planned |
| L12 Entry point | library: entrypoint | entrypoint.handle: the one front door | built | None |
| L13 Cost accounting | library: cost | Spend is reported on each draft | partly built | No cost ledger over many tasks |
| L14 Human in the loop | library: approvals | A desk where a named person approves, edits or rejects; decisions are final | partly built | No login, no notification, not on Databricks |
| L15 Release and config | library: config | Budgets in one object | partly built | No release process; nothing is deployed |
| L16 Identity | library: identity | The reviewer's id and a read-only scope | built | Identity is passed in, not yet checked against a login |
The real code
Cut from the repository each time this site is built, so it always matches what runs. Each header names the file and the line it was cut from.
gates.yaml:25How each layer is mapped to a module: the library's, and ours beside it layers:
L1: ../reference-agent/packages/agent-harness/src/agent_harness/context
L2: ../reference-agent/packages/agent-harness/src/agent_harness/llm
L3:
- ../reference-agent/packages/agent-harness/src/agent_harness/tools
- src/drugsafety/tools.py
- src/drugsafety/world_tools.py
L4:
- ../reference-agent/packages/agent-harness/src/agent_harness/loop
- src/drugsafety/router.py
L5: ../reference-agent/packages/agent-harness/src/agent_harness/state
L6:
- ../reference-agent/packages/agent-harness/src/agent_harness/contracts
- src/drugsafety/agent.py
L7: ../reference-agent/packages/agent-harness/src/agent_harness/policy
L8: ../reference-agent/packages/agent-harness/src/agent_harness/flow
L9: ../reference-agent/packages/agent-harness/src/agent_harness/cassette
L10: ../reference-agent/packages/agent-harness/src/agent_harness/resilience
L11: ../reference-agent/packages/agent-harness/src/agent_harness/telemetry
L12:
- ../reference-agent/packages/agent-harness/src/agent_harness/entrypoint
- src/drugsafety/entrypoint.py
L13: ../reference-agent/packages/agent-harness/src/agent_harness/cost
L14: ../reference-agent/packages/agent-harness/src/agent_harness/approvals
L15: ../reference-agent/packages/agent-harness/src/agent_harness/config
L16: ../reference-agent/packages/agent-harness/src/agent_harness/identity