openinference-instrumentation-claude-agent-sdk
OpenInference Claude Agent SDK Instrumentation
What it is and what it does
This package wraps Claude Agent SDK calls (query() and ClaudeSDKClient) with OpenTelemetry instrumentation to emit traces compatible with OpenInference conventions. Each call generates an AGENT span containing the prompt input, result output, session and model metadata, token counts, and nested TOOL spans for any tool invocations. Traces are sent to an OTLP collector—Phoenix (local or cloud), Arize AX, or any standard OpenTelemetry backend—enabling observability of agent behavior, tool usage, and LLM costs.
The package uses hook injection into the Claude Agent SDK to capture tool execution (PreToolUse, PostToolUse, PostToolUseFailure events) without modifying application code beyond a single instrumentation call. It depends on openinference-instrumentation, opentelemetry-api, opentelemetry-instrumentation, and related semantic convention packages. For deeper visibility into internal Anthropic API calls within the agent, pair it with openinference-instrumentation-anthropic.
Use it for:
- Monitor agent query latency, token usage, and cost per call in production.
- Debug multi-turn conversations by viewing the full trace of prompts, responses, and tool calls.
- Analyze tool invocation patterns and failure rates across agent runs.
- Export traces to Phoenix Cloud or Arize AX for centralized LLM observability dashboards.
- Correlate agent spans with downstream application metrics in a unified OpenTelemetry backend.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Auto-instruments Claude Agent SDK calls to emit OpenTelemetry-compatible traces capturing prompts, results, token counts, and tool execution as OpenInference AGENT spans.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and directly solves a concrete problem—observing Claude Agent SDK behavior in production. Install it if you run Claude agents and need traces for debugging, monitoring, or cost analysis. Pair it with openinference-instrumentation-anthropic if you also need visibility into the underlying Anthropic API calls.
Install
openinference-instrumentation-claude-agent-sdk on PyPI
pip
pip install openinference-instrumentation-claude-agent-sdkuv
uv add openinference-instrumentation-claude-agent-sdkpoetry
poetry add openinference-instrumentation-claude-agent-sdkInstalling openinference-instrumentation-claude-agent-sdk
Before you install
Low friction: pure Python wheel with standard OpenTelemetry dependencies. Actively maintained (released 2026-08-12, last commit 2026-08-14) with no known vulnerabilities.
License in practice
Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions.
Quickstart
pip install openinference-instrumentation-claude-agent-sdk
from openinference.instrumentation.claude_agent_sdk import ClaudeAgentSDKInstrumentor
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
ClaudeAgentSDKInstrumentor().instrument(tracer_provider=tracer_provider)
Requires Claude Agent SDK and an OTLP collector endpoint (local Phoenix, Phoenix Cloud, or Arize AX) to send traces.
Verify before relying
- Whether traces from query() and ClaudeSDKClient.receive_response() are automatically correlated across multi-turn conversations.
- Performance overhead of hook-based instrumentation on high-frequency tool calls.
- Whether tool span context is preserved when using openinference-instrumentation-anthropic alongside this package.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — openinference-instrumentation, openinference-semantic-conventions, opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions, typing-extensions, wrapt |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 432,529/month — #6,707 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: openinference_instrumentation_claude_agent_sdk-0.1.10-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
lmnr-claude-code-proxyA thin proxy server that routes Claude Code…
unclear · top 5,000 on PyPI
openinference-instrumentation-agnoAuto-instruments Agno Agent applications to…
permissive · top 15,000 on PyPI
openinference-instrumentation-openaiAuto-instruments OpenAI Python SDK calls to…
permissive · top 5,000 on PyPI
openinference-instrumentation-google-adkAuto-instruments Google ADK applications to…
permissive · top 15,000 on PyPI
openinference-instrumentation-google-genaiAutomatically instruments Google GenAI SDK…
permissive · top 15,000 on PyPI
openinference-instrumentation-mcpAuto-instruments MCP tool calls to propagate…
permissive · top 15,000 on PyPI
claude-agent-sdkPython SDK for building and interacting with…
permissive · top 1,000 on PyPI
openinference-instrumentation-openai-agentsAuto-instruments OpenAI Agents SDK to emit…
permissive · top 5,000 on PyPI
openinference-semantic-conventionsDefines semantic conventions and standardized…
permissive · top 5,000 on PyPI
claude-code-sdkPython SDK for querying Claude Code and…
permissive · top 15,000 on PyPI