Amazon Bedrock
SideSeat automatically extracts model information, token usage, and costs from Amazon Bedrock API calls.
Prerequisites
Section titled “Prerequisites”- SideSeat running locally (
sideseat) - SDK installed (
pip install sideseat/uv add sideseatornpm install @sideseat/sdk) - AWS credentials configured for Amazon Bedrock
Usage with Boto3
Section titled “Usage with Boto3”from sideseat import SideSeatSideSeat()
import boto3import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
response = bedrock.invoke_model( modelId="anthropic.claude-sonnet-4-5-20250929-v1:0", body=json.dumps({ "anthropic_version": "bedrock-2023-05-31", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello!"}] }))
result = json.loads(response["body"].read())print(result["content"][0]["text"])Usage with Strands
Section titled “Usage with Strands”Strands has native Bedrock support:
from sideseat import SideSeat, FrameworksSideSeat(framework=Frameworks.Strands)
from strands import Agent
agent = Agent()response = agent("Hello!")print(response)Strands uses Amazon Bedrock by default. To specify a model explicitly:
from strands.models import BedrockModel
model = BedrockModel(model_id="anthropic.claude-sonnet-4-5-20250929-v1:0")agent = Agent(model=model)Extracted Attributes
Section titled “Extracted Attributes”| Attribute | Source |
|---|---|
gen_ai.system | bedrock |
gen_ai.request.model | Model ID from request |
gen_ai.response.model | Model ID from response |
gen_ai.usage.input_tokens | Usage metrics |
gen_ai.usage.output_tokens | Usage metrics |
cloud.provider | aws |
cloud.region | AWS region |
Cross-Region Inference
Section titled “Cross-Region Inference”Bedrock cross-region inference is supported:
model = BedrockModel( model_id="anthropic.claude-sonnet-4-5-20250929-v1:0", region_name="us-east-1")The us. prefix indicates cross-region inference.
Streaming
Section titled “Streaming”Streaming responses are captured:
response = bedrock.invoke_model_with_response_stream( modelId="anthropic.claude-sonnet-4-5-20250929-v1:0", body=json.dumps({ "anthropic_version": "bedrock-2023-05-31", "max_tokens": 1024, "messages": [{"role": "user", "content": "Tell me a story"}] }))
for event in response["body"]: chunk = json.loads(event["chunk"]["bytes"]) if chunk["type"] == "content_block_delta": print(chunk["delta"]["text"], end="")Converse API
Section titled “Converse API”The Bedrock Converse API is also supported:
response = bedrock.converse( modelId="anthropic.claude-sonnet-4-5-20250929-v1:0", messages=[{ "role": "user", "content": [{"text": "Hello!"}] }])
print(response["output"]["message"]["content"][0]["text"])Authentication
Section titled “Authentication”Amazon Bedrock uses the standard AWS credential chain:
# Environment variablesexport AWS_ACCESS_KEY_ID=xxxexport AWS_SECRET_ACCESS_KEY=xxxexport AWS_REGION=us-east-1
# Or AWS profileexport AWS_PROFILE=my-profileNext Steps
Section titled “Next Steps”- Strands — full Strands guide
- Python SDK — SDK reference