TypeScript
Python
Setup
Auto-instrumentation
To trace OpenAI Agents SDK runs without modifying your application code, initialize Braintrust normally, then run your app with Braintrust’s import hook. The hook wires Braintrust’s trace processor into the OpenAI Agents SDK automatically, so you don’t need to install@braintrust/openai-agents or register a processor yourself. Requires @openai/agents v0.0.14 or later.Run with the import hook
node --import can run the file directly. The Braintrust APIs work the same in TypeScript projects — compile your TypeScript to JavaScript, then run the compiled file with the import hook.If you’re using a bundler, see Trace LLM calls for plugin and loader setup.
Manual instrumentation
To instrument OpenAI Agents SDK runs manually, add Braintrust’sOpenAIAgentsTraceProcessor yourself.logger, the processor uses the current Braintrust span, experiment, or logger when one is active.Examples
Braintrust captures:- A root task 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