Skip to main content
You can use W&B Weave with the OpenAI Agents SDK to trace and monitor your agentic applications. This guide shows you how to install the integration, initialize Weave in your agent code, and view the resulting traces in the Weave dashboard so you can debug and evaluate multi-agent workflows.
The OpenAI Agents Python SDK is a lightweight framework for building multi-agent workflows.

Installation

Install the required dependencies using pip:
pip install weave openai-agents

Get started

To use the OpenAI Agents SDK with Weave:
  1. Initialize Weave with your project name.
  2. Add the Weave tracing processor to your agents.
  3. Create and run your agents as usual.
The following code sample creates an OpenAI Agent and integrates it with Weave for traceability. The sample initializes a Weave project and sets up the WeaveTracingProcessor to capture execution traces. A Weather data model represents weather information. The get_weather function, decorated as a tool the agent can use, returns a sample weather report. An agent named Hello world uses basic instructions and access to the weather tool. The main function runs the agent asynchronously with a sample input (What's the weather in Tokyo?) and prints the final response.
from pydantic import BaseModel
from agents import Agent, Runner, function_tool
import agents
import weave
import asyncio

weave.init("openai-agents")

class Weather(BaseModel):
    city: str
    temperature_range: str
    conditions: str

@function_tool
def get_weather(city: str) -> Weather:
    return Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.")

agent = Agent(
    name="Hello world",
    instructions="You are a helpful agent.",
    tools=[get_weather]
)

async def main():
    result = await Runner.run(agent, input="What's the weather in Tokyo?")    
    print(result.final_output)

if __name__ == "__main__":
    asyncio.run(main())

View traces

When you run the previous code sample, Weave generates a link to the Weave dashboard. Open the link to inspect traces from your agent run.