Registry / ai-ml / openinference-instrumentation-claude-agent-sdk

openinference-instrumentation-claude-agent-sdk

JSON →
library0.1.5pypypi✓ verified 86d ago

OpenTelemetry-based instrumentation for the Anthropic Claude Agent SDK, enabling tracing of agent runs, tool calls, and LLM interactions with OpenInference semantics. Version 0.1.5, compatible with Python 3.10-3.14. Actively maintained by Arize AI.

pip install openinference-instrumentation-claude-agent-sdk
INSTALL
IMPORT
SIG · OPENINFERENCE-INST
O
openinference-instrumentation-claude-agent-sdk
ai-mlpythonv0.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ClaudeAgentSDKInstrumentor
✓ from openinference.instrumentation.claude_agent_sdk import ClaudeAgentSDKInstrumentor
✗ from openinference_instrumentation_claude_agent_sdk import ClaudeAgentSDKInstrumentor

Initialize OpenTelemetry and instrument the Claude Agent SDK. Requires an OTLP endpoint (e.g., Phoenix) to collect traces.

from openinference_instrumentation_claude_agent_sdk import ClaudeAgentSDKInstrumentor from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter import os # Set up OpenTelemetry tracer provider tracer_provider = TracerProvider() tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint=os.environ.get('OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4318/v1/traits')))) trace.set_tracer_provider(tracer_provider) # Instrument the Claude Agent SDK ClaudeAgentSDKInstrumentor().instrument()
Debug
Known issues
gotchaThe instrument() call must happen before importing or using the Claude Agent SDK. Otherwise, spans will not be captured.
fix
Move instrument() to the top of your script, before any anthropic imports.
affects: all
breakingVersions prior to 0.1.5 used a different class name `ClaudeAgentInstrumentor` (without 'SDK'). The API changed in 0.1.4.
fix
Replace `ClaudeAgentInstrumentor` with `ClaudeAgentSDKInstrumentor` and update the import path.
affects: <0.1.4
deprecatedThe `suppress_tracing` argument in `instrument()` is deprecated in 0.1.5 and may be removed in a future version.
fix
Remove `suppress_tracing=True` from the instrument() call. It is no longer effective.
affects: 0.1.5
Upgrade
Version history
0.1.5latest on PyPI · released May 29, 2026
Audit
Dependencies
openinference-semantic-conventionsrequiredRequired for OpenInference span attributes
Agent activity
17 hits · last 30 days
node
16
Resources
openinference-instrumentation-claude-agent-sdk — pip install openinference-instrumentation-claude-agent-sdk · libregistry