AWS Bedrock Target adapter for Waken — routes waken Events to any Bedrock-hosted model via the Converse API.
Project description
waken-bedrock
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waken_bedrock-0.1.0.tar.gz.
File metadata
- Download URL: waken_bedrock-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d0472107686e3e9f7ef7dd91ab4b28c7303c92707b6440f198c2643a6d1ee6c
|
|
| MD5 |
f7dd31bfc7d57f6ad4a2268340ff63cf
|
|
| BLAKE2b-256 |
239aa00b131e78e1514b31a3f38cfe024b20827c2069c12e311dc9c1f5a28009
|
Provenance
The following attestation bundles were made for waken_bedrock-0.1.0.tar.gz:
Publisher:
publish.yml on WakenHQ/waken-bedrock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
waken_bedrock-0.1.0.tar.gz -
Subject digest:
4d0472107686e3e9f7ef7dd91ab4b28c7303c92707b6440f198c2643a6d1ee6c - Sigstore transparency entry: 2082017782
- Sigstore integration time:
-
Permalink:
WakenHQ/waken-bedrock@5853b98bdb95eee755f9652956916363242b4df3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/WakenHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5853b98bdb95eee755f9652956916363242b4df3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file waken_bedrock-0.1.0-py3-none-any.whl.
File metadata
- Download URL: waken_bedrock-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97f1f3af29fc564d9ed9b31e27db31748e994ebbf53c7f472e00efcd81147a00
|
|
| MD5 |
e5bc50178f15022fc0f2bf809c775b0f
|
|
| BLAKE2b-256 |
392c7d955df53737d83df8a8a3ba318e636578c5296a83a309316412ebc00ba8
|
Provenance
The following attestation bundles were made for waken_bedrock-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on WakenHQ/waken-bedrock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
waken_bedrock-0.1.0-py3-none-any.whl -
Subject digest:
97f1f3af29fc564d9ed9b31e27db31748e994ebbf53c7f472e00efcd81147a00 - Sigstore transparency entry: 2082017854
- Sigstore integration time:
-
Permalink:
WakenHQ/waken-bedrock@5853b98bdb95eee755f9652956916363242b4df3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/WakenHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5853b98bdb95eee755f9652956916363242b4df3 -
Trigger Event:
push
-
Statement type: