substrai-cdk-bedrock-agent
AWS CDK construct for deploying production-ready Bedrock AI agents with Lambda, DynamoDB, and OpenSearch.
Installation
pip install substrai-cdk-bedrock-agent
Usage
from aws_cdk import App, Stack
from substrai_cdk_bedrock_agent import BedrockAgentConstruct, BedrockAgentProps
app = App()
stack = Stack(app, "AgentStack")
agent = BedrockAgentConstruct(stack, "MyAgent", props=BedrockAgentProps(
agent_name="my-assistant",
model_id="anthropic.claude-3-5-sonnet-20241022-v2:0",
lambda_code_path="./agent_lambda",
lambda_memory_mb=1024,
session_ttl_days=14,
))
# Access created resources
print(agent.agent_function.function_arn)
print(agent.session_table.table_name)
What Gets Deployed
- Lambda Function — Agent logic with configurable runtime, memory, and timeout
- DynamoDB Table — Session state with TTL auto-expiry and point-in-time recovery
- IAM Role — Least-privilege permissions for Bedrock and DynamoDB
- CloudWatch Log Group — 2-week retention with structured logging
- CloudWatch Alarms — Error rate and P99 latency monitoring
- X-Ray Tracing — Active tracing enabled by default
Configuration
| Property | Default | Description |
|---|---|---|
agent_name |
(required) | Name for all resources |
model_id |
claude-3-5-sonnet |
Bedrock model identifier |
lambda_memory_mb |
512 | Lambda memory allocation |
lambda_timeout_seconds |
300 | Lambda timeout |
session_ttl_days |
7 | DynamoDB session expiry |
alarm_error_threshold |
5.0 | Error rate alarm (%) |
alarm_latency_threshold_ms |
10000 | P99 latency alarm (ms) |
License
MIT
Release files for substrai-cdk-bedrock-agent 0.2.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 | |
|---|---|---|---|
| substrai_cdk_bedrock_agent-0.2.0.tar.gz | 27.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| substrai_cdk_bedrock_agent-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.3 kB
Release files / substrai_cdk_bedrock_agent-0.2.0.tar.gz
| Download URL | substrai_cdk_bedrock_agent-0.2.0.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57516e9209b8869167dd26c3d87954b434803af835929aaae6ecdbb2263e0cd0
|
|
BLAKE2b-256 checksum How to use checksums |
635248db65bac8611f892706958e2a84a403473adbd191413182a5e18803811c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / substrai_cdk_bedrock_agent-0.2.0-py3-none-any.whl
| Download URL | substrai_cdk_bedrock_agent-0.2.0-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b783ca7c4d57de7e07f6eed045f86b70b457942613f146834297600abf197bd
|
|
BLAKE2b-256 checksum How to use checksums |
bddcfbfcccacfdb2e975bee3d9d3b4fabcb4139fc0fd901f03602b8f468df75a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|