OpenAIAgentsInstrumentor, automatically capturing agent runs, tool calls, handoffs, and LLM interactions.
Quick Start
Last tested with
openai-agents 0.14.6 (April 2026).What Gets Traced
This setup captures:- Agent runs - Every agent invocation with inputs and outputs
- LLM calls - Model requests, responses, and token usage
- Tool calls - Each tool execution with arguments and results
- Handoffs - Agent-to-agent delegation with routing context
- Agents-as-tools - Nested agent delegation via
agent.as_tool()
@trace decorators are required for the standard Agents SDK path.
The
openai-agents pip package exposes agents as its top-level module, so imports use from agents import ....All examples below assume the Quick Start setup above. The setup block is repeated in each snippet so they are individually copy-pasteable.Example: Single Agent with Tools
Example: Multi-Agent Handoffs
The Agents SDK supports handoffs where a triage agent delegates to specialists:Example: Agents-as-Tools
For parallel execution, wrap specialist agents as tools usingagent.as_tool():
Troubleshooting
Traces not appearing
- Check environment variables - Ensure
HH_API_KEYis set - Pass the tracer provider - The instrumentor must receive
tracer_provider=tracer.provider:
- Call
force_flush()before exit - Ensure traces are exported before the process ends:
- Check your model provider - Ensure
OPENAI_API_KEYis set
Related
Enrich Your Traces
Add user IDs and custom metadata to agent traces
Custom Spans
Create spans for business logic around agent calls
Distributed Tracing
Trace agents across service boundaries

