Setup
Install Braintrust and the OpenAI Agents SDK:.env
Instrument OpenAI Agents SDK
- TypeScript
- Python
Use Braintrust’s trace processor with If you omit
@openai/agents to add instrumentation.Trace Processor
trace-agents.ts
logger, the processor uses the current Braintrust span, experiment, or logger when one is active.TypeScript Resources:Examples
In Braintrust, each OpenAI Agents run appears as a root task span with child spans for the agent’s internal steps.
- A root span for each agent run
- Child spans for tool calls, guardrails, handoffs, and nested model work
- Inputs and outputs for agent and tool spans
- Token metrics on LLM spans when the SDK exposes usage data
- Parent-child relationships when you run the agent inside an existing Braintrust span