Quality gates and retry loops for Amazon Bedrock Converse.
Project description
bedrockflow
CI for Bedrock outputs — composable gates, correct retries, offline fixtures.
MIT License. See LICENSE.
Install
# Offline eval panels and fixture CI (no AWS credentials)
pip install bedrockflow
# Live Bedrock Converse retry loops
pip install "bedrockflow[aws]"
Python 3.11+.
Quick start (offline)
Works with the base install — no boto3 required:
from bedrockflow import Context, markdown_sections, run_panel
from bedrockflow.evals.offline import eval_text
from bedrockflow.evals.verdict import EvalVerdict
evals = markdown_sections("## Summary", "## Risks", max_words=300)
verdict, reasons = eval_text("## Summary\n...\n\n## Risks\n...", evals)
assert verdict is EvalVerdict.OK
bedrockflow eval tests/fixtures/simple/good.md \
--panel bedrockflow.examples.simple_evals:SIMPLE_EVALS
--panelloads arbitrary Python (module.path:ATTRIBUTE). Only point it at modules you trust.
Quick start (Bedrock)
Requires pip install "bedrockflow[aws]" and configured AWS credentials:
from bedrockflow import Context, converse_with_evals, markdown_sections
out = converse_with_evals(
"us.anthropic.claude-sonnet-4-6",
initial="Summarize tail risk in vol selling.",
evals=markdown_sections("## Summary", "## Risks", max_words=300),
ctx=Context(),
max_tokens=512,
)
print(out.trace) # per-turn named eval failures + tokens
See docs/COOKBOOK.md for JSON gates, tables, model compare, prompt caching.
CLI
# Offline fixture CI (no AWS)
bedrockflow eval tests/fixtures/simple/ --panel bedrockflow.examples.simple_evals:SIMPLE_EVALS
bedrockflow eval draft.md --only structure --json
# Live Bedrock (requires [aws])
bedrockflow run --example simple
bedrockflow run --example trade_memo --record drafts/latest.md --trace runs/latest.json
bedrockflow run --example trade_memo --cache-initial
# Model A/B on the same panel
bedrockflow compare us.anthropic.claude-sonnet-4-6 us.amazon.nova-pro-v1:0 --example simple
# Security scanning
bedrockflow trivy
bedrockflow trivy --docker
bedrockflow bandit
Demo eval panels live under bedrockflow.examples (trade memo, simple summary). They ship for reference but are not required for library use.
Starter panels
from bedrockflow import markdown_sections, json_object, no_preamble, csv_table
Progress output (opt-in)
Retry progress bars and last-draft stderr dumps are off by default:
export BEDROCKFLOW_VISIBLE_TURNS=1
export BEDROCKFLOW_PRINT_LAST_DRAFT=1
Trace artifacts
bedrockflow run --trace runs/latest.json writes turns, named eval steps, token totals (including cache read/write).
CI
Fixture eval runs on every PR — see .github/workflows/ci.yml.
uv run pytest
uv run black --check .
PyPI
See docs/LAUNCH.md and CHANGELOG.md.
Releases publish via GitHub Actions on version tags (trusted publishing — no tokens in secrets):
git tag -a v0.3.0 -m "Release v0.3.0"
git push origin v0.3.0
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 bedrockflow-0.3.0.tar.gz.
File metadata
- Download URL: bedrockflow-0.3.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13c630b92c455c94190978a2aa1fb16c694650ad8d368d923be4a39dbc1e7b69
|
|
| MD5 |
59d648c77f265f3eb202364b77b6f609
|
|
| BLAKE2b-256 |
5c1f45e5aa6cf4a6371eb6ffd9466eefdd957869ff6aa2ef88346e7deba1f2c1
|
File details
Details for the file bedrockflow-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bedrockflow-0.3.0-py3-none-any.whl
- Upload date:
- Size: 35.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db325deb8239362365b7e1e11dc150fe3d4caa0213a14d1be036dafa063203e0
|
|
| MD5 |
309771d6c855bbb78a107215b5eb1a84
|
|
| BLAKE2b-256 |
4e62a20f001322e5ba3a3ae6540a5e5497caf48c1d0ea854fd1bc43fc3ca08ba
|