Skip to main content
Braintrust integrates with Amazon Bedrock so you can call Amazon’s foundation models from the Braintrust playground, API, and SDKs. Braintrust also traces AWS Bedrock SDK calls from your application.

Tracing

The Braintrust TypeScript SDK traces the AWS Bedrock Runtime client (@aws-sdk/client-bedrock-runtime) automatically with the braintrust/hook.mjs import hook, or manually with wrapBedrockRuntime. Both paths produce the same spans.
The Bedrock Runtime TypeScript integration requires Node.js v20 or later.

Setup

Install Braintrust alongside the AWS Bedrock Runtime SDK, then configure your Braintrust API key and AWS credentials.
1

Install packages

2

Set environment variables

AWS credentials are resolved via the standard credential chain. Set AWS_REGION or AWS_DEFAULT_REGION. If you authenticate with an Amazon Bedrock API key, set AWS_BEARER_TOKEN_BEDROCK.
.env

Trace your application

Run your app with Braintrust’s import hook to patch Bedrock Runtime calls at startup. The hook traces ConverseCommand, ConverseStreamCommand, InvokeModelCommand, and InvokeModelWithResponseStreamCommand calls sent through the client.
Run with the import hook:
The auto-instrumentation example uses plain JavaScript so node --import can run the file directly. The Braintrust APIs work the same in TypeScript projects — compile your TypeScript to JavaScript, then run the compiled file with the import hook.
If you’re using a bundler, see Trace LLM calls for plugin and loader setup.

Trace Anthropic’s Bedrock SDK

If you use Anthropic’s @anthropic-ai/bedrock-sdk instead of the native AWS Runtime client, use the Anthropic integration. Braintrust records those calls as anthropic.messages.create spans with provider: "anthropic" metadata. See Using Anthropic through AWS Bedrock.

What Braintrust traces

Braintrust emits LLM spans for these Bedrock Runtime commands:Each span includes provider: "aws-bedrock", the Bedrock model ID in metadata.model, command and operation metadata, request input, response output, and model parameters such as maxTokens, temperature, topP, and stopSequences when present.Metrics

Tracing resources

Connect Bedrock to Braintrust

To use Bedrock models in the Braintrust playground, API, and proxy, connect Bedrock as a provider in your organization or project AI providers.
1

Confirm model access in AWS

Before configuring Braintrust, make sure you can access the Bedrock models you want to use in AWS.
  1. Confirm the model is available in your target AWS region. See Supported foundation models in Amazon Bedrock.
  2. Confirm your AWS account is allowed to invoke that model. See Manage access to Amazon Bedrock foundation models.
  3. If you plan to use Bedrock API keys, confirm your region supports them. See Supported Regions and SDKs for Amazon Bedrock API keys.
2

Configure the integration

Open the Bedrock provider settings, choose how Braintrust should authenticate to AWS, and pick the region and model registry options:
  1. Go to Settings > AI providers.
  2. Add a new organization or project provider and choose Bedrock.
  3. Choose your authentication method:
    • IAM credentials: Use an AWS access key ID and secret access key.
    • API key: Use an Amazon Bedrock bearer token.
    • Assume role: Use AWS STS AssumeRole with an IAM role in your AWS account, instead of storing long-lived AWS access keys in Braintrust.
    Assume role authentication is only available for Braintrust-hosted organizations. For self-hosted deployments, use IAM credentials or API key instead.
    API keys are stored as one-way cryptographic hashes, never in plaintext.
  4. If you chose Assume role, create the IAM role in your AWS account. Braintrust assumes this role, receives temporary AWS credentials from STS, and uses those credentials to invoke Bedrock.
    1. Expand Role creation instructions. The UI shows the trusted AWS account ID, external ID, IAM permissions policy, and trust policy for your organization.
    2. In your AWS account, create an IAM role using those values.
    3. Copy the role ARN from AWS.
  5. Set Region to the AWS region where Braintrust should send Bedrock requests. Choose a region where your target model is available. If you use a region-specific model ID such as us.anthropic.claude-sonnet-4-5-20250929-v1:0, make sure the selected region is compatible with that model.
  6. Enter credentials:
    • IAM credentials: Fill in Access key, then enter the secret access key in the Secret field. Use Session token if you are using temporary AWS credentials such as STS.
    • API key: Paste your Amazon Bedrock API key into the Secret field.
    • Assume role: Paste the role ARN into Role ARN.
  7. Optional: Set API base if you need a custom Bedrock endpoint.
  8. Many Bedrock models are available in Braintrust by default. To access these, leave Include the default registry of Bedrock models enabled. If the model you want is not supported by default, add it manually in the next step.
  9. Click Save.
3

Add models manually

You only need to do this step if the model you want does not appear in Braintrust’s supported models list. This is common for newly released models, preview access models, or models your account has special access to.When you add a model manually:
  1. Copy the exact Bedrock model ID from AWS.
  2. Add it under Models in the Bedrock provider settings.
  3. Choose the matching Braintrust format.
  • anthropic.claude-sonnet-4-5-20250929-v1:0 - base model ID (provider.model-version:variant)
  • us.anthropic.claude-sonnet-4-5-20250929-v1:0 - cross-region inference profile (region.provider.model-version:variant)
  • amazon.nova-pro-v1:0 - base model ID
  • us.amazon.nova-pro-v1:0 - cross-region inference profile
If AWS offers both a base model ID and a fully versioned variation, prefer the fully versioned model ID.
Use the AWS page that matches the kind of ID you need:
Use the model ID prefix to choose the format:You can also select the OpenAI format for a Bedrock model. Braintrust then routes the model through Bedrock’s OpenAI-compatible Chat Completions endpoint, including streaming responses.
The OpenAI format for Bedrock models requires data plane v2.2.0 or later.

Bedrock provider resources