Design Card — Wacky Wheels Control Tower
Model: Google gemini-3.5-flash-lite (temperature 0). 15 LLM calls for the whole run: one per event, cached. Stack: Python, LangGraph, NetworkX, provided enterprise_server.py (unchanged).
Principle: Use the LLM where language is messy, and code where the policy is exact. The LLM never picks an ID, does date arithmetic, or chooses an action.
Architecture
event text ─▶ Coordinator: read (LLM extracts phrases) ─▶ code verifies & resolves ─▶ ACT / ESCALATE / NO ACTION
ACT ─▶ Coordinator: graph traversal per incident ─▶ Planner ─▶ Dispatcher ─▶ Inspector (shared state)
─▶ Guardrail: dry-run the whole plan on a local copy of enterprise.py ─▶ send ─▶ audit summary + trace
Every incident gets exactly one verdict:
| Verdict | When | What happens |
|---|---|---|
| ACT | A confirmed incident whose entities and dates all resolve and agree with the data | The specialists carry out the handbook's full response |
| ESCALATE | A rumour or unconfirmed report; a report missing a specific entity or date; any extracted value that doesn't match the data (e.g. a lot that doesn't exist). It is also used later if the plan fails its dry run, or the server refuses a live call | A single escalate call with the reason. No operational change (handbook rule 8) |
| NO ACTION | Noise: the message isn't about operations (a brochure question, distant news, a price-list notice) | Zero tool calls. The reason is recorded in the trace (rule 7) |
| Agent | Responsibility | Tools |
|---|---|---|
| Coordinator | Reads the message (LLM), resolves it, routes it, escalates | escalate |
| Supply Chain Planner | Moves affected orders to the earliest legal slot | mes.reschedule, mes.transfer |
| Customer Care Dispatcher | One notice per dealer; loaners assigned by priority | dealer.notify, crm.loaner_availability, crm.assign_loaner |
| Quality Inspector | Holds the lot, stops sale of unsold vehicles, contacts owners | quality.hold_lot, dealer.stop_sale, crm.notify_customer |
Specialists are deterministic policy executors by design: graded accuracy needs every run to give the same answer, traceable to a handbook rule. Agents in a compound event share one state (slots and loaner pools), so they can't contradict each other.
LLM vs code
| Step | Done by | Why |
|---|---|---|
| Split the message, pick a category, copy the exact quote / name / date phrases | LLM (JSON schema enforced) | Messy wording, multi-incident messages, rumours |
| Quote check: is every copied phrase really in the message? | Code | Catches hallucinated entities |
Names to IDs (aliases.csv, official names, cities) and relative dates to ISO |
Code | Exact, testable, no arithmetic errors |
| Cross-check against the tables (does the shipment or lot exist? do plant, part and dates agree?) | Code | Any mismatch is escalated, never guessed |
| Affected records, scheduling, loaner priority, quality split | Code (handbook rules 1–6) | Graded exactly |
Knowledge graph (20%)
11 node types, 16,979 nodes, 16 relationship types, 26,741 edges. Every type the brief requires is in the graph (export: ontology.mmd/.json). Each incident category has its own traversal, and every trace cites its path:
- Delay: Shipment ─carries→ Part ←needs─ Model ←builds─ ProductionOrder ─fulfils→ CustomerOrder → Dealer / Customer
- Outage: Plant ─runs→ ProductionOrder ─fulfils→ CustomerOrder → Dealer / Customer
- Quality: Lot ─batch_of→ Part ←needs─ Model ←builds─ ProductionOrder ─produced→ Vehicle → Dealer / Customer
Guardrails (10%)
- Verify before acting: the LLM's output is quote-checked, resolved and cross-checked against the data. Anything unresolved is escalated.
- Dry run before sending: the whole plan is replayed on a private copy of
enterprise.py. If any call would fail, the plan is dropped and escalated. - Live-failure stop: if the server refuses a call, sending stops, and a human gets an escalation saying what went through and what was not sent.
- Restraint: noise produces zero calls (with the reason in the trace). Unconfirmed reports produce
escalateonly.
Evaluation (graded run, 15 events)
| Result | Value |
|---|---|
| Tool calls | 850 (768 write, 82 free reads), 0 failed |
| Test cases | TC1–TC6 all routed correctly: 3 delays, 3 outages, 3 quality holds, 3 noise (0 calls), 1 compound (2 incidents, 2 paths), 2 unconfirmed (escalate only) |
Independent checker (check.py) |
15/15 events pass. It re-derives the expected outcome from the raw CSVs, not from the agents' graph, and checks: exactly the affected orders moved; earliest legal slot; one notice per dealer listing only its orders; loaner priority; lot / stop-sale / owner split; ≥3 kinds of action |
Judgement calls (where the handbook is silent)
- "next Friday" means the Friday of next week (2027-03-19). This was confirmed against the shipment ETAs in the data, not assumed.
- Transfer tie-break: earliest day first, then the lowest plant ID. Days disrupted in the same event are never used as destinations.
- Compound events: one
dealer.notifyper dealer covering both causes (rule 4: "exactly one"). Loaners are ranked across both incidents together.
UI and explainability (10%)
Live control tower (app.py): event feed, ontology with the traversed path highlighted, LangGraph agent map showing the route taken, action log, and a per-event audit pop-up. Each trace (traces/E-xx.json) holds the LLM output, verdict reasons, graph path, every call with its rationale, and a summary per agent. Summaries are built from the trace, so they can't contradict the actions.
What we would improve
- A local small model (same schema, same checks) to remove the cloud dependency, benchmarked against the cached Gemini output.
- Real coordinator judgement: let it re-plan once after a rejected plan before escalating, and rank competing incidents.
- Ground truth for evaluation: our checker encodes our reading of the handbook, so a misread rule would pass it. Independent test cases written by another team member would close that gap.