AWS CDK construct library for deploying Bedrock AgentCore Runtime
Project description
Simple AgentCore Runtime Patterns
An AWS CDK construct library for deploying AWS Bedrock AgentCore runtimes.
This library helps you deploy containerized AI agents to AWS Bedrock AgentCore using AWS CDK. It handles Docker image building, ECR deployment, IAM roles, and runtime configuration automatically.
Requirements
- Node.js 22 or later
- Docker or Finch (for building container images)
- AWS CDK v2.221.0 or later
Quick Start
AWS CDK(TypeScript)
Install
npm install simple-agentcore-runtime-patterns
Example
import {
SimpleAgentCoreRuntime,
HttpApiAgentCoreRuntimePattern,
WebsocketAgentCoreRuntimePattern,
LambdaUrlStreamingAgentCoreRuntimePattern,
} from "simple-agentcore-runtime-patterns";
// Create AgentCore Runtime
const acr = new SimpleAgentCoreRuntime(stack, "MyAgent", {
agentName: "my_bedrock_agent", // Required: snake_case, max 40 chars
agentSrcPath: "./my-agent-code", // Required: path to your agent code
});
// [Pattern 1] HTTP API
const httpApi = new HttpApiAgentCoreRuntimePattern(this, "HttpApiPattern", {
runtimes: [{ runtimeArn: acr.runtimeArn, routePath: "/sync" }],
authApiKey: "prototype",
});
// [Pattern 2] WebSocket for streaming response
const websocket = new WebsocketAgentCoreRuntimePattern(
this,
"WebsocketPattern",
{
runtimeArn: acr.runtimeArn,
authApiKey: "prototype",
}
);
// [Pattern 3] Lambda URL for streaming response
const lambdaUrl = new LambdaUrlStreamingAgentCoreRuntimePattern(
this,
"LambdaUrlPattern",
{
runtimeArn: acr.runtimeArn,
}
);
AWS CDK(Python)
Install
pip install simple-agentcore-runtime-patterns
Example
from simple_agentcore_runtime_patterns import SimpleAgentCoreRuntime
from simple_agentcore_runtime_patterns import HttpApiAgentCoreRuntimePattern, WebsocketAgentCoreRuntimePattern, LambdaUrlStreamingAgentCoreRuntimePattern
# Create AgentCore Runtime
acr = SimpleAgentCoreRuntime(stack, "MyAgent",
agent_name="my_bedrock_agent", # Required: snake_case, max 40 chars
agent_src_path="./my-agent-code", # Required: path to your agent code
)
# [Pattern 1] HTTP API
http_api = HttpApiAgentCoreRuntimePattern(self, "HttpApiPattern", runtimes=[{"runtimeArn": acr.runtime_arn, "routePath": "/sync"}], auth_api_key="prototype")
# [Pattern 2] WebSocket for streaming response
websocket = WebsocketAgentCoreRuntimePattern(self, "WebsocketPattern", runtime_arn=acr.runtime_arn, auth_api_key="prototype")
# [Pattern 3] Lambda URL for streaming response
lambda_url = LambdaUrlStreamingAgentCoreRuntimePattern(self, "LambdaUrlPattern", runtime_arn=acr.runtime_arn)
Architecture
Input Properties Outputs
───────────────── ───────
• agentName • runtimeId
• agentSrcPath ┌────────────────────────────────────────────┐ • runtimeVersion
───▶│ SimpleAgentCoreRuntime Construct │────▶• runtimeArn
│ │ • runtimeExecutionRole
│ ┌──────────────────────────────────────┐ │
│ │ IAM Role │ │
│ │ (AgentCoreRuntimeExecutionRole) │ │
│ │ • ECR access │ │
│ │ • CloudWatch Logs │ │
│ │ • Bedrock model invocation │ │
│ └──────────────────┬───────────────────┘ │
│ │ │
│ ┌──────────────────▼───────────────────┐ │
Docker Image ────────┼─▶│ ECR Repository │ │
(from agentSrcPath) │ │ • Stores container image │ │
│ │ • Tag: latest │ │
│ └──────────────────┬───────────────────┘ │
│ │ │
│ ┌──────────────────▼───────────────────┐ │
│ │ Bedrock AgentCore Runtime │ │
│ │ • Runs your agent container │ │
│ │ • Network: PUBLIC (default) │ │
│ │ • Environment variables │ │
│ └──────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────┘
│
│ checks & creates if needed
▼
┌────────────────────────────────────────────┐
│ Service-Linked Roles (Outside Construct) │
│ • Network SLR │
│ • Runtime Identity SLR │
└────────────────────────────────────────────┘
Documentation
- API Documentation - Complete API reference
- AGENTS.md - Guide for AI coding assistants
License
MIT-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 simple_agentcore_runtime_patterns-0.0.1.tar.gz.
File metadata
- Download URL: simple_agentcore_runtime_patterns-0.0.1.tar.gz
- Upload date:
- Size: 75.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce72c1a7daddf2134b5f902dd2adbff0e5207aeaaedbd0df9f7922eb31543ddd
|
|
| MD5 |
cfaed7d1791b692fa7c54bd4e26b0acf
|
|
| BLAKE2b-256 |
92d4b14047cec515a46e2c1bae6f1eb9f6206ea33fd4ca659ce41b37bcfd45e4
|
File details
Details for the file simple_agentcore_runtime_patterns-0.0.1-py3-none-any.whl.
File metadata
- Download URL: simple_agentcore_runtime_patterns-0.0.1-py3-none-any.whl
- Upload date:
- Size: 74.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8589982350883c041d179d38423e370d9f3e8e0e350e092102eca20cc8aac045
|
|
| MD5 |
6b058ab6fafeb34c0169824160b11c43
|
|
| BLAKE2b-256 |
e048ec0ba90e9ee4b47a65dcef241ffc5c52a8395f6d3078a3db16f1c1e4595e
|