Skip to main content
Valiqor automatically traces all Anthropic messages.create calls — both sync and async. Every call is recorded as a span with model name, token usage, cost, and full message content.

Install

This installs valiqor plus anthropic>=0.18.0.
Add a single import at the top of your app — all Anthropic calls are automatically traced:
Every messages.create call is now traced with full metadata.

Selective Instrumentation

If you only want Anthropic tracing (not other providers), use the provider-specific function:
Both are equivalent — they enable tracing only for Anthropic.

Async Support

Async Anthropic calls are automatically traced:

Content Block Handling

Anthropic responses use content blocks. Valiqor automatically extracts text from both string content and structured content block lists:

What Gets Captured

Each traced Anthropic call records:

With Workflows

Combine with trace_workflow to group multiple Anthropic calls into a single trace:
Both calls appear as child spans under the claude-assistant trace.

Disabling

To disable Anthropic tracing:

Limitations

  • Streaming is not currently instrumented — streamed responses are not captured in traces
  • Tool use — Anthropic tool use responses are not explicitly parsed (tool_use content blocks are captured as raw content)

Next Steps

Tracing Guide

Learn about traces, spans, workflows, and exporters.

Failure Analysis

Run failure analysis on your traced Anthropic calls.