Observe Agent Quality, Cost, and Risk
Instrument agent runs with privacy-preserving traces, metrics, logs, and quality signals that support diagnosis without turning telemetry into a sensitive-data archive.
By the end
You will be able to
- Design traces that connect agent, model, retrieval, tool, approval, handoff, and verification spans.
- Measure quality, safety, reliability, latency, token use, cost, and escalation by meaningful slices.
- Apply data minimization, redaction, access, retention, sampling, and deletion controls to telemetry.
- Use traces to localize failure and route human escalation without exposing hidden reasoning.
Use traces, metrics, logs, and evaluations together
A trace reconstructs one run and its parent-child operations. Metrics reveal trends and service objectives. Logs capture discrete operational events. Evaluations judge behavior against a rubric. None replaces the others.
Start from decisions the team must make: detect a regression, locate a failed boundary, control spend, explain an escalation, or prove a postcondition. Collect only signals that support those decisions.
Preserve causal structure across the run
Give the workflow a trace ID and each model call, retrieval, tool call, approval, guardrail, handoff, verifier, and recovery step a span with parent linkage and timing. Record stable workflow, agent, prompt, model, tool, policy, and content versions.
Use low-cardinality status and failure labels for aggregation, while keeping detailed evidence behind access-controlled references. Correlation IDs should connect provider requests and external side effects without storing secrets.
traceId, spanId, parentSpanId
operation: agent | model | retrieval | tool | approval | handoff | verify
versionRefs: workflow, prompt, model, tool, policy, content
start, end, status, failureClass
usage: tokens, estimatedCost, retries
resultRef: redacted evidence or secure pointerMeasure outcomes, not activity alone
Track task success and verified completion alongside policy violations, unsafe attempts, user corrections, escalations, abandonment, tool and retrieval failure, retry rate, latency percentiles, token use, and cost per successful task.
Segment by workflow version, model, tool, user journey, risk class, language, and other supported groups. Alert on error-budget burn, critical policy events, and material quality change rather than raw request volume alone.
Assume model and tool content is sensitive
Inputs, outputs, tool arguments, results, retrieval queries, and documents can contain personal data, secrets, customer content, or protected business information. Default to metadata and secure references; capture content only for a documented purpose and permitted population.
Apply redaction before export, tenant isolation, encryption, role-based access, short retention, deletion propagation, regional controls, and audit logging. Sample based on risk and debugging need, not because storage is available.
Review the first wrong transition
Begin at the user-visible failure, then walk backward to the first span whose actual state diverged from the expected contract. Classify the failure before changing prompts: model, prompt, tool, retrieval, data, policy, infrastructure, or orchestration.
Escalate when a trace indicates unsafe action, cross-tenant data, repeated unknown outcomes, policy conflict, or impact beyond automated recovery. Give the human a redacted timeline, affected targets, containment status, evidence, and the decision required.
Practice activity
Instrument and review an agent trace
- Create a trace schema for one workflow with agent, model, retrieval, tool, approval, handoff, verification, and recovery spans.
- Define quality, safety, reliability, latency, token, cost, and escalation metrics with dimensions and alert thresholds.
- Write the telemetry data policy covering collection purpose, redaction, content capture, sampling, access, retention, deletion, and residency.
- Review one synthetic failed trace, identify the first wrong transition, assign a failure class, and prepare a human-escalation packet.
What to produce
- A trace/span schema, metric catalog, service objectives, and alert rules tied to product decisions.
- A privacy policy and trace-review artifact showing causal diagnosis, failure classification, containment status, and escalation evidence.
Reflect before continuing
Which telemetry field was useful for debugging but unjustified to retain in clear text?
Evidence
Sources and verification
- TracingOpenAI · verified 2026-07-25
- Observability for agentsGoogle · verified 2026-07-25
- OpenTelemetry GenAI semantic conventionsOpenTelemetry · verified 2026-07-25
- Artificial Intelligence Risk Management FrameworkNIST · verified 2026-07-25
Knowledge check
Make it stick.
Choose the strongest answer for each question. Your attempts become part of your device-local transcript.