Skip to main content

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

License

MIT-0

Metadata

Release files for simple-agentcore-runtime-patterns 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-agentcore-runtime-patterns 0.0.1
File Size Uploaded Provenance Actions
simple_agentcore_runtime_patterns-0.0.1.tar.gz 75.7 kB Without provenance Details for simple_agentcore_runtime_patterns-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-agentcore-runtime-patterns 0.0.1
File Interpreter ABI Platform Actions
simple_agentcore_runtime_patterns-0.0.1-py3-none-any.whl Python 3 none any Details for simple_agentcore_runtime_patterns-0.0.1-py3-none-any.whl

Total release size: 149.8 kB

Release files / simple_agentcore_runtime_patterns-0.0.1.tar.gz

Download URL simple_agentcore_runtime_patterns-0.0.1.tar.gz
Size 75.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ce72c1a7daddf2134b5f902dd2adbff0e5207aeaaedbd0df9f7922eb31543ddd
BLAKE2b-256 checksum
How to use checksums
92d4b14047cec515a46e2c1bae6f1eb9f6206ea33fd4ca659ce41b37bcfd45e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.14.0

Release files / simple_agentcore_runtime_patterns-0.0.1-py3-none-any.whl

Download URL simple_agentcore_runtime_patterns-0.0.1-py3-none-any.whl
Size 74.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8589982350883c041d179d38423e370d9f3e8e0e350e092102eca20cc8aac045
BLAKE2b-256 checksum
How to use checksums
e048ec0ba90e9ee4b47a65dcef241ffc5c52a8395f6d3078a3db16f1c1e4595e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.14.0

Security for simple-agentcore-runtime-patterns 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page