Skip to main content

Documentation Index

Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Automatically capture all Anthropic Messages API calls.

Setup

import traceroot
from traceroot import Integration

traceroot.initialize(integrations=[Integration.ANTHROPIC])

Usage

Once initialized, all Anthropic calls are captured automatically:
import anthropic

client = anthropic.Anthropic()

# This call is automatically traced
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "What is the capital of France?"},
    ],
)

print(response.content[0].text)

What Gets Captured

AttributeDescription
Modelclaude-sonnet-4-20250514, claude-haiku-4-5-20251001, etc.
MessagesInput messages array
ResponseCompletion content
TokensInput and output tokens
CostCalculated from token usage and model pricing
LatencyRequest duration

Run the example

Clone the repo and run a complete agent end-to-end.

Python

Run the Python example

TypeScript

Run the TypeScript example