Skip to main content
Python autoinstrumentation library for AWS Bedrock calls made using boto3 (sync) and aioboto3 (async). This package implements OpenInference tracing for invoke_model, invoke_agent and converse calls made using the bedrock-runtime and bedrock-agent-runtime clients from both boto3 (sync) and aioboto3 (async).
The Converse API was introduced in botocore v1.34.116. Please use v1.34.116 or above to utilize converse.

Supported Models

Find the list of Bedrock-supported models and their IDs here.

Installation

Async (aioboto3) support

To instrument async Bedrock calls made via aioboto3, install aioboto3 in addition to this package:

Quickstart

OpenInference for AWS Bedrock supports both invoke_model and converse. For models that use the Messages API, such as Anthropic Claude 3 and Anthropic Claude 3.5, use the Converse API instead.
In a notebook environment (jupyter, colab, etc.) install dependencies:
For async usage with aioboto3:
Ensure that boto3 is configured with AWS credentials.

Tracing Setup (Phoenix)

The tracing setup below is shared for both sync (boto3) and async (aioboto3) usage.
Next, start a phoenix server and set it as a collector:
Now, all calls to invoke_model and converse are instrumented and can be viewed in the phoenix UI.

Quickstart (boto3)

Using invoke_model

Using converse

Using invoke_agent

Async Quickstart (aioboto3)

More Info