Skip to main content

AWS CDK construct for deploying production-ready Bedrock AI agents with Lambda, DynamoDB, and OpenSearch

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

substrai_cdk_bedrock_agent-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

substrai_cdk_bedrock_agent-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file substrai_cdk_bedrock_agent-0.1.0.tar.gz.

File metadata

File hashes

Hashes for substrai_cdk_bedrock_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e969b0f229c65537c6de450294ce4fa81da40f1ad03053c0ad5f1fb31e942356
MD5 95925d86677282daed0e439638c97f6d
BLAKE2b-256 21118608297752c329f71044ebac0ee0a55b917fc552fb2c561c2b4759790af1

See more details on using hashes here.

File details

Details for the file substrai_cdk_bedrock_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for substrai_cdk_bedrock_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b25748d312dc20e0c00a6d2bf4111c5a972574509442b87f5c4fefc86307baee
MD5 dd520d72b3943fb6489c1d8447484360
BLAKE2b-256 9e54cd6fd23b96eeeb64505447108d0e65c3e5f988385979b7569ee0d0ac220c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page