Governed agentic orchestration for an actuarial platform

Architecture

From the business scenario down to the running code, top-down. The target layer is drawn first; what this demo implements of it is marked, and what it leaves out is said.

1. The target orchestration layer

flowchart TB subgraph Channels UI[Platform UI / assistant] API[Decision APIs] end subgraph Orchestration["Governed orchestration layer"] GW[Gateway: SSO, roles, quotas, budget] ORCH[Orchestrator: plan, sub-agents, durable state, retry / resume] POL[Policy engine: permissions, approval checkpoints, guardrails] LEDGER[Execution ledger and audit] EVAL[Evaluation: reference cases, online metrics] MEM[Memory and context: case, knowledge, rules] end subgraph Registry["Governed MCP tool registry"] T1[docs.search] T2[data.reconcile / assumptions.diff] T3[run.submit / run.results] T4[results.compare] T5[note.publish / change.review] end subgraph Platform LLM[LLM gateway, multi-provider] OBS[Observability: traces, metrics] K8S[Kubernetes, queues, switchable environments] end subgraph Existing["Actuarial systems"] ENGINE[Modeling engine] GRID[Compute grid] DATA[Data links] end UI --> GW --> ORCH API --> GW ORCH <--> POL ORCH --> LEDGER ORCH <--> MEM ORCH --> EVAL ORCH --> Registry Registry --> ENGINE Registry --> GRID Registry --> DATA ORCH --> LLM Orchestration --> OBS

2. What this demo implements

Layer componentIn the demoLeft out, on purpose
OrchestratorA LangGraph state graph with a SQLite checkpointer: durable state per case, an interrupt at the approval gate, resume by Command.Sub-agents as separate graphs, retries on real failures, queues.
Policy engineapp/policy.py: effects (read, compute, write, publish), roles, approval requirement, compute budget, output guardrail on the note.Externalised policy store, per-tenant rules.
Tool registryapp/registry.py: contracts with effect, version, owner; every call goes through policy and ledger. Served over MCP by app/mcp_server.py.Entitlements per client, tool versioning workflow.
Execution ledgerapp/ledger.py: append-only SQLite, live stream to the UI, export per case.Retention policy, SIEM export.
EvaluationThe ledger carries everything an offline evaluation needs; the verification node is the first online check.Reference case suite and judge.
LLM gatewayinit_chat_model: the provider is a configuration value. Two calls per case.Routing, caching, cost caps per tenant.
Actuarial systemsA deterministic simulator (app/axis_sim.py): datasets, assumptions, runs, grid cost, documentation base.Everything real.
DeploymentOne container behind the platform's reverse proxy, on a shared Docker network.Kubernetes, switchable environments.

3. The case graph

flowchart LR S([start]) --> gather gather --> plan plan -->|controls ok| gate plan -->|controls failed| E([end]) gate -->|approved| execute gate -->|rejected| E execute --> attribute --> draft --> verify --> E classDef llm fill:#fde68a,stroke:#b45309,color:#111; classDef human fill:#bfdbfe,stroke:#1d4ed8,color:#111; class plan,draft llm; class gate human;

Yellow nodes call the language model. The blue node is the human approval checkpoint; the graph is interrupted there and the state is saved. Every other node is deterministic code calling the registry.

4. How a case travels through the layers

  1. The actuary opens a case with a question. The ledger records it.
  2. gather calls run.metadata twice, data.reconcile, assumptions.diff and docs.search. Each call is first evaluated by the policy engine (read effects pass), then recorded with its arguments, result and fingerprint.
  3. plan gives the model the facts, not the data: it returns a structured plan restricted to the four canonical decomposition steps. The graph normalises the order. plan.cost prices it.
  4. gate checks the budget, records an approval request and interrupts. The case holds no thread while it waits.
  5. The actuary approves or rejects in the UI. The decision is recorded and the graph resumes from its checkpoint.
  6. execute submits each run through run.submit, the only tool with a compute effect, now allowed because the approval is on the case.
  7. attribute calls results.compare: the step-by-step waterfall, with the unexplained residual.
  8. draft asks the model for the note, with the attribution, the controls and the sources. verify checks every figure and citation against the record; a note that fails stays a draft.

5. Why these choices