Engineering · AI Agent Architecture

Agent Observability: Traces, Evals, and Online Replay

Close the loop from traces and offline graders to sampled production replay so agent behavior is measurable.

1. Trace data model

Every session gets a trace with spans for LLM calls, tools, retrieval, and routing. Standardize model, tokens, cost_estimate, and outcome. Store redacted content; keep encrypted originals briefly for disputes.

2. Offline suites and graders

Maintain scenarios for compliance Q&A, multi-step work, and injection attacks. Mix rule graders with model graders. Block merges when scores drop below threshold.

3. Online sampling and alerts

Sample production lightly and watch tool failure rate, average steps, and user interrupts. On spikes, tighten tools or switch to a conservative model.

4. Engineering checklist

5. Sample configuration

telemetry:
  sample_rate: 0.05
  always_capture: [error, over_max_steps]
eval:
  blocking_threshold: 0.92

6. FAQ

Full capture is expensive—what then?
Always keep errors and end-of-session summaries; sample successful short chats.