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
- Propagate trace_id across gateway, model proxy, and tools
- Version eval sets with prompts and tool manifests
- Score final user-visible answers for satisfaction separately
5. Sample configuration
telemetry:
sample_rate: 0.05
always_capture: [error, over_max_steps]
eval:
blocking_threshold: 0.926. FAQ
- Full capture is expensive—what then?
- Always keep errors and end-of-session summaries; sample successful short chats.