The Claude Agent SDK is a Python SDK for building agent applications with Claude. Weave automatically traces Claude Agent SDK calls, including agent queries, model responses, tool use, and multi-turn conversations. 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 Claude Agent SDK agents with Weave
The Weave SDK autopatches the Claude Agent SDK, allowing you to capture traces from your Claude agents with minimal setup. This doc shows how to initialize Weave and then run a Claude agent with MCP tools throughClaudeSDKClient so that Weave automatically traces the conversation, model calls, and tool calls end-to-end.
Prerequisites
- A W&B account and API key set as a
WANDB_API_KEYenvironment variable - An Anthropic API key set as an
ANTHROPIC_API_KEYenvironment variable - 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 creates a Claude agent with two MCP math tools and runs it while Weave captures its traces.
weave.init() prints a link to your project when it runs.
Learn how to navigate the Agents view in the Weave UI.