OperationsProduction AI

Observability for AI Agents: Traces, Tool Calls, and Incidents

An agent looped for forty minutes and nobody saw it. Instrument traces, tool calls, and failure modes before users do.

Syed Sartaj

Founder & AI Engineer

·10 min read
About the author

Support escalates a ticket. The agent “updated” an account. The CRM shows a partial write. The logs show a model call and then silence. Three people reconstruct what happened from Slack messages. That is folklore, not operations.

Agents fail in ways chatbots do not: wrong tool, infinite loops, partial writes, silent policy skips. Without traces, debugging is guesswork with confidence.

What to capture

For every run, record:

  • Request ID and user / tenant
  • Plan or steps attempted
  • Tool names, args (redacted), results, latency
  • Model calls and token usage
  • Final status: success, abstain, escalate, error
  • Links to approvals if HITL applied

Correlate these as one trace, not scattered logs. If you cannot answer “what did this run do?” in two minutes, your instrumentation is not finished.

Signals that matter

  • Tool error rate and retries
  • Step count distribution (runaways)
  • Escalation rate
  • Unsupported or low-confidence answers
  • Latency and cost per trajectory
  • Write success vs rollback

Alert on change, not only on absolute thresholds. A sudden jump in step count often arrives before a full outage.

From traces to better evals

Production failures are free training data for your golden set. When a run fails:

  1. Capture the trace
  2. Label the failure mode
  3. Add a regression case
  4. Fix and re-gate

See evaluation suites. The teams that improve are the ones that turn incidents into tests.

Incident path

Define before launch:

  • Who gets paged
  • How to disable a tool or kill the agent
  • How to communicate to users
  • How to replay and fix

An agent without a kill switch is an incident waiting for a name. Write the disable path while you still have calm.

Privacy

Traces often contain PII. Redact tool args, cap retention, and restrict who can open full payloads. Observability must not become a second data leak. Security will ask. Have an answer.

Checklist

  • End-to-end traces for every production run
  • Tool-level metrics
  • Alerts on loops, spikes, and quality drops
  • Kill switch and disable flags
  • Failure → golden set pipeline
  • Retention and redaction policy

Discuss your use case · Managed AI operations

Written by Syed Sartaj

Founder of Neurocell. Builds production AI for growth-stage and mid-market teams: agents, knowledge systems, and product features that ship and stay reliable.

Discuss your use case

Keep going

Continue reading

All notes