Anthropic SDK

OpenTelemetry instrumentation for the Anthropic SDK. The offline examples are pending.

Python

Package: opentelemetry-instrumentation-anthropic (version at time of writing: 0.63.1, not yet tested by us)

Not yet tested by us: the install line and setup below have not been run by us.

Not yet tested by us
pip install opentelemetry-sdk==1.45.2 opentelemetry-instrumentation-anthropic==0.63.1 anthropic
Setup (not yet tested by us)
import os
os.environ["TRACELOOP_TRACE_CONTENT"] = "false"  # no prompt or response content

from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor

# After creating your tracer provider (resource with "telumin.agent.owner"):
AnthropicInstrumentor().instrument(tracer_provider=provider)

Example pending

No example yet. Each example must run in CI with a mocked model, without an API key and without network access, and that has not been verified for this package.

TypeScript

Package: @traceloop/instrumentation-anthropic (version at time of writing: 0.27.0, not yet tested by us)

Not yet tested by us: the install line and setup below have not been run by us.

Not yet tested by us
npm install --save-exact @traceloop/instrumentation-anthropic@0.27.0 @anthropic-ai/sdk
Setup (not yet tested by us)
import * as anthropic from "@anthropic-ai/sdk"
import { AnthropicInstrumentation } from "@traceloop/instrumentation-anthropic"

// After registering your tracer provider (resource with "telumin.agent.owner"):
const instrumentation = new AnthropicInstrumentation({ traceContent: false })
instrumentation.manuallyInstrument(anthropic)

Example pending

No example yet. Each example must run in CI with a mocked model, without an API key and without network access, and that has not been verified for this package.

Owner and approvals

No instrumentation package records who owns an agent or who approved a tool call. Add both with telumin-otel, as the examples do.

Check the result

To check the result, export the spans as OTLP JSON (or send them through the collector tap) and drop the file on the free check. The check runs in your browser tab.

Guides