How it's built
A small, honest version of an enterprise AI platform: the same controls a regulated enterprise needs, at a size one person can run on a single server. The status below comes from the running app.
Architecture
Agents never call each other. They read and write the shared case record; the routing engine chooses who goes next.
Carried over from earlier prototypes
- Worker and supervisor built separately, on different models; the Admin screen refuses to make them the same.
- The supervisor can only lower confidence or flag. It cannot approve or rewrite.
- AI classifies and drafts; versioned rules decide; numbers and dates are computed in code.
- Every extracted fact carries a quote, and code checks the quote exists in the source.
- Human approval with a required reason for any change.
- Hash-chained audit, cost per task, daily cap, offline fallback, evaluation-gated releases, AI risk card.
- Public guest view for reviewers; settings behind an admin passcode.
New in this one
- Shared case record with per-agent contracts, so agents are decoupled and auditable.
- State-driven routing engine with conditional specialists and logged reasons for every hop.
- One LLM gateway: masking, injection screen, cache with dollars saved, kill switches, fallback.
- Pattern library: new workflows are assembled mostly from existing blocks; the live reuse figure is in the status strip above.
- Red-team cases in the evaluation set; one miss blocks a release.
- Live production-readiness scorecard and a value ledger against the intake estimate.
- Learning loop: human overrides become test-set candidates.
- Evaluation Lab: baselines and item-level regressions, confidence intervals, judge calibration and third-party agent acceptance tests.
- Trace viewer on every case, with OpenTelemetry export. On the Advisory Desk site, the knowledge and expert tools run as an MCP server, and the Desk's own agents call them through it.
- "Explain this screen" chat on every screen: it answers only from what's on the page, quotes are checked in code, a second model can withhold the answer, and off-page questions are refused.
What production at enterprise scale would change
| Here | At enterprise scale |
|---|---|
| SQLite case record | Postgres or a document store, with an event bus (for example Kafka) so agents scale out as independent consumers |
| In-process router | Durable workflow engine (for example Temporal) with the same state-based routing and retry policy |
| Exact-match cache | Shared cache plus semantic cache with per-tenant isolation and expiry tied to prompt and rule versions |
| Rules in code | Rules as policy-as-code in a governed repository, with sign-off by risk and compliance before release |
| Admin passcode | SSO, role-based access, segregation of duties between builders, approvers and auditors |
| App logs and tables | OpenTelemetry traces per hop, central dashboards, alerting on drift, cost and override rate |
| Hash-chained table | Write-once storage for the audit trail, retained under the records policy |
| Evaluation on demand | Evaluations in CI on every prompt, rule or model change, plus scheduled drift runs on sampled production cases |
| Synthetic data | Real systems of record through governed APIs, sensitive data tokenised before it reaches the platform |
Stack
Python 3.13, FastAPI and SQLite on a single Lightsail server behind Caddy. Plain HTML, CSS and JavaScript with no build step. Anthropic models by default; an OpenAI model can be added as a cross-vendor supervisor when its key is set. 33 automated tests cover routing, contracts, masking, the cache, the release gate and the audit chain.