Design end-to-end observability and containment for a fleet of production agents.
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The design goal is that any incident is answerable by replay, and any runaway is stoppable in seconds at the right granularity.
Full worked answer with diagram
The design goal is that any incident is answerable by replay, and any runaway is stoppable in seconds at the right granularity.
What to record, per step, not per request. Session and trace ID; the human principal and the agent identity separately; model name and exact version (never a floating alias); prompt template ID plus a hash of the rendered prompt; retrieved document IDs and their provenance tags; tool name, full arguments, and a hash of the result; the approval record with approver and latency; guardrail verdicts; tokens and cost; wall-clock latency. Structure it as a graph, not a log line, because the question you will ask later is "what did it do and why", and that is a path through a tree.
Replay is the point. With the above you can re-run a session against recorded tool responses. That is what turns an incident from archaeology into an experiment, and it doubles as your regression corpus: every real failure becomes a test.
Detection signals that actually fire. Novel tool sequences against a learned baseline. First-seen argument patterns, especially a new egress domain or a new file path root. Step count or cost above session p99. Repeated identical tool calls, which is the loop signature. Guardrail hit-rate spikes, which usually mean either an attack campaign or a bad deploy. Retrieval from unusual namespaces. Approval latency under ~2 seconds, which measures rubber-stamping. Cost per tenant deviating from its own history rather than a global threshold.
Containment ladder, each rung independently exercisable: per-session circuit breaker (automatic, thresholded), per-tool disable flag, per-tenant pause, global kill switch. Every rung must be out of band from the agent's own control loop, must revoke credentials rather than only killing processes, and must be tested on a schedule, because a control that is never exercised is a control that does not work.
The tension to name explicitly. Full-fidelity agent traces are the largest PII honeypot your team will ever build: complete prompts, retrieved customer documents, tool arguments containing identifiers. The resolution is a redaction pipeline on the hot path with restricted, audited, short-retention access to raw traces, and a longer retention on the redacted tier. If you cannot say who can read raw traces and for how long, your observability system is now your biggest privacy risk.
Worth sketching. The ladder is the bit people forget: four rungs of granularity, all fed by the same trace, all out of band from the agent.
flowchart TD
A["Per-step trace<br/>principal, agent id, model version, args, cost"] --> B["Replay and regression corpus"]
A --> C["Signals: novel tool sequence,<br/>new egress domain, cost over p99"]
C --> D["Per-session circuit breaker, automatic"]
D --> E["Per-tool disable flag"]
E --> F["Per-tenant pause"]
F --> G["Global kill switch"]
A --> H["Redaction on the hot path<br/>raw traces are a PII store"]
What a good answer covers
- The design goal is that any incident is answerable by replay, and any runaway is stoppable in seconds at…
- What to record, per step, not per request
- Session and trace ID; the human principal and the agent identity separately; model name and exact…
- Structure it as a graph, not a log line, because the question you will ask later is "what did it do and…
- With the above you can re-run a session against recorded tool responses
Key terms: Replay is the point · Detection signals that actually fire · Containment ladder · The tension to name explicitly
In the glossary: Tool call · Circuit breaker · Observability
Interviewer follow-ups to expect
How do you build a behavioural baseline for a fleet where legitimate agent behaviour changes every time someone edits a prompt?
Which of these signals would you page a human for at 3am, and which are dashboard-only?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep