whiteroom-bedrock
Client-side half of WhiteRoom's Bedrock adapter (server side lives in
apps/engine/src/bedrock/).
An unmodified AWS SDK has no way to prove its identity to WhiteRoom the way
ANTHROPIC_BASE_URL/OPENAI_BASE_URL callers do with a bearer key — every
Bedrock call is SigV4-signed by the caller's own credentials, and WhiteRoom
discards that signature (it re-signs outbound with its own assumed-role
credentials). Proving who called instead happens once, out of band, by
replaying a signed sts:GetCallerIdentity probe to WhiteRoom's /attest
endpoint. This package does that handshake and attaches the resulting
session token to every subsequent call, so the rest of your agent code never
has to know WhiteRoom is in the loop.
Install
pip install -e sdks/bedrock-python
Test
pip install -e "sdks/bedrock-python[test]"
pytest sdks/bedrock-python/tests
No network access or AWS credentials needed — everything's mocked at the
botocore/urllib layer. tests/test_attest.py is the one worth reading
closely: it directly checks the signed probe has host,
x-whiteroom-server-id and x-amz-date in SignedHeaders, which is
exactly what the server (attest.ts) requires — a change here that broke
that would otherwise only surface as every real attestation failing
against a live proxy.
Use
import boto3
import whiteroom_bedrock
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url="https://proxy.whiteroom.tech",
)
whiteroom_bedrock.install(
client,
proxy_base_url="https://proxy.whiteroom.tech",
server_id="proxy.whiteroom.tech", # must match the proxy's configured serverId
region="us-east-1",
)
# Everything from here down is a normal bedrock-runtime client.
response = client.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[{"role": "user", "content": [{"text": "hi"}]}],
)
What install() actually does
- On first call (and again whenever the cached session goes stale), signs a
throwaway
GetCallerIdentityrequest with whatever credentials this process already resolves for AWS (env vars, shared config, an instance or task role — the standard botocore chain) and POSTs it to/attest. - Attaches the session token WhiteRoom hands back as
x-whiteroom-sessionon everyinvoke_model/conversecall, via abefore-sendhook — after signing, so it never interferes with the client's own (ultimately discarded) signature. - If the proxy ever answers 403 — the session expired, or WhiteRoom restarted and lost its in-memory session table — invalidates the cached token and forces exactly one retry, so callers don't see a transient session death as a failure.
Not handled here
- Streaming.
invoke_model_with_response_streamandconverse_streamreach the proxy the same as any other call, but the server actively refuses to proxy streaming responses today (seeroutes.ts) — you'll get aValidationExceptionback, not a stream. - Credential source mismatch.
regionand credentials are resolved from the default botocore chain unless you passregion=/botocore_session=explicitly. If the client you're hooking was built with credentials that don't come from that chain (e.g. explicitaws_access_key_id=onboto3.client(...)), attest with the same credentials by passing abotocore.session.Sessionthat resolves them.
Metadata
Release files for whiteroom-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)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| whiteroom_bedrock-0.1.0.tar.gz | 9.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| whiteroom_bedrock-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / whiteroom_bedrock-0.1.0.tar.gz
| Download URL | whiteroom_bedrock-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e10da89fdc19cd2e71187790d9c719d6c3833eb47cfbdb9cd2d838add69bdfa4
|
|
BLAKE2b-256 checksum How to use checksums |
f3c386df5ba4dddf67bef3291785bc0918edd8779bf178faebdae65a9b7f4691
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / whiteroom_bedrock-0.1.0-py3-none-any.whl
| Download URL | whiteroom_bedrock-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51f12a37c20bed6f0147b358996f15ede9da0bb4358b218390402eeaf6297d43
|
|
BLAKE2b-256 checksum How to use checksums |
e3b82d6705b9e802cc780432bdb699d4ffa18b12b0a1a93a036f0aa02344051e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for whiteroom-bedrock 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.