A hands-on guide to tracing AI agents with OpenTelemetry, span design, and SDK-level instrumentation for production systems.
Agent TracingLong read

Production Monitoring Stack Decisions for Teams Shipping on OpenAI Agents SDK

Built-in traces alone won't catch silent agent failures in production.

· 9 min read
Cover illustration for “Production Monitoring Stack Decisions for Teams Shipping on OpenAI Agents SDK”
Agent Tracing · November 2, 2026 · 9 min read · 1,920 words

Production monitoring for LangGraph and OpenAI Agents SDK deployments requires execution tracing, platform observability, and behavioral monitoring. For teams shipping on the OpenAI Agents SDK, built-in traces provide a strong foundation, while OpenTelemetry connects agent activity to surrounding services. Correctness requires a separate layer that audits behavior against instructions and turns production failures into regression tests.

Why the OpenAI Agents SDK's built-in tracing is a genuine production asset, not just a development convenience

The OpenAI Agents SDK tracing guide documents tracing as enabled by default. Each Runner.run(), run_sync(), or run_streamed() call is wrapped in a trace without configuration. That gives teams an execution record from the start. Rather than requiring developers to reconstruct the agent loop through application logs, the SDK records its operations in structured spans that can be inspected during development and production.

An agent_span records an agent’s execution, while a generation_span records an LLM generation with its inputs, outputs, model name, and token usage. A function_span records a function-tool call, and a handoff_span records when control passes from one agent to another. Guardrail evaluations appear in guardrail_span, including whether the tripwire fired, while response_span represents the underlying Responses API call. This distinction makes the workflow legible beyond its final response.

The relationships between operations are recorded as well. A Python context variable tracks the nearest active span so that nested operations stay linked through parent identifiers. Each trace has a configurable workflow_name, a generated trace_id, and an optional group_id linking runs in one conversation. These identifiers give individual operations a workflow and conversational context. The Traces dashboard then provides a place to debug, visualize, and monitor those workflows before teams formalize their evaluations.

The structural silo problem: why traces living in OpenAI's dashboard creates a blind spot in production

The default export path sends those records to one destination. A BatchTraceProcessor batches spans in the background, and a BackendSpanExporter uploads them to OpenAI’s trace ingestion endpoint. This makes the dashboard ready to use without setup. It does not, however, automatically join agent execution to the infrastructure serving the same request.

A slow agent request may depend on a downstream API, a database queried by a specialist, or the service that invoked the agent. Those dependencies sit beyond the agent’s immediate execution record. If agent traces live in one system and infrastructure traces in another, engineers must reconcile timestamps manually. The agent trace can identify a slow tool call without connecting that call to the surrounding service activity. The resulting blind spot concerns causality.

Teams can change where traces go through the SDK’s processor pipeline. Its observability guide documents add_trace_processor(processor) for appending a destination while preserving the existing processor. It also documents set_trace_processors([...]) for replacing the processor list entirely. Export is therefore a deliberate stack decision. Teams can keep the dashboard and send the same execution evidence to another observability system.

How agent failures actually present in production, and why execution logs don't catch most of them

An agent can complete without an exception while doing the wrong thing. Its run may include retrieval, generation, tool calls, guardrails, handoffs, retries, and a final response. Each operation can appear successful while the sequence violates the task’s requirements. Logging only the final prompt and response removes the intermediate evidence needed to understand that divergence.

Silent tool failure illustrates the distinction particularly clearly. A tool can return a 500, after which the agent fabricates a plausible response and the overall run is marked successful. Context window decay and planning failures can also lead to multi-step outputs that sound confident but are wrong. A policy violation may pass through a guardrail whose tripwire never fires, leaving no guardrail failure signal.

The same distinction becomes more consequential when agents have excessive production permissions. Without an approval gate for destructive operations, a tool that runs successfully can cause real-world damage. Success codes describe execution independently of whether the operation was authorized by the task. Production monitoring therefore has to distinguish a completed run from an acceptable outcome. Infrastructure visibility helps explain how an operation happened, but on its own cannot show whether the agent should have done it.

What the OpenAI Agents SDK traces can tell you and where their coverage ends

The span model records concrete evidence about execution. It shows whether a tool was called, which arguments it received, and what it returned. It records guardrail evaluations and tripwire results, identifies the receiving agent at a handoff, and captures timing throughout the run. Generation spans also show model names and token counts. These fields support reconstruction of the workflow without assigning a correctness judgment to it.

A recorded tool result does not establish semantic correctness. Similarly, a guardrail result does not establish that its evaluation logic adequately enforced the policy. The receiving specialist identified by a handoff requires a separate assessment of appropriateness for the task. Final output can be available for inspection without being evaluated against the agent’s instructions. The trace supplies evidence for these judgments, but the default span model does not make them.

Coverage also has practical limits around spend and sensitive content. Span-level cost attribution requires added model cost and token attributes, grouped by agent role. Payload capture creates a separate production concern. Generation inputs and outputs, together with tool arguments and results, can expose invoices, account details, and user input in customer-support traces. The SDK guide describes an opt-in environment-variable switch that drops prompt payloads at the source and keeps the span structure.

How OpenTelemetry closes the infrastructure gap by making agent spans part of the same trace as everything around them

The first stack decision is to export the SDK’s spans through OpenTelemetry, or OTel, into the existing observability system. The SDK already supplies the agent span tree. With context propagation, agent operations can join the API, worker, and database spans surrounding them, allowing latency to be attributed across the request path.

The choice of processor sets whether traces still go to OpenAI. An OTel export processor added through add_trace_processor() preserves the existing backend while introducing another export path. For long-running workers, the SDK guide also recommends flush_traces() at the end of a unit of work. Otherwise, background batching delays when traces can be seen after the work ends. This is relevant to Celery, RQ, Dramatiq, and FastAPI background tasks, where a finished job may not immediately appear in the dashboard.

OpenLIT emphasizes low-friction setup through one import and one function call. OpenInference provides broad agent and LLM framework coverage for traces, but not metrics or logs. OpenLLMetry supports a wide range of agent frameworks through a single initialization line. The choice depends on framework coverage and required telemetry, while OTel’s GenAI semantic conventions provide shared vocabulary for AI workloads. As of early 2026, those conventions are marked Development.

HTTP delegation needs the W3C traceparent header, while auto-instrumentation handles context propagation for in-process SDK handoffs. When captured, prompt and completion content should use gen_ai.content.prompt and gen_ai.content.completion span events. Production teams should disable content capture or redact it through a Collector before storage. MCP placement also defines a trust boundary, with hosted tools running through the model surface and local or SDK-managed servers giving the runtime control over connectivity, filtering, and approvals.

The metrics that actually predict production failures versus the ones teams typically instrument first

Token counts and prompt details are accessible early measurements, but they prioritize spend and content inspection over workflow reliability. A workflow can stay within its token budget and still fail its task. The measurement priority should therefore begin with execution outcomes and their relationship to task completion. Tool-call success rate, handoff success rate, guardrail trigger rate, retry rate, and final task completion rate provide different views of that relationship. None should be treated as an interchangeable success measure.

Total run latency establishes the user-facing duration, while per-tool latency and model latency by step identify where time accumulates. Queue wait time measures how long asynchronous work waits before it starts. Without that distinction, a slow job can be attributed to agent execution when it waited before running. Intermediate spans show where the wait ends and the work starts.

Cost per successful task and cost per failed run separate productive expenditure from unsuccessful execution, while token usage by workflow stage reveals where consumption concentrates. Model cost and token attributes on each span, grouped by agent role, show which specialists or tool-call stages cost more than session totals reveal. Quality requires a different connection to outcomes. User feedback attached to trace IDs, evaluation scores by workflow version, and regression rates after prompt or tool changes link execution evidence to changes in behavior.

Why execution visibility alone cannot close the correctness gap, and what behavioral monitoring requires

A connected trace can establish what happened across the request path. Judging whether the agent followed its instructions requires a specification beyond operation names, arguments, outputs, and timing. For an agent, its instructions supply that specification. Behavioral monitoring compares the recorded sequence and result with the constraints the agent was supposed to follow.

This comparison differs from checking whether a tool returned successfully. It asks whether the response complied with policy, whether a handoff selected the right specialist for the right reason, or whether an identifier in the output actually existed in the system. Each question requires interpreting execution in relation to the task. More comprehensive export does not supply that interpretation automatically. OTel closes the infrastructure gap, while correctness auditing addresses a separate gap in meaning.

Predefining every possible failure mode is not a scalable substitute. Agent instructions change, behavior varies, and production brings patterns that were not foreseen during development. The practical approach is to audit traces against the agent’s own instructions and surface deviations automatically. Those deviations must then become actionable issues.

What monitoring stack should teams use for OpenAI Agents SDK apps after deployment?

The recommended architecture separates three responsibilities without forcing a choice between the SDK dashboard and another backend. The first layer is the agent runtime and its built-in execution tracing. It supplies model calls, tool calls, handoffs, guardrails, and custom spans, with the dashboard supporting individual-run debugging and selection of useful evaluation examples. Its operational configuration includes worker flushing and payload controls for sensitive workflows. This layer establishes the evidence available to everything above it.

The second layer is platform observability through OTel export. It connects agent spans to surrounding services and supports reliability, performance, and cost analysis at the operation level. MCP tool calls should be part of that view too. Whether MCP is hosted or runtime-managed affects where tool spans appear and who controls the trust boundary. This layer answers questions about execution dependencies and resource use, rather than substituting infrastructure health for behavioral quality.

The third layer audits behavior against instructions. A suitable platform should evaluate every trace, group deviations into actionable issues, and alert teams without requiring every failure pattern to be predefined. Developer workflow integration is a practical selection criterion. Alerts in Slack that connect to the coding environment reduce the friction of moving from detection to remediation. Compatibility with existing frameworks, including Vercel AI, OpenAI Agents SDK, and LangGraph, avoids a monitoring-driven rewrite, while SOC 2 compliance and data isolation are baseline requirements for handling production traces.

The three layers converge in the evaluation loop. Teams should use the same scorer in pre-deploy testing and production scoring, so that the definition of acceptable behavior does not change at deployment. A production trace that fails becomes a regression case for the next test cycle. That case then tests whether the next change corrects the discovered behavior.

Sources

  1. Integrations and observability
  2. Tracing - OpenAI Agents SDK
Filed underAgent Tracing

More in Agent Tracing