Skip to main content
The @braintrust/openai-agents package provides automatic tracing for OpenAI Agents SDK.

Installation

npm install @braintrust/openai-agents

Quick start

import { wrapOpenAIAgents } from "@braintrust/openai-agents";
import { Agent } from "@openai/agents";

// Wrap the agent for automatic tracing
const agent = wrapOpenAIAgents(new Agent({ name: "my-agent" }));

API Reference

Classes

OpenAIAgentsTraceProcessor

OpenAIAgentsTraceProcessor is a tracing processor that logs traces from the OpenAI Agents SDK to Braintrust. Args: options: Configuration options including: - logger: A Span, Experiment, or Logger to use for logging. If undefined, the current span, experiment, or logger will be selected exactly as in startSpan. - maxTraces: Maximum number of concurrent traces to keep in memory (default: 1000). When exceeded, oldest traces are evicted using LRU policy.

Source Code

For the complete source code and additional examples, visit the braintrust-sdk repository.