Skip to content

[bot] Anthropic Bedrock SDK (@anthropic-ai/bedrock-sdk) not covered by auto-instrumentation #2047

@braintrust-bot

Description

@braintrust-bot

Summary

Anthropic publishes a dedicated TypeScript SDK for Claude on AWS Bedrock: @anthropic-ai/bedrock-sdk. It provides the same messages.create() API as @anthropic-ai/sdk but authenticates via AWS credentials and routes through the Bedrock runtime. This repository's auto-instrumentation exclusively targets @anthropic-ai/sdk module file paths; @anthropic-ai/bedrock-sdk ships under a different module path and is not patched by any existing instrumentation config. Users who use Claude on Bedrock via this SDK get no Braintrust spans from auto-instrumentation.

What instrumentation is missing

The @anthropic-ai/bedrock-sdk package exposes the same execution surface as @anthropic-ai/sdk:

SDK Method Description
client.messages.create({ model, messages, ... }) Synchronous and streaming chat completions via Bedrock
client.messages.stream(...) Streaming messages helper
client.beta.messages.create(...) Extended-thinking and other beta APIs

Users instantiate it as:

import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";

const client = new AnthropicBedrock({ awsRegion: "us-west-2" });
const message = await client.messages.create({
  model: "global.anthropic.claude-opus-4-6-v1",
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello" }],
});

Auto-instrumentation gap:

The AST-transformation configs in js/src/auto-instrumentations/configs/anthropic.ts target @anthropic-ai/sdk at specific module file paths (resources/messages.mjs, resources/messages/messages.mjs, etc.). The @anthropic-ai/bedrock-sdk package has different internal module paths and is a separate npm package. None of the existing configs match @anthropic-ai/bedrock-sdk, so load-time or build-time AST patching does not apply to it.

Manual wrapper gap:

wrapAnthropic() duck-types on anthropic.messages.create, so it likely works with AnthropicBedrock instances. However, this is undocumented and untested in the repo, and auto-instrumentation (the zero-config path) is completely absent.

No coverage in the auto-instrumentation layer:

  • No entry in js/src/auto-instrumentations/configs/anthropic.ts for @anthropic-ai/bedrock-sdk
  • No module path targeting for @anthropic-ai/bedrock-sdk in any instrumentation config
  • No e2e test scenarios for Bedrock SDK

A grep for bedrock-sdk across the entire repo returns zero matches.

Relationship to existing issue #1741

Issue #1741 covers @aws-sdk/client-bedrock-runtime — the low-level AWS SDK that exposes ConverseCommand and InvokeModelCommand. That is a different package with a different API shape (AWS-specific message format). @anthropic-ai/bedrock-sdk uses Anthropic's native Messages API format over Bedrock and is installed separately via npm install @anthropic-ai/bedrock-sdk.

Braintrust docs status

unclear — The Braintrust docs at https://www.braintrust.dev/docs/integrations/ai-providers/anthropic reference @anthropic-ai/sdk and the wrapAnthropic() wrapper, but do not mention @anthropic-ai/bedrock-sdk. The Anthropic Bedrock guide at https://platform.claude.com/docs/en/api/claude-on-amazon-bedrock shows @anthropic-ai/bedrock-sdk as the official TypeScript SDK for Claude on Bedrock.

Upstream references

Local files inspected

  • js/src/auto-instrumentations/configs/anthropic.ts — targets @anthropic-ai/sdk only, no entry for @anthropic-ai/bedrock-sdk
  • js/src/instrumentation/plugins/anthropic-channels.ts — channels defined for @anthropic-ai/sdk APIs
  • js/src/instrumentation/plugins/anthropic-plugin.ts — plugin handles @anthropic-ai/sdk events only
  • js/src/wrappers/anthropic.tswrapAnthropic() duck-types on messages.create; likely works with Bedrock client but untested and undocumented
  • js/src/vendor-sdk-types/anthropic.ts — no AnthropicBedrock type definitions
  • Full repo grep for bedrock-sdk — zero matches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions