Skip to main content

Installation

Setup

We recommend using UUIDs for session_id and user_id so traces can be grouped reliably across runs.

Usage

What gets traced

Tool tracing

The adapter injects tracing hooks into the Claude SDK client at initialization:
  • PreToolUse — Creates a TOOL span with the tool’s input arguments
  • PostToolUse — Sets the tool’s output and marks the span as OK (or ERROR if is_error is true)
  • PostToolUseFailure — Records the error and marks the span as ERROR

Extended thinking

Thinking blocks are automatically handled:
  • Thinking content is extracted and stored in metadata as reasoning_summary
  • Thinking-only messages are buffered and combined with the next message’s thinking
  • Thinking blocks are stripped from the visible output

Conversation history

The adapter maintains conversation history across turns on the client instance (_pandaprobe_history), allowing multi-turn tracing with proper context.

Token usage mapping

Example with tools

This example exposes two tools via an in-process MCP server and runs a query through ClaudeSDKClient. We trace the agent via ClaudeAgentSDKAdapter:
This produces a trace with: CHAIN (root) → AGENTLLM (model call) → TOOL (get_weather) → TOOL (get_population) → LLM (final response).