Part 7 of 7 · Enterprise AI Agent Engineering

Observability and Tracing: How to See What Your Enterprise AI Agents Are Doing and Why

Learn AI agent observability: what to capture in a trace, which signals to monitor in production, and how to keep traces free of sensitive data.

Part 7 of 7 in the Enterprise AI Agent Engineering guide

Why this matters now

Imagine an HR helpdesk agent in a GCC. An employee reports that it gave the wrong leave policy. The team tries to reproduce the answer and cannot. The logs hold only the question and the final reply. Nobody can say which document the agent retrieved, which version of the prompt was live or whether it called any tools. Two weeks of discussion follow, and the eventual cause is simple: it retrieved an outdated policy file. The fix takes ten minutes. Finding the cause took ten days. (This is an illustrative scenario, not a customer case.)

The agent was not mysterious. It was unrecorded.

Enterprises feel this more than most. Agents run unattended and at volume, so problems appear as patterns, not single events. Support teams need to answer "why did it do that?" for a specific case. Auditors need a record of decisions. Finance needs to explain a cost spike. Security needs evidence when something looks wrong. Without a usable record, each of these becomes a guessing exercise.

This is observability: the ability to understand what an agent is doing from the data it emits. It is the seventh and last topic in our series, and it is what keeps the other six working after launch. Context, tools, loops, guardrails, human checkpoints and evals all produce decisions worth recording and signals worth watching.

The core concept

A trace is the ordered record of one agent run. It is made of spans, where each span is one step: assembling context, calling the model, calling a tool, applying a policy check, waiting at a human checkpoint. Each span records what went in, what came out, how long it took, what it cost and which version of the prompt, model and tools was involved.

Observability uses three kinds of signal, and they answer different questions:

  1. Traces explain one case: what happened in this run, step by step.
  2. Metrics show trends: how many runs succeeded, how long they took, what they cost.
  3. Logs and events record specific happenings, such as a denied action or an alert.

OpenTelemetry, the open standard for telemetry, has been developing semantic conventions for generative AI work, so that agent traces can be collected in a common format and sent to the tools your organisation already uses. Using an open format also avoids locking your records to a single vendor.

What should you watch in production? We group signals into five families:

  • Quality: online eval scores, completion rate, rate of human overrides (see evals for agents).
  • Reliability: tool success rates, error types, timeouts, retries.
  • Cost and speed: tokens, steps and cost per task, latency per step.
  • Safety: denied actions, flagged outputs, suspected injection attempts (see guardrails and permissions).
  • Human oversight: checkpoint volume, time to decide, override rate (see human-in-the-loop design).

One caution is specific to agents. A trace holds the context the agent saw, and that context often includes personal or confidential data. India's Digital Personal Data Protection Act, 2023 sets obligations for handling personal data, and most enterprises have their own rules on top. Observability must therefore include redaction, access control and retention, or the trace store becomes a new risk.

From run to improvement:

Agent run
   |
   v
[Harness] emits spans: context, model call, tool call,
          policy decision, checkpoint, cost, versions
   |
   v
Redaction and access control  -->  Trace store (with retention rule)
   |
   v
Dashboards and alerts (quality, reliability, cost, safety, oversight)
   |
   v
Incident review and sampling
   |
   v
Fixes (context, tools, limits)  +  new eval cases

How it works in real systems

Scenario 1: The HR helpdesk. With tracing in place, the support engineer opens the disputed run and sees every step: the question, the documents retrieved with their version and date, the prompt version and the final answer. The outdated policy file is visible at once. The fix is to retire the old file and add a freshness check, and the case is added to the eval set. What took ten days now takes minutes. This is the payoff of recording the assembled context for each step, which we introduced in context engineering and memory architecture.

What a trace entry looks like. One run produces many entries under a single run identifier. An illustrative entry for one step of the HR helpdesk agent:

run_id: run-8f3a
step: 3
type: retrieval
prompt_version: hr-helpdesk-v14
model_version: model-2026-09
documents:
  - id: leave-policy.pdf, version: 2024-04, published: 2024-04-02
policy_decision: allowed (scope: hr_policies_read)
cost_tokens: 1840
content: redacted (personal data removed at write time)

This one entry would have shown the outdated policy at once: the document version and date are right there. Note also that the content is redacted, so the trace store does not become a second copy of sensitive data. This is an example, not a customer trace.

Scenario 2: A finance operations agent. A dashboard shows steps per task rising for one workflow. An alert fires when the average passes a set limit. Opening a few traces shows the agent repeating a call to a tool that returns a vague error, the pattern described in tool design and harness engineering. The team rewrites the error message and adds repeat detection (see loop engineering and orchestration patterns). Steps per task fall back, and the alert becomes a standing check.

Impact. Faster diagnosis cuts the time to fix, which improves reliability. Visible cost per task helps control spend. Evidence of policy decisions and human approvals lowers risk and answers audit questions. Teams that can show what an agent did, and why, find it easier to win approval to extend it, which supports adoption.

Design decisions and trade-offs

Decision Option A Option B Choose A when Choose B when
Capture depth Metadata and references Full content of inputs and outputs Data is sensitive and the reference can be resolved later under access control Debugging needs the exact content and access is tightly controlled
Coverage Trace every run Sample runs Volume is manageable or the risk is high Volume is very high and the risk is low; always keep all errors and flagged runs
Redaction At write time At read time Personal data should never be stored Authorised reviewers need the original; protect it with access control
Alerting Fixed thresholds Anomaly detection Limits are known, such as steps or cost per task Normal behaviour varies; start with thresholds and add anomaly checks later
Trace format Open standard Vendor-specific You want portability and shared tooling You accept lock-in for a faster start; record the exit plan

When not to capture full content: if a task handles personal or regulated data and the debugging value is low, store references and metadata only. More data in the trace store is more data to protect, retain and disclose.

What breaks in production

Failure mode Symptom Root cause Mitigation
Logs without context Team sees the answer but not how it was reached Only inputs and outputs recorded Record every step, with the assembled context and versions
Sensitive data in traces Personal data visible to broad audiences No redaction or access control Redact at write, restrict access by role, set retention
Broken traces across handoffs Multi-step or multi-agent runs cannot be followed end to end No shared run identifier Pass one run identifier through every step and agent
Alert fatigue Alerts ignored, real issues missed Too many alerts, no owner, no priority Few alerts tied to owners and actions, review them regularly
Metrics without quality Cost and speed look fine while answers decline Only operational metrics tracked Add online eval scores and override rates
Untraceable changes A drop in quality cannot be linked to a change Prompt, model and tool versions not recorded Stamp every span with versions and log every change

Enterprise Decision Framework

Set capture, access and retention by the risk of the agent. The levels and periods are recommended starting points; align them with your legal, security and compliance teams.

Agent risk level What to capture Access and retention Alerts
Internal, low risk Spans with metadata, errors, cost, versions Engineering access, short retention Cost, error rate, steps per task
Customer-facing Full spans with redacted content, policy decisions, online eval scores Role-based access, retention agreed with legal Add quality drop, denied-action spikes, override rate
Regulated, money or access Full spans, every policy decision and human approval, versions, immutable record Restricted access, audit logging of who viewed traces, retention set by regulation and policy Add every denied or flagged action, checkpoint delays, any change to scope

Rules for a design review:

  • Every run has one identifier that follows it through every step, tool and agent.
  • Every span records the prompt, model and tool versions.
  • Policy decisions and human approvals are recorded for every action that changes data.
  • Personal data in traces is redacted or referenced, and access to traces is itself logged.
  • Every alert has a named owner and a defined action.
  • If you cannot reconstruct why an action was taken, the agent is not ready for regulated work.

Worked example. Suppose a team sets trace capture for three agents. This is an illustrative review, not a customer result.

AgentRisk levelCaptureAccess and retentionAlert owner
Internal HR helpdeskInternal, low riskSpans with metadata, errors, cost, versionsEngineering access, short retentionEngineering on call
Customer-facing support agentCustomer-facingFull spans with redacted content, policy decisions, online eval scoresRole-based access, retention agreed with legalSupport platform owner
Payments agentRegulated, money or accessFull spans, every policy decision and human approval, versions, immutable recordRestricted access, audit log of who viewed traces, retention set by regulation and policyProcess owner and security lead

Each step up the table captures more and restricts more. The common rule holds across all three: if you cannot reconstruct why an action was taken, the agent is not ready for regulated work.

What to do in the next 30 days

  1. Define the trace standard. Owner: AI architect. Outcome: a written list of the fields every span must hold, including run identifier and versions, agreed with security and compliance, in week one.
  2. Instrument the harness. Owner: platform engineer. Outcome: spans emitted for context assembly, model calls, tool calls, policy decisions and checkpoints on one pilot agent by week two.
  3. Set redaction, access and retention rules. Owner: security lead with legal. Outcome: a written rule for each risk level, applied in the trace store by week three.
  4. Build the first dashboard and alerts. Owner: engineering lead. Outcome: a view of quality, reliability, cost, safety and oversight signals, with at most a handful of alerts, each with an owner, by week four.
  5. Run a trace review. Owner: head of AI. Outcome: a weekly review of sampled and flagged traces, with each finding turned into a fix or a new eval case, started by day 30.

Closing thoughts

Across this series, we have argued that an enterprise agent is a system, and that it is the system around the model that earns trust. Context decides what the agent sees. Tools and the harness decide what it can do. Loops decide when it stops. Guardrails decide what it may do. Human checkpoints decide who is accountable. Evals prove it works, and observability keeps proving it. Our practitioner's view is that an agent you can see is an agent you can improve, defend and extend. If useful, download the checklist below, or talk to our architects about an observability review for your agent.

Free checklist: Agent Observability Readiness Review

Download the Agent Observability Readiness Review checklist

A one-page, 13-point checklist your architects and risk team can use in the next design review.

Download PDF

Quick self-check

Tick the statements that are true for your agent today. The same checklist is available as a PDF above.

Trace design

Signals and alerts

Data protection

Review and improvement

Frequently asked questions

What is AI agent observability?

AI agent observability is the ability to understand what an agent did and why, using the data it emits. It combines traces of each run, metrics on quality, reliability, cost and safety, and logs of notable events. It lets teams diagnose problems, answer audit questions and improve the agent over time.

What should be in an agent trace?

A trace should record each step of a run: the context assembled, the model call, each tool call and result, policy decisions, human checkpoint outcomes, latency and cost. Each step should also record the prompt, model and tool versions, and the whole run should share one identifier.

How do you monitor AI agents in production?

Track five groups of signals: quality, such as online eval scores and override rates; reliability, such as tool success and errors; cost and speed, such as steps and tokens per task; safety, such as denied actions; and human oversight, such as checkpoint delays. Set a few alerts with named owners.

How do you keep traces from exposing sensitive data?

Redact personal data when writing traces or store references instead of content. Restrict access by role, log who views traces, and set retention periods agreed with legal and security. Capture full content only where debugging genuinely needs it and access is tightly controlled.

What is the difference between logging and tracing for AI agents?

A log records individual events. A trace links every step of one run under a single identifier, including the context the agent saw, the model call, tool calls, policy decisions, checkpoints, cost and versions. For agents, the trace is what lets you reconstruct why an action was taken.

Should you store prompts and responses in agent traces?

Only where the task allows it. Where data is sensitive, store metadata and references that can be resolved later under access control, and redact personal data at write time. Keep full content only when debugging needs it and access is tightly controlled, and log who views traces.

How long should AI agent traces be kept?

Retention should follow the agent's risk level and be agreed with legal, security and compliance teams. Low-risk internal agents can use short retention; regulated agents need retention set by regulation and policy. Treat the periods as starting points to calibrate, including how India's Digital Personal Data Protection Act, 2023 applies to your data.

References
  1. OpenTelemetry, Semantic conventions for generative AI
  2. Government of India, Digital Personal Data Protection Act, 2023

Scenarios and examples in this guide are illustrative, not customer cases. Thresholds and intervals are recommended starting points; calibrate to your environment. Last reviewed: October 2026.

Share

Put this into practice

Tell us about the workflow you want an agent to own. We map the controls, the failure modes and the measurement before any build starts.