Skip to main content

waken-bedrock

CI License: MIT

An AWS Bedrock Target adapter for Waken — "nginx for AI agents." Routes waken Events to any model hosted on Bedrock via the unified converse API and returns the result as a waken Response.

Install

pip install waken-bedrock

Usage

from waken import Runtime
from waken_bedrock import BedrockAdapter

runtime = Runtime()
runtime.target("bedrock", BedrockAdapter(model_id="anthropic.claude-3-5-sonnet-20241022-v2:0"))
runtime.run()

model_id is required — Bedrock hosts models from several providers behind one API, and there's no sensible default across them. This is also the whole point of this adapter: it's one Target that can reach Anthropic, Meta, Amazon, Mistral, or any other model family Bedrock hosts, just by changing the string:

runtime.target("claude-on-bedrock", BedrockAdapter(model_id="anthropic.claude-3-5-sonnet-20241022-v2:0"))
runtime.target("llama-on-bedrock", BedrockAdapter(model_id="meta.llama3-1-70b-instruct-v1:0"))

Credentials

Unlike sibling adapters that read a single named API key (ANTHROPIC_API_KEY, GEMINI_API_KEY), Bedrock has no equivalent — boto3 authenticates through the standard AWS credential chain: env vars (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN), AWS_PROFILE and ~/.aws/credentials, or an EC2/ECS/Lambda instance role, resolved in that order by boto3 itself. BedrockAdapter never reads or touches credentials directly. Pass region_name, profile_name, or explicit credential keywords through **client_kwargs, which go straight to boto3.client("bedrock-runtime", ...):

runtime.target(
    "bedrock",
    BedrockAdapter(
        model_id="anthropic.claude-3-5-sonnet-20241022-v2:0",
        region_name="us-east-1",
        profile_name="my-aws-profile",
    ),
)

Sessions

Bedrock's converse API is stateless per call, the same client-managed- history shape as the Gemini/Mistral/Cohere sibling adapters: there's no server-side session id to resume, so the whole conversation is resent on every turn. BedrockAdapter maps a waken session_id to a growing list of Bedrock-shaped messages and replays it in full each call. An Event with no session_id is a one-off exchange and is never stored.

boto3 is a synchronous SDK — the blocking converse() call runs on the default executor (loop.run_in_executor) rather than blocking the event loop directly.

SDK exceptions (throttling, validation errors, access-denied, ...) propagate unchanged; this adapter doesn't wrap or swallow them.

Development

git clone https://github.com/WakenHQ/waken-bedrock
cd waken-bedrock
pip install -e ".[dev]"
pytest

Tests mock boto3.client entirely — no AWS credentials or network access needed to run the suite.

License

MIT

Metadata

Release files for waken-bedrock 0.1.0

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

Source distribution (sdist)

Source distribution for waken-bedrock 0.1.0
File Size Uploaded
waken_bedrock-0.1.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for waken-bedrock 0.1.0
File Interpreter ABI Platform
waken_bedrock-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / waken_bedrock-0.1.0.tar.gz

Download URL waken_bedrock-0.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4d0472107686e3e9f7ef7dd91ab4b28c7303c92707b6440f198c2643a6d1ee6c
BLAKE2b-256 checksum
How to use checksums
239aa00b131e78e1514b31a3f38cfe024b20827c2069c12e311dc9c1f5a28009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 5, 2026.

Transparency log

Release files / waken_bedrock-0.1.0-py3-none-any.whl

Download URL waken_bedrock-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97f1f3af29fc564d9ed9b31e27db31748e994ebbf53c7f472e00efcd81147a00
BLAKE2b-256 checksum
How to use checksums
392c7d955df53737d83df8a8a3ba318e636578c5296a83a309316412ebc00ba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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