Setup
Enable instrumentation with a single function call. This automatically tracks all subsequent calls to bothAnthropic and AsyncAnthropic clients.
A single
instrument() call instruments both synchronous and asynchronous clients. You don’t need to call it twice.Usage
Once instrumented, use the Anthropic client as you normally would. Allmessages.create calls are automatically traced.
Synchronous
Asynchronous
Streaming
Streaming responses are supported for both sync and async. The trace is recorded once the stream completes.Sync Streaming
Async Streaming
Captured Data
The integration automatically records:| Field | Description |
|---|---|
gen_ai.system | anthropic |
gen_ai.request.model | Model ID (e.g., claude-3-5-sonnet-20241022) |
gen_ai.prompt | System and user messages |
gen_ai.completion | Response text |
gen_ai.usage.input_tokens | Input token count |
gen_ai.usage.output_tokens | Output token count |
duration | Request latency |

