Metadata-Version: 2.4
Name: substrai-cdk-bedrock-agent
Version: 0.1.0
Summary: AWS CDK construct for deploying production-ready Bedrock AI agents with Lambda, DynamoDB, and OpenSearch
Author-email: Gaurav Kumar Sinha <gaurav@substrai.dev>
License: MIT
Project-URL: Homepage, https://substrai.dev
Project-URL: Repository, https://github.com/substrai/cdk-bedrock-agent
Project-URL: Issues, https://github.com/substrai/cdk-bedrock-agent/issues
Keywords: aws,cdk,bedrock,agent,lambda,dynamodb,opensearch,rag,genai,infrastructure
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: AWS CDK
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: aws-cdk-lib>=2.100.0
Requires-Dist: constructs>=10.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: aws-cdk-lib>=2.100.0; extra == "dev"
Requires-Dist: constructs>=10.0.0; extra == "dev"

# substrai-cdk-bedrock-agent

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

## Installation

```bash
pip install substrai-cdk-bedrock-agent
```

## Usage

```python
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
