AWS CDK construct library for deploying Bedrock AgentCore Runtime
npm install simple-agentcore-runtime-patternsAn 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.
- Node.js 22 or later
- Docker or Finch (for building container images)
- AWS CDK v2.221.0 or later
#### Install
``bash`
npm install simple-agentcore-runtime-patterns
#### Example
`typescript
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,
}
);
`
#### Install
`bash`
pip install simple-agentcore-runtime-patterns
#### Example
`python
from simple_agentcore_runtime_patterns import SimpleAgentCoreRuntime
from simple_agentcore_runtime_patterns import HttpApiAgentCoreRuntimePattern, WebsocketAgentCoreRuntimePattern, LambdaUrlStreamingAgentCoreRuntimePattern
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 │
└────────────────────────────────────────────┘
``- API Documentation - Complete API reference
- AGENTS.md - Guide for AI coding assistants
MIT-0