Documentation Index
Fetch the complete documentation index at: https://docs.mutagent.io/llms.txt
Use this file to discover all available pages before exploring further.
Anthropic Integration (Python)
Themutagent-anthropic package provides zero-change tracing for the official Anthropic Python SDK. Wrap your client once; every messages.create call is automatically traced.
Installation
mutagent-anthropic along with its dependencies. Tracing transport is provided by mutagent-sdk via the mutagent.tracing module. The anthropic SDK (>= 0.40.0) is also required and installed automatically.
Quick Start
Everymessages.create call is automatically traced and sent to MutagenT. No additional code changes required.
Full Example
Async Client
Optional: Session and Tags
Pass metadata to every span emitted by a client instance:What Gets Traced
Each non-streamingmessages.create call emits one llm.chat span with:
| Field | Source |
|---|---|
input.messages | messages param + system param (as role=system) |
output.text | First text block in response |
metrics.model | model from response |
metrics.provider | "anthropic" |
metrics.input_tokens | usage.input_tokens |
metrics.output_tokens | usage.output_tokens |
metrics.total_tokens | input_tokens + output_tokens |
attributes.session_id | session_id kwarg (if set) |
attributes.tags | tags kwarg (if set) |
wrap_anthropic API
client.messages.create in-place and returns the same client instance.
| Arg | Type | Default | Description |
|---|---|---|---|
client | Anthropic | AsyncAnthropic | required | Client to patch |
generation_name | str | None | "anthropic.messages.create" | Span name override |
session_id | str | None | None | Session ID stored in span attributes |
tags | list[str] | None | None | Tags stored in span attributes |
Limitations
- Streaming (
stream=True) is not traced in v0.1.0. Streaming requests pass through transparently. Tracking as a follow-up.
TypeScript Equivalent
MutagenT does not currently ship an Anthropic integration for TypeScript. For TypeScript LLM tracing, see OpenAI (TypeScript) or Vercel AI SDK.Related
Python Integrations
Overview of all Python integration packages
Python Tracing
Low-level tracing API and
@trace decoratorOpenAI (Python)
Trace OpenAI calls in Python
API Reference
REST API documentation