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.
- Auto-instrumentation
- Manual instrumentation
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 tracesConverseCommand, ConverseStreamCommand, InvokeModelCommand, and InvokeModelWithResponseStreamCommand calls sent through the client.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.MetricsTracing 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.
- Confirm the model is available in your target AWS region. See Supported foundation models in Amazon Bedrock.
- Confirm your AWS account is allowed to invoke that model. See Manage access to Amazon Bedrock foundation models.
- 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:
- Go to Settings > AI providers.
- Add a new organization or project provider and choose Bedrock.
-
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
AssumeRolewith 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. -
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.
- Expand Role creation instructions. The UI shows the trusted AWS account ID, external ID, IAM permissions policy, and trust policy for your organization.
- In your AWS account, create an IAM role using those values.
- Copy the role ARN from AWS.
-
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. -
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.
- Optional: Set API base if you need a custom Bedrock endpoint.
- 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.
- 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:
- Copy the exact Bedrock model ID from AWS.
- Add it under Models in the Bedrock provider settings.
- Choose the matching Braintrust format.
Common model IDs
Common model IDs
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 IDus.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.
How to find model IDs
How to find model IDs
Use the AWS page that matches the kind of ID you need:
- Base model IDs such as
anthropic.claude-sonnet-4-5-20250929-v1:0oramazon.nova-pro-v1:0: Check Supported foundation models in Amazon Bedrock and copy the value from the Model ID column. - Cross-Region inference profile IDs such as
us.*,eu.*,apac.*, orglobal.*: Check Supported Regions and models for inference profiles.
Format guide
Format guide
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.