A LangGraph ReAct agent backed by Amazon Bedrock Converse via boto3 (langchain-aws ChatBedrockConverse). Reference implementation for routing Bedrock agent traffic through the Akto proxy with minimal client changes.
→ docs/CLIENT-INTEGRATION.md — client guide (URL + env config only):
- Paste the
BEDROCK_ENDPOINT_URLAkto gives you - Copy
bedrock_config.py, usecreate_bedrock_llm() - Optional:
BEDROCK_STREAM=truefor streaming
Quick start:
BEDROCK_ENDPOINT_URL=https://akto-proxy?openai_url=https://bedrock-runtime.<region>.amazonaws.comfrom bedrock_config import create_bedrock_llm
llm = create_bedrock_llm()- LangGraph — ReAct agent loop (
create_react_agent) - langchain-aws —
ChatBedrockConverse(boto3bedrock-runtimeclient) - boto3 / botocore — SigV4 via IAM profile; optional Bearer via
AWS_BEARER_TOKEN_BEDROCK - FastAPI — optional HTTP API
See docs/CLIENT-INTEGRATION.md for the full client guide. Summary:
- Set
BEDROCK_ENDPOINT_URL(boto3endpoint_url) - Use
create_bedrock_llm()so SigV4 is computed for upstream Bedrock, then routed through Akto
./scripts/start-server.sh proxy
./scripts/run.sh proxyUnset BEDROCK_ENDPOINT_URL for direct Bedrock.
- Python 3.10+
- IAM profile with Bedrock access (
AWS_PROFILE, e.g.cloud-agent-bedrock)
See docs/AWS-BOOTSTRAP.md for full steps.
aws configure # admin keys for your AWS account
python3 -m venv .venv && source .venv/bin/activate
pip3 install -r requirements.txt
./scripts/bootstrap-account.sh # creates IAM user/role/policy + tests Bedrock./scripts/setup-aws.shThe setup script walks through aws configure, optional assume-role profile, Bedrock smoke test, and writes .env.
| Command | What it does |
|---|---|
./scripts/setup-aws.sh |
Full interactive setup |
./scripts/setup-aws.sh configure |
aws configure only |
./scripts/setup-aws.sh sso |
aws configure sso (IAM Identity Center) |
./scripts/setup-aws.sh role |
Add assume-role profile to ~/.aws/config |
./scripts/setup-aws.sh verify |
sts get-caller-identity + Bedrock Converse test |
./scripts/setup-aws.sh test |
Bedrock Converse smoke test (direct) |
./scripts/setup-aws.sh test-proxy |
Bedrock Converse smoke test via Akto proxy |
./scripts/setup-aws.sh policy |
Print IAM policy reference |
If you have admin creds and need to create the Bedrock role:
./scripts/create-bedrock-role.shcp .env.example .env
aws configure # stores keys in ~/.aws/credentialsPOST /model/{model_id}/invokeuvicorn server:app --port 8000
./scripts/test-client-invoke.sh "What is the weather in Mumbai?"Simple curl body — SDK handles Bedrock auth headers:
{"message": "What is the weather in Mumbai?"}python3 agent.py # CLI
./scripts/start-server.sh # HTTP server (see docs/CLIENT-INTEGRATION.md)
./scripts/test-curl.sh chat # smoke test against running serveramazon.nova-micro-v1:0 (override with BEDROCK_MODEL_ID for your region / inference profile).
| Mode | Result |
|---|---|
Direct bedrock-runtime.<region>.amazonaws.com |
Works (SigV4) |
| Akto proxy sign-then-relay | SigV4 signed for upstream; requires Akto pass-through forward |
If headers look "encoded" in Akto dashboard but calls return 200, that's ingestion JSON serialization — not boto3 mutating headers on the wire.