Skip to main content
This module provides instrumentation for the Anthropic Go SDK (anthropics/anthropic-sdk-go) using the openinference-instrumentation-anthropic Go package, exporting OpenInference LLM spans to Phoenix. Requires anthropic-sdk-go v1.43+ (which introduced option.Middleware).

Install

Setup

Configure an OTLP/HTTP exporter pointed at Phoenix. Create tracing.go:

Run Anthropic

Pass anthropicotel.Middleware to the client via option.WithMiddleware. Session and user identifiers are stored on the Go context and applied to every LLM span descended from it.
To redact sensitive data, set OPENINFERENCE_HIDE_INPUTS=true or OPENINFERENCE_HIDE_OUTPUTS=true. See the openinference Go README for the full env-var matrix and the in-code WithTraceConfig override.

Observe

After setting up instrumentation and running your Anthropic application, traces will appear in the Phoenix UI for visualization and analysis.

Resources