From Zero Visibility to Full Agent Observability on the OpenAI Agents SDK
Route the SDK's default traces into your stack and measure correctness.

Production monitoring for OpenAI Agents SDK deployments requires three layers, which are tracing, operational metrics, and evaluations against the agent’s instructions. The SDK provides tracing by default, but full agent observability requires routing that evidence into the wider monitoring stack and using it to catch behavioral regressions after every fix.
What the OpenAI Agents SDK records before you configure anything
Tracing is built into the SDK and enabled by default. Every Runner.run() call is automatically wrapped in a single trace(), making one agent run one trace without additional configuration. A trace shows the end-to-end workflow, and a span shows an operation inside it. OpenAI’s integrations guide describes coverage of the overall run, model calls, tool calls and their outputs, handoffs, guardrails, and custom spans that developers wrap around the workflow.
The SDK creates agent_span, generation_span, function_span, handoff_span, guardrail_span, task_span, and turn_span, each with its own payload shape. Parent–child relationships are preserved automatically during the run. A Python contextvar tracks the nearest active span, so a handoff from a triage agent to a billing agent retains its place in the workflow. The trace also records a workflow_name, a generated trace_id, and an optional group_id that ties multiple runs into one conversation thread.
Export happens in the background through a BatchTraceProcessor registered at import. It batches spans and flushes every few seconds to a BackendSpanExporter, which uploads them to OpenAI’s trace ingestion endpoint. The Traces dashboard therefore populates without extra setup. For long-running workers, background tasks, queue consumers, and cron-style jobs, flush_traces() provides a blocking flush when export must finish before the unit of work is considered complete.
This tracing baseline belongs to a broader API transition. The Assistants API was deprecated August 26, 2025 and shut down August 26, 2026, making the Responses API and Conversations API the production standard going forward. Teams still on Assistants should migrate to those APIs. For SDK deployments, however, the default trace destination remains a single silo, separate from the rest of the production system.
Why the OpenAI Traces dashboard is the wrong place to stop
A single agent question can expand into three agents, two model calls, and a guardrail evaluation. A downstream API, database query, or calling service can determine the user’s wait even when the model responds promptly. When agent traces and infrastructure traces live in different tools, engineers must line up timestamps by hand to reconstruct the request.
That separation also fragments the cost picture. A guardrail agent, a triage agent, and a specialist can produce three model calls for one user question. Guardrail token costs are easy to miss when they show up only in the OpenAI dashboard and are left out of the view teams use to track the whole workflow. The relevant unit is the user’s completed task.
A run can return a result, exit with code zero, and still be wrong. Monitoring that records only whether a response arrived cannot show whether the work met the user’s needs, and metadata-only logs can make connected agent steps look like separate events. Patterns across a full session then drop out of the analysis, even though the individual events are still there.
The SDK has already supplied the span tree. The next step is to change where that evidence goes so it can join the service timeline and support analysis beyond individual model calls. Two functions provide that opening move. add_trace_processor() appends a processor, allowing traces to reach both OpenAI’s backend and the team’s destination, while set_trace_processors([...]) replaces the processor list so traces go only where specified.
How OpenTelemetry breaks the agent trace out of its silo
OpenTelemetry makes the agent run part of the same distributed trace as the rest of the system. A slow request can then expose its full timeline. The SDK already builds the hierarchy of operations, and OpenTelemetry translates it into a standard form that works with the observability infrastructure already in place.
The logical sequence is to redirect export, translate the spans, and redact captured content before it reaches a shared platform. OpenAIAgentsInstrumentor hooks the SDK and captures Runner.run calls, tool invocations, handoffs, LLM requests, and guardrails as OpenTelemetry spans. The mapping preserves the distinctions needed for diagnosis. A function_span records the tool name, arguments, and result, while a handoff_span identifies the source and destination agents and a guardrail_span records the guardrail name and whether its tripwire fired.
Trace entries include timing, token counts, the model used, input and output content, and success or exception status. Datadog describes its integration with the SDK’s built-in tracing as automatically capturing agent invocations, tool calls, model generations, guardrail validations, and LLM responses without code changes. OpenTelemetry’s GenAI semantic conventions cover events, metrics, model spans, agent spans, and provider-specific conventions, including separate OpenAI and MCP conventions. A standard schema reduces dependence on a particular AI tooling layer.
Content capture requires a separate privacy decision. Messages and tool-call attributes can contain sensitive or personal data, so capture should require explicit opt-in and a redaction policy before export to a shared platform. Recording everything without filtering creates operational debt.
MCP tool calls should be part of the same trace. The instrumentation adds MCPInstrumentor, and how it connects depends on the deployment’s trust boundary. Hosted MCP works with public remote servers that fit the platform trust model, while local or private MCP through MCPServerStdio or MCPServerStreamableHttp lets the runtime control how it connects, what it filters, and what it approves.
What to measure once traces are flowing somewhere useful
Workflow reliability is more informative than prompt detail alone. The decisive failure may precede the final answer, because retrieval supplied the wrong context, a tool timed out, a guardrail blocked the route, or a handoff reached the wrong specialist. A technically successful run can also violate business policy. Without intermediate spans, a dashboard can show the final response while concealing the operation that needs attention.
The starting reliability measures are tool call success rate, handoff success rate, guardrail trigger rate, retry rate, and final task completion rate. These measures describe different parts of the workflow. Function results provide evidence about tool execution, guardrail tripwires identify blocked paths, and handoff records expose the route between agents. A recorded handoff establishes where work went, while the appropriateness of that destination remains a separate question, so operational completion must remain distinct from correctness.
Performance needs the same separation by operation. Total run latency describes the user’s wait, per-tool latency isolates external work, and model latency by step distinguishes generation delays within the agent chain. For asynchronous jobs, teams also need to track queue wait time. Combining these into one duration would conflate slow model execution with work that waited before it began.
Cost should likewise follow the complete workflow. Anthropic’s 2026 report found that 57% of organizations use agents for multi-stage workflows, so token counts that multiply across stages are a concern built into these workflows and go well beyond edge cases. Token counts need to include the agents and guardrails involved in completing the task, along with the final answer. Otherwise, a change in routing can change the cost even when the output the user sees looks much the same.
Evaluation scores, user feedback, and regression rates should attach to trace IDs and specific workflow versions so a quality change can be connected to a deployment. The integrations guide positions traces as a source of higher-signal examples for workflow evaluation once behavior stabilizes. That connection preserves the evidence needed to investigate quality without pretending that execution metrics already measure it.
The silent failure class that span data alone will not surface
A clean span tree establishes that operations ran. It does not establish that they achieved the intended outcome. An agent can return HTTP 200 without an exception while fabricating a result, promising something outside policy, or satisfying a check without doing the underlying work. These are semantic failures, distinct from tool errors and guardrail trips, because their meaning depends on the agent’s instructions.
The trace can show the expected tool, its arguments, and a returned result while leaving unresolved whether the agent used that tool for the right purpose. Context loss across a long handoff chain creates a similar gap, because the individual transfers may succeed while information needed for the task disappears. Goal drift can also happen across a multi-step workflow without any one operation raising an exception.
Silent quality degradation can lower the usefulness of outputs while execution remains stable. Reward-shaped behavior presents a different problem, in which the agent satisfies a check without legitimately completing the task.
The MAST taxonomy grounds this distinction in annotated execution traces across seven open frameworks. It groups failures into Specification Issues, Inter-Agent Misalignment, and Task Verification. Task verification failures account for roughly 21% of categorized failures and are especially difficult to detect from traces alone.
Error rate, latency, and availability describe whether the system responds within operational bounds, leaving systematically wrong responses for a user cohort unassessed. Evaluation against the agent’s declared instructions adds the missing judgment. Although evaluators take work to build, the SDK’s span tree already has the evidence they need, including the actions and intermediate results that an output-only check would miss.

Closing the loop with evals that run against the agent's own instructions
Production evaluators should grade runs against the agent’s declared instructions. The full trace provides the context for that judgment, including tool use, handoffs, intermediate results, and the final response. This makes the evaluation specific to the task. A result that reads well can still fail if the agent skipped a required step or made a promise its instructions prohibited.
The recommended coverage is the full production trace stream. Silent failures look like normal traffic until an evaluator reads the evidence, so sampling based on visible execution problems cannot reliably pick them out. Down-sampling to cut evaluation costs therefore risks leaving out the sessions this layer needs to check.
An eval harness makes those judgments repeatable. It gives teams a way to define golden tasks, replay tool calls deterministically, score runs with concrete rubrics, and block regressions in CI while retaining links to production traces. In a multi-tool, MCP-style ecosystem, that scope must include step sequences, side effects, state, and output text.
Every fix should come with an online eval. That requirement turns a resolved defect into a continuing check, allowing the system to catch a regression when a later model or prompt version reintroduces it. The online check complements the harness rather than replacing it, because pre-release testing and production evaluation examine behavior at different points in the release cycle. Both need the trace context that explains what happened.
MCP can shorten the path from diagnosis to repair. An MCP server can connect a coding agent directly to trace context and eval results, allowing the progression from detected issue to fix to opened PR to happen inside the agent. The integrations guide treats traces and workflow evaluation as sequential parts of the same process.
A production monitoring platform earns its place by operating that process continuously. Its concrete responsibilities are to ingest every trace, audit each against the agent’s instructions, group recurring failures into issues, and create an online eval after a fix ships.


