Skip to main content
The Anthropic integration automatically instruments Anthropic SDK calls to capture performance data and errors for Claude models.

Installation

The integration is enabled by default in Node.js:

Basic Usage

Just use the Anthropic SDK normally:

Configuration

Default Behavior

By default, prompts and responses are not captured:

Capture Prompts and Responses

Enable for all AI integrations:

Integration Options

boolean
default:"sendDefaultPii"
Capture prompt messages
boolean
default:"sendDefaultPii"
Capture completion responses

Captured Data

Always Captured

These attributes are always included:

When recordInputs: true

Prompt messages and system prompts are captured:

When recordOutputs: true

Completion responses are captured:

Supported Operations

Message Creation

Streaming Messages

System Prompts

Tool Use (Function Calling)

Practical Examples

Multi-Turn Conversation

Content Moderation

Document Analysis

Tool Use with Weather API

Model Support

The integration supports all Claude models:
  • Claude 3.5 Sonnet: claude-3-5-sonnet-20241022
  • Claude 3 Opus: claude-3-opus-20240229
  • Claude 3 Sonnet: claude-3-sonnet-20240229
  • Claude 3 Haiku: claude-3-haiku-20240307
  • Claude 2.1: claude-2.1
  • Claude 2.0: claude-2.0

Performance Monitoring

Track Claude performance metrics:
  • Response Times: API latency per model
  • Token Usage: Input and output tokens
  • Stop Reasons: Track why generations ended
  • Error Rates: Rate limits and API errors

Source Code

The Anthropic integration is implemented in: packages/node/src/integrations/tracing/anthropic-ai/index.ts:11

Privacy Best Practices

Claude conversations may contain sensitive user information.

Filter Personal Information

Selective Capture by Use Case

Troubleshooting

Spans Not Appearing

Ensure tracing is enabled:

Streaming Responses Not Captured

Streaming responses are fully captured. Token usage appears after the stream completes.

Tool Use Not Showing

Tool use is captured in span attributes. Enable recordOutputs: true to see tool calls: