cleandataengineering.aiDrug-Safety Agent on Databricks, drawn simply
You are here: Architecture › Sixteen layers, a table

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.

LayerProvided byThis agent addsStatusGap
L1 Context assemblylibrary: contextLabel text is marked as data in the standing instructionpartly builtNo test yet that an instruction planted in label text is ignored
L2 Model invocationlibrary: llmWhich model, via a settingbuiltThe approved-model list is stated, not yet enforced by a test
L3 Tool layerlibrary: toolsThree read-only tools, typedbuiltThe tools that write a draft are specified, not built
L4 Control looplibrary: loopSix steps, five cents, one repair turnbuiltNone
L5 Statelibrary: state (not wired)Drafts, hand-offs and an audit trail in a local SQLite storepartly builtA stand-in for the Delta table; the Delta version is not built
L6 Input and output contractslibrary: contractsThe draft's JSON shape and one repair turnbuiltCould move onto the library's contract layer
L7 Policylibrary: policyThree refusals decided by rules in the routerpartly builtThe model's draft is checked after the fact, not by a policy engine
L8 Flow controllibrary: flowNothing of ourspartly builtRate limits and backoff are the library's, untested here
L9 Determinism and replaylibrary: cassetteScripted models in testspartly builtNo recorded real-model runs to replay
L10 Failure handlinglibrary: resilienceA failed loop becomes a hand-off to a personpartly builtMapped to the spec's escalation reasons only in the reply text
L11 Observabilitylibrary: telemetryNothing yetnot builtMLflow tracing is planned
L12 Entry pointlibrary: entrypointentrypoint.handle: the one front doorbuiltNone
L13 Cost accountinglibrary: costSpend is reported on each draftpartly builtNo cost ledger over many tasks
L14 Human in the looplibrary: approvalsA desk where a named person approves, edits or rejects; decisions are finalpartly builtNo login, no notification, not on Databricks
L15 Release and configlibrary: configBudgets in one objectpartly builtNo release process; nothing is deployed
L16 Identitylibrary: identityThe reviewer's id and a read-only scopebuiltIdentity 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