Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OpenTelemetry Amazon Bedrock Instrumentation

This package provides OpenTelemetry instrumentation for Amazon Bedrock (via the AWS SDK for Python: boto3, botocore, aioboto3, and aiobotocore), implementing the OpenTelemetry Generative AI semantic conventions.

Supported Operations

  • Synchronous and asynchronous chat via the Converse API (client.converse)

  • Synchronous and asynchronous streaming chat via the ConverseStream API (client.converse_stream)

  • Synchronous and asynchronous model invocation via the InvokeModel API (client.invoke_model)

  • Synchronous and asynchronous streaming model invocation via the InvokeModelWithResponseStream API (client.invoke_model_with_response_stream)

  • Synchronous and asynchronous embeddings via the InvokeModel API (client.invoke_model with embedding models such as Amazon Titan and Cohere)

  • Synchronous and asynchronous remote agent invocation via the Bedrock Agent Runtime API (client.invoke_agent)

  • Synchronous and asynchronous remote inline agent invocation via the Bedrock Agent Runtime API (client.invoke_inline_agent)

  • Synchronous and asynchronous Knowledge Base retrieval via the Bedrock Agent Runtime API (client.retrieve)

  • Synchronous and asynchronous Knowledge Base RetrieveAndGenerate via the Bedrock Agent Runtime API (client.retrieve_and_generate)

  • Synchronous and asynchronous streaming Knowledge Base RetrieveAndGenerateStream via the Bedrock Agent Runtime API (client.retrieve_and_generate_stream)

Installation

pip install opentelemetry-instrumentation-genai-bedrock

Usage

import boto3
from opentelemetry.instrumentation.genai.bedrock import BedrockInstrumentor

# Enable instrumentation
BedrockInstrumentor().instrument()

# Use Bedrock runtime client normally
client = boto3.client("bedrock-runtime", region_name="us-east-1")
response = client.converse(
    modelId="amazon.nova-micro-v1:0",
    messages=[{"role": "user", "content": [{"text": "Hello, Bedrock!"}]}],
)

Configuration

By default, prompts and completions are not captured. To capture message content, set the environment variable OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT to one of NO_CONTENT, SPAN_ONLY, EVENT_ONLY, or SPAN_AND_EVENT:

export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY

Prompts and completions can also be redirected via a completion hook by setting OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK or by passing instrument(completion_hook=...).

References

Metadata

Release files for opentelemetry-instrumentation-genai-bedrock 1.3b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentelemetry-instrumentation-genai-bedrock 1.3b0
File Size Uploaded Provenance Actions
opentelemetry_instrumentation_genai_bedrock-1.3b0.tar.gz 64.1 kB With provenance Details for opentelemetry_instrumentation_genai_bedrock-1.3b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opentelemetry-instrumentation-genai-bedrock 1.3b0
File Interpreter ABI Platform Actions
opentelemetry_instrumentation_genai_bedrock-1.3b0-py3-none-any.whl Python 3 none any Details for opentelemetry_instrumentation_genai_bedrock-1.3b0-py3-none-any.whl

Total release size: 89.7 kB

Release files / opentelemetry_instrumentation_genai_bedrock-1.3b0.tar.gz

Download URL opentelemetry_instrumentation_genai_bedrock-1.3b0.tar.gz
Size 64.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c08fc7bc28aff5a3b5f134b6e509ca93f28621630202eb717a412009590af290
BLAKE2b-256 checksum
How to use checksums
7f25eb0095bf450e7a9ee67042203933c9c6246094683ece2a2a90f7518a1a40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / opentelemetry_instrumentation_genai_bedrock-1.3b0-py3-none-any.whl

Download URL opentelemetry_instrumentation_genai_bedrock-1.3b0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f52414a672f0849521a34d81d7e361070dffca5021da6d824cb1547418bd1109
BLAKE2b-256 checksum
How to use checksums
56eeb0f0b1b8b28933390621c7797c4768a43911994dcd50b67460f7b9bce0bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for opentelemetry-instrumentation-genai-bedrock 1.3b0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opentelemetry_instrumentation_genai_bedrock-1.3b0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page