Reviewing an agent system — one-page cheat sheet
Published
The seven review lenses
| Lens | The question that finds the risk |
|---|---|
| Scalability | What’s the binding limit at 10k users? (Hint: provider rate limits, not CPU.) |
| Reliability | Per-step success rate → end-to-end task rate? |
| Security | Worst single tool call? Control in runtime or prompt? |
| Cost | Cost per completed task? Kill switch on runaway? |
| Observability | Debug a bad action from 3 days ago — how? |
| Context eng. | Retrieval failure vs reasoning failure — tell them apart? |
| Evaluation | What catches a 5% regression before it ships? |
Numbers that reframe the review
RELIABILITY COMPOUNDS DOWN 0.99^40 ≈ 67% (99% step, 40 steps) 0.999^40 ≈ 96% → steps must be ~99.9% COST IS DOMINATED BY INPUT TOKENS context is RE-SENT every step → session tokens grow ~quadratically multi-agent ≈ 15× the tokens of a chat THE BOTTLENECK provider rate limits (TPM/RPM), not your servers' CPU
Trust boundaries
TRUSTED system prompt UNTRUSTED user input UNTRUSTED tool outputs / fetched content (a web page, a DB row, a file) ENFORCE in the runtime / policy layer, NEVER in prompt instructions. The model cannot police its own boundary.
Architecture review checklist
- Loop durable/resumable (checkpointed), or work lost on crash?
- Where does session state live — can any worker resume?
- Provider rate limits managed (queue, multi-key, backpressure)?
- Per-tenant isolation — can one tenant starve the rest?
- Every tool: scope, credentials, worst call enumerated?
- Authorization in the runtime/policy layer, not the prompt?
- Idempotency on every mutating tool?
- Loop cap + wall-clock + token budget in the runtime?
- Full per-step traces (context + output + tool calls + cost)?
- Eval harness gating prompt/model changes?
Agent design checklist
- Smallest viable toolset; read and write agents split.
- Tools have typed schemas + arg validation.
- Retrieval hybrid + reranked; recall measured on its own.
- Context budget per section; history compacted.
- Model tiering — cheap to navigate, strong for the hard step.
- Prompt caching on the stable prefix.
- Irreversible actions gated by approval / HITL.
- Tool outputs tagged as data, never as instructions.
Production readiness checklist
- Token/cost budget + kill switch per session & tenant.
- Circuit breakers per tool and per provider.
- Retries: bounded, backoff + jitter, idempotency keys.
- Retryable-vs-not classified (retry 429/503/timeout; never 400/auth).
- Graceful degradation path (smaller model / cache / escalate).
- Immutable audit log for every mutation.
- Secret/PII redaction in logs and traces.
- Dead-letter + human-escalation queue.
- Cost attribution + alerting per tenant.
- Canary/rollback + multi-provider failover.
Common failure modes
Retry storms · duplicated side effects (charges/emails) from non-idempotent retries · runaway loop → unbounded spend · noisy-neighbor quota starvation · prompt injection via tool/RAG content → exfiltration or unauthorized action · over-broad token → mass deletion · retrieval recall miss → confident wrong answer · lost-in-the-middle · context exhaustion on long tasks · silent degradation · “can’t reproduce it” (no traces) · silent regression from a prompt tweak.
RED FLAGS in an agent architecture
”Guardrails” that are system-prompt sentences · one omnipotent API key or tool · sync request handling for long tasks · no per-step tracing or assembled-context capture · no eval set (“we test by trying it”) · unbounded retries / no loop cap · no idempotency on writes · always the biggest model, no tiering · full history re-sent with no compaction or caching · no per-tenant cost visibility · tool outputs concatenated straight into instruction context · “the model will know not to do that.”
Eight questions for the design-review chair
- ”Per-step success rate, and therefore end-to-end task rate?” forces 0.99^40 ≈ 67%
- “Enumerate every tool’s blast radius. For each worst case — control in the runtime or the prompt?"
- "Where does state live if a worker dies at step 20 of 30?"
- "Cost per completed task, and the kill switch on runaway spend?"
- "How do you tell a retrieval failure from a reasoning failure in a wrong answer?"
- "I change one prompt line — what catches a 5% regression before it ships?"
- "Debug a bad action from three days ago — without re-running it. Show me."
- "Noisy-neighbor story — can one tenant starve the rest?”