The OpenAI Agents SDK is a lightweight framework for building agents and multi-agent workflows on top of OpenAI’s API. Weave automatically traces agents built with the OpenAI Agents SDK, including each agent invocation, sub-agent handoff, model call, and tool call. Weave displays the captured data in the Agents view of your project.Documentation Index
Fetch the complete documentation index at: https://wb-21fd5541-weave-agents.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Trace OpenAI Agents SDK agents with Weave
The Weave SDK autopatches with the OpenAI Agents SDK, allowing you to capture traces from your agents with minimal set up. This doc shows how to initialize Weave and then run a multi-turn research agent built with the OpenAI Agents SDK so that Weave captures every agent invocation, model call, and tool call across the session.Prerequisites
- A W&B account and API key set as a
WANDB_API_KEYenvironment variable - An OpenAI API key
- Python 3.10+
Install packages
Install the following packages in your developer environment:Initialize Weave in your code
Addweave.init to the project, along with your W&B team and project names, and then build an agent the way you normally would. The following code defines a wikipedia_search function tool and a Research assistant agent, then runs three questions through the OpenAI Agents SDK Runner while Weave captures the trace.
Runner.run continues the conversation by passing the previous result’s input list back as the next request.
See your agent traces in the Agents view
weave.init() prints a link to your project when it runs. Open the Agents view to inspect:
- A row in the Agents tab for
Research assistant - A session containing three turns
- Each turn rendered as an
invoke_agentspan with nested model calls and tool calls - The full input, model, output, token usage, and Wikipedia results at each step