PythonIntegrations

Claude Agent SDK

setup_claude_agent_sdk()

Patch the Claude Agent SDK for automatic tracing.

Monkey-patches ClaudeSDKClient and the standalone query() function so every agent turn, LLM call, and tool invocation is recorded as a span. Call this once at startup, before any SDK usage.

from judgeval import Tracer
from judgeval.integrations import setup_claude_agent_sdk

Tracer.init(project_name="my-agent")
setup_claude_agent_sdk()

# All Claude Agent SDK calls are now traced automatically
def setup_claude_agent_sdk() -> bool:

Returns

bool - True if patching succeeded, False on error.