OpenInference Claude Agent SDK Instrumentation
Actively maintained. Last release 10 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install openinference-instrumentation-claude-agent-sdkREADME as published on PyPI with version 0.1.32.
OpenInference Claude Agent SDK Instrumentation
Python auto-instrumentation for the Claude Agent SDK (Python). Traces query() and ClaudeSDKClient as OpenInference AGENT spans with prompt input, result output, session/model metadata, token counts, and tool child spans via hook injection.
query()– One span per call (one-off sessions).ClaudeSDKClient– One span per response turn: each time you iteratereceive_response(), a span is created for that turn. Use for continuous conversations.- Tools – Tool calls are captured as child TOOL spans via Claude Agent SDK hooks (PreToolUse/PostToolUse/PostToolUseFailure).
- Subagents – Work delegated through a subagent tool such as
Taskis grouped under a nested AGENT span, with the subagent's own tool calls as its children.
For detailed LLM and tool spans inside agent runs, use openinference-instrumentation-anthropic together with this package; the Agent SDK uses the Anthropic API under the hood.
Traces are OpenTelemetry-compatible and can be sent to any OTLP collector, Arize Phoenix (local), Phoenix Cloud, or Arize AX.
Installation
pip install openinference-instrumentation-claude-agent-sdk
Quickstart
pip install openinference-instrumentation-claude-agent-sdk claude-agent-sdk arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp