Skip to main content

Integration overview

Use this integration when your application calls Anthropic’s @anthropic-ai/sdk TypeScript package directly. Beacon Observe uses OpenLLMetry’s Anthropic instrumentation so Anthropic model calls flow through the same exporter and Beacon-compatible attribute path as the rest of your agent telemetry.

Overview

Initialize Beacon Observe before creating the Anthropic client when possible. The instrumentation captures supported Anthropic SDK spans without changing the way you call anthropic.messages.create(). Using Claude Agent SDK instead of the direct provider SDK? See Claude Agent SDK.

What Beacon captures

  • Anthropic model calls emitted by the OpenLLMetry Anthropic instrumentation.
  • OpenTelemetry resource attributes such as service name, SDK version, beacon.origin=cloud, and export mode.
  • Beacon compatibility hints where supported by the SDK and instrumentation path.
  • Errors recorded on failed spans.

Prerequisites

  • Node.js 20 or newer.
  • @asymptote/sdk installed.
  • @anthropic-ai/sdk installed.
  • ASYMPTOTE_API_KEY set for Beacon Managed hosted Observe, or OTEL_EXPORTER_OTLP_ENDPOINT set for customer-managed OTLP export. To get a Beacon Managed API key, reach out for a demo.
Install the SDK and Anthropic client
Set environment variables:
Set Beacon Managed and Anthropic environment variables

Getting started

Initialize Observe before creating the Anthropic client when possible.
Trace Anthropic messages.create
All supported Anthropic SDK calls are now traced through the configured Beacon exporter.

Already-loaded clients

If your application imports or creates the Anthropic client before initialization, pass the module to instrumentModules or patch it after initialization.
Instrument an already-loaded Anthropic module

Existing OpenTelemetry providers

If your application already owns OpenTelemetry setup, register only Beacon’s Anthropic instrumentation with your existing provider.
Register Anthropic instrumentation on an existing provider

Troubleshooting

  • Confirm ASYMPTOTE_API_KEY or OTEL_EXPORTER_OTLP_ENDPOINT is set in the same process that runs the SDK.
  • Initialize Observe before constructing the Anthropic client when possible.
  • If the Anthropic module is imported before initialization, pass it through instrumentModules or Observe.patch().
  • Call Observe.flush() before short-lived scripts or jobs exit.

What’s next

Claude Agent SDK

Wrap Claude Agent SDK query functions with Beacon-compatible prompt spans.

Instrumentation

Review initialization, module patching, and existing OpenTelemetry provider setup.