A research agent, and an agent that fixes it.
The research agent plans queries, searches the web, writes a cited report and revises it until a critic approves. When a job fails, a second agent reads the job's event log, calls tools to check runbooks and the recovery policy, and proposes a fix. Code decides whether the fix is allowed; an operator or a limited auto-recovery runs it, and the result is checked.
The two agents
Research agent
A LangGraph graph: a DSPy planner and a reflector write search queries, a researcher runs Tavily web searches in parallel, a person approves the sources, a writer drafts a cited report, and a DSPy critic sends it back for up to three revisions. Approved reports go to vector memory (Chroma or pgvector). Jobs run on PostgreSQL with leased workers and checkpoints.
Diagnosis agent
A function-calling loop with four tools: inspect_evidence,
search_runbooks, check_action_policy and submit_diagnosis.
A policy validator and an evidence verifier review every answer and send rejections back to the
agent. Step, time and token limits apply, with a rules engine as fallback.
How a failure gets fixed
The model reads and reasons; code decides. The server supplies IDs and the action to run, and free-text log fields never reach the model.
Run durably
Leased workers, heartbeats, checkpoints and human source approval on PostgreSQL.
Gate the output
A grounding gate fails reports that cite sources they never retrieved.
Investigate
The agent inspects evidence, searches runbooks and checks the policy before it answers.
Check twice
A policy validator asks "is this allowed?"; a verifier asks "does the evidence support it?".
Recover and verify
An operator or auto-recovery approves, the worker re-runs the job, and the result is checked.
Results
Every number comes from a run committed to the repository. Incident labels were committed before the agent was built.
What each part of the agent is worth
| Removed | Correct (of 51) | Unsafe | Cost |
|---|---|---|---|
| nothing | 51 | 0 | $0.0050 |
| evidence verifier | 44 | 3 | $0.0047 |
| identifier vocabulary | 45 | 0 | $0.0045 |
| policy dry-run tool | 47 | 0 | $0.0032 |
| runbook search | 49 | 0 | $0.0033 |
Unsafe recommendations appear only without the verifier, even with the policy validator on. One run per variant; agent v3 on two pre-registered sets (for v3 a regression check).
Held-out evaluation, grounding and live runs
| Evaluation | Result |
|---|---|
| Fresh held-out set, agent v3 | 23 / 24 |
| Recommended the recovery when allowed, v3 vs v2 vs rules | 10 vs 6 vs 7 (of 10) |
| Earlier held-out set: rules, single-shot, agent v2 | 16, 15.0, 22.7 / 24 |
| Overconfident on must-abstain cases, agent v1 to v2 | 3 to 0 |
| Citations fully supported by retrieved text, after a writer fix (3 runs) | 37% to 75% |
| Model-chosen follow-up searches (3 runs each; kept off) | 75% to 62% |
| Same held-out set on a free model (Nemotron 3.5 Super VL), 3 runs | 24, 22, 21 / 24; 1 unsafe in 72 |
| Fault campaign, 30 real jobs | 30 / 30 |
| End-to-end recovery, operator and auto | 6 / 6 each |
Real jobs ran through the worker, LangGraph, Gemini and PostgreSQL with injected search, provider, worker-crash and fabricated-citation faults.
Bugs found by running the real system
- Retry delay never parsed. Gemini states it in the error text, so no rate-limited job could ever resume.
- Parked jobs kept their lease. An approved resume was refused as "another worker owns this job".
- Unreadable retrieval evidence. A total search outage could never get a fresh retrieval approved.
- A no-cache flag nothing read. "Fresh" retrievals could be served the cached report they replaced.
- Incidents never closed, even after a verified recovery.
- Grouped citations ignored.
[1, 2, 4]went uncounted, hiding a report that cited sources never retrieved. - Citation numbers meant different things. Writers numbered their own reference lists, mis-mapping citations in 11 of 20 reports.
Explore real incidents
A read-only snapshot of 30 incidents from the fault-injection campaign and automatic recovery runs: the evidence, the agent's diagnosis with every tool call, and the audit trail. Try a quality_gate_failure or any resolved incident.