Skip to main content
The OpenAI Agents SDK is a lightweight framework for building agents and multi-agent workflows on top of OpenAI’s API. CoreWeave Agent Lens automatically traces agents built with the OpenAI Agents SDK, including each agent invocation, sub-agent handoff, model call, and tool call.
This integration uses the Weights & Biases Weave SDK (weave), because the CoreWeave Forge SDK doesn’t support this framework yet. Traces you send with Weave appear in Agent Lens, because both products share the same trace data.

Trace OpenAI Agents SDK agents with Agent Lens

The Weave SDK autopatches the OpenAI Agents SDK for Python so you can capture traces from your agents with minimal setup. This guide explains how to initialize Weave and then run a multi-turn research agent built with the OpenAI Agents SDK so that Agent Lens captures every agent invocation, model call, and tool call across the session.

Prerequisites

Before you begin, make sure you have the following:
  • A CoreWeave Forge account and API key set as a WANDB_API_KEY environment variable.
  • An OpenAI API key.
  • Python 3.10+.

Install packages

Install the following packages in your developer environment so that Weave and the OpenAI Agents SDK are available to your script.

Initialize Agent Lens in your code

Add weave.init to the project, along with your Forge team and project names, and then build your agent as usual. 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 Agent Lens captures the trace. Each Runner.run call starts its own trace, so the example passes a RunConfig with a shared group_id on every call. Weave uses group_id to group traces from the same conversation, falling back to each trace’s own ID when no group_id is set.
The example runs three turns in a single conversation. The first two turns trigger Wikipedia lookups, and the third uses the prior conversation context to produce a summary without a tool call. Each call to Runner.run continues the conversation by passing the previous result’s input list back as the next request, and shares the same group_id so that Agent Lens groups all three turns into one conversation in the Conversations tab. Without a shared group_id, each turn falls back to its own trace ID and appears as a separate conversation.

View your traces in Agent Lens

After the script runs, weave.init() prints a link to your project in Weave. The same traces appear in Agent Lens, because both products share the same trace data. To view them in Agent Lens:
  1. Navigate to CoreWeave Forge and select Agent Lens from the product menu.
  2. Select your project.
  3. In the Agent Lens side menu, select Conversations, and then select your conversation.
Each turn renders as an invoke_agent span with nested chat and execute_tool spans. Each span shows its input, model, output, token usage, and tool results. For more information, see View agent activity.
Last modified on September 30, 2026