Skip to main content

respan-instrumentation-aws-bedrock

Respan instrumentation plugin for AWS Bedrock Runtime calls made through boto3.

Installation

pip install respan-ai respan-instrumentation-aws-bedrock boto3

Usage

import json

import boto3
from respan import Respan
from respan_instrumentation_aws_bedrock import AWSBedrockInstrumentor

respan = Respan(instrumentations=[AWSBedrockInstrumentor()])
client = boto3.client("bedrock-runtime", region_name="us-east-1")

response = client.invoke_model(
    modelId="anthropic.claude-3-5-haiku-20241022-v1:0",
    body=json.dumps({
        "anthropic_version": "bedrock-2023-05-31",
        "max_tokens": 256,
        "messages": [{"role": "user", "content": "Say hello."}],
    }),
    contentType="application/json",
    accept="application/json",
)

body = json.loads(response["body"].read())
print(body["content"][0]["text"])
respan.flush()

The instrumentor patches botocore.client.BaseClient._make_api_call and only emits spans for Bedrock Runtime operations. It currently normalizes InvokeModel, InvokeModelWithResponseStream, Converse, and ConverseStream into canonical Respan chat spans.

Metadata

Release files for respan-instrumentation-aws-bedrock 0.1.1

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

Source distribution (sdist)

Source distribution for respan-instrumentation-aws-bedrock 0.1.1
File Size Uploaded
respan_instrumentation_aws_bedrock-0.1.1.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-aws-bedrock 0.1.1
File Interpreter ABI Platform
respan_instrumentation_aws_bedrock-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / respan_instrumentation_aws_bedrock-0.1.1.tar.gz

Download URL respan_instrumentation_aws_bedrock-0.1.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6d8bf62c50eb64ed712b992a116ae78ea20e3a1d756e42985120b1fb61214dd9
BLAKE2b-256 checksum
How to use checksums
30db5b1687cc3845081ade35b380aa9150bae571ee4229fa1ac7148e72e767dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / respan_instrumentation_aws_bedrock-0.1.1-py3-none-any.whl

Download URL respan_instrumentation_aws_bedrock-0.1.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9667433aee45cb9f5a0c07d746b9211035599af49bb3ad77ccadae58aca0922d
BLAKE2b-256 checksum
How to use checksums
c0518ebc10881bec0133dbcc26fe790aa605ca634d230135b1d315fe27e0ab3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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