Skip to content

Commit 20cc260

Browse files
committed
Merge main (VPC network mode #545) into protocol-mode-support
Resolve merge conflicts between protocol mode and VPC network mode features. Both feature sets are preserved: protocol (HTTP/MCP/A2A) and network mode (PUBLIC/VPC with subnets/securityGroups).
2 parents 959404b + a61ebdd commit 20cc260

82 files changed

Lines changed: 6820 additions & 59 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ProtocolTesting/AGENTS.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# AgentCore Project
2+
3+
This project contains configuration and infrastructure for an Amazon Bedrock AgentCore application.
4+
5+
The `agentcore/` directory serves as a declarative model of an AgentCore project along with a concrete implementation
6+
through the `agentcore/cdk/` project which is modeled to take the configs as input. The project uses a **flat resource
7+
model** where agents, memories, and credentials are top-level arrays.
8+
9+
## Mental Model
10+
11+
The project uses a **flat resource model**. Agents, memories, and credentials are independent top-level arrays in
12+
`agentcore.json`. There is no binding or attachment between resources in the schema — each resource is provisioned
13+
independently. To use a memory or credential from an agent, the application code discovers the resource at runtime
14+
(e.g., via environment variables or SDK calls).
15+
16+
## Critical Invariants
17+
18+
1. **Schema-First Authority:** The `.json` files are the absolute source of truth. Do not attempt to modify agent
19+
behavior by editing the generated CDK code in `cdk/`.
20+
2. **Resource Identity:** The `name` field in the schema determines the CloudFormation Logical ID.
21+
- **Renaming** an agent or target will **destroy and recreate** that resource.
22+
- **Modifying** other fields (descriptions, config) will update the resource **in-place**.
23+
3. **1:1 Validation:** The schema maps directly to valid CloudFormation. If your JSON conforms to the types in
24+
`.llm-context/`, it will deploy successfully.
25+
4. **Resource Removal:** To remove all resources, use `agentcore remove all`. To tear down deployed infrastructure, run
26+
`agentcore deploy` after removal — it will detect the empty state and offer a teardown flow.
27+
28+
## Directory Structure
29+
30+
```
31+
myNewProject/
32+
├── AGENTS.md # This file - AI coding assistant context
33+
├── agentcore/ # AgentCore configuration directory
34+
│ ├── agentcore.json # Main project config (AgentCoreProjectSpec)
35+
│ ├── aws-targets.json # Deployment targets
36+
│ ├── .llm-context/ # TypeScript type definitions for AI coding assistants
37+
│ │ ├── README.md # Guide to using the schema files
38+
│ │ ├── agentcore.ts # AgentCoreProjectSpec types
39+
│ │ └── aws-targets.ts # AWS deployment target types
40+
│ └── cdk/ # AWS CDK project for deployment
41+
└── app/ # Application code (if agents were created)
42+
```
43+
44+
## Schema Reference
45+
46+
The `agentcore/.llm-context/` directory contains TypeScript type definitions optimized for AI coding assistants. Each
47+
file maps to a JSON config file and includes validation constraints as comments.
48+
49+
| JSON Config | Schema File | Root Type |
50+
| ---------------------------- | --------------------------------------- | ----------------------- |
51+
| `agentcore/agentcore.json` | `agentcore/.llm-context/agentcore.ts` | `AgentCoreProjectSpec` |
52+
| `agentcore/aws-targets.json` | `agentcore/.llm-context/aws-targets.ts` | `AWSDeploymentTarget[]` |
53+
54+
### Key Types
55+
56+
- **AgentCoreProjectSpec**: Root project configuration with `agents`, `memories`, `credentials` arrays
57+
- **AgentEnvSpec**: Agent configuration (runtime, entrypoint, code location)
58+
- **Memory**: Memory resource with strategies and expiry
59+
- **Credential**: API key credential provider
60+
61+
### Common Enum Values
62+
63+
- **BuildType**: `'CodeZip'` | `'Container'`
64+
- **NetworkMode**: `'PUBLIC'`
65+
- **RuntimeVersion**: `'PYTHON_3_10'` | `'PYTHON_3_11'` | `'PYTHON_3_12'` | `'PYTHON_3_13'`
66+
- **MemoryStrategyType**: `'SEMANTIC'` | `'SUMMARIZATION'` | `'USER_PREFERENCE'`
67+
68+
### Build Types
69+
70+
- **CodeZip**: Python source is packaged as a zip artifact and deployed directly to AgentCore Runtime.
71+
- **Container**: Agent code is built as a Docker container image. Requires a `Dockerfile` in the agent's `codeLocation`
72+
directory. At deploy time, the source is uploaded to S3, built in CodeBuild (ARM64), pushed to a per-agent ECR
73+
repository, and the container URI is provided to the AgentCore Runtime. For local development (`agentcore dev`), the
74+
container is built and run locally with volume-mounted hot-reload.
75+
76+
### Supported Frameworks (for template agents)
77+
78+
- **Strands** - Works with Bedrock, Anthropic, OpenAI, Gemini
79+
- **LangChain_LangGraph** - Works with Bedrock, Anthropic, OpenAI, Gemini
80+
- **CrewAI** - Works with Bedrock, Anthropic, OpenAI, Gemini
81+
- **GoogleADK** - Gemini only
82+
- **OpenAIAgents** - OpenAI only
83+
- **AutoGen** - Works with Bedrock, Anthropic, OpenAI, Gemini
84+
85+
### Specific Context
86+
87+
Directory pathing to local projects is required for runtimes. Both CodeZip (Python zip) and Container (Docker image)
88+
deployment options are available.
89+
90+
## Deployment
91+
92+
The `agentcore/cdk/` subdirectory contains an AWS CDK node project.
93+
94+
Deployments of this project are primarily intended to be orchestrated through the `agentcore deploy` command in the CLI.
95+
96+
Alternatively, the project can be deployed directly as a traditional CDK project:
97+
98+
```bash
99+
cd agentcore/cdk
100+
npm install
101+
npx cdk synth # Preview CloudFormation template
102+
npx cdk deploy # Deploy to AWS
103+
```
104+
105+
## Editing Schemas
106+
107+
When modifying JSON config files:
108+
109+
1. Read the corresponding `agentcore/.llm-context/*.ts` file for type definitions
110+
2. Check validation constraint comments (`@regex`, `@min`, `@max`)
111+
3. Use exact enum values as string literals
112+
4. Use CloudFormation-safe names (alphanumeric, start with letter)
113+
5. Run `agentcore validate` command to verify changes.

ProtocolTesting/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# AgentCore Project
2+
3+
This project was created with the [AgentCore CLI](https://github.com/aws/agentcore-cli).
4+
5+
## Project Structure
6+
7+
```
8+
.
9+
my-project/
10+
├── agentcore/
11+
│ ├── .env.local # API keys (gitignored)
12+
│ ├── agentcore.json # Resource specifications
13+
│ ├── aws-targets.json # Deployment targets
14+
│ └── cdk/ # CDK infrastructure
15+
├── app/ # Application code
16+
```
17+
18+
## Getting Started
19+
20+
### Prerequisites
21+
22+
- **Node.js** 20.x or later
23+
- **uv** for Python agents ([install](https://docs.astral.sh/uv/getting-started/installation/))
24+
25+
### Development
26+
27+
Run your agent locally:
28+
29+
```bash
30+
agentcore dev
31+
```
32+
33+
### Deployment
34+
35+
Deploy to AWS:
36+
37+
```bash
38+
agentcore deploy
39+
```
40+
41+
Or use CDK directly:
42+
43+
```bash
44+
cd agentcore/cdk
45+
npx cdk deploy
46+
```
47+
48+
## Configuration
49+
50+
Edit the JSON files in `agentcore/` to configure your agents, memory, and credentials. See `agentcore/.llm-context/` for
51+
type definitions and validation constraints.
52+
53+
The project uses a **flat resource model** where agents, memories, and credentials are top-level arrays in
54+
`agentcore.json`.
55+
56+
## Commands
57+
58+
| Command | Description |
59+
| -------------------- | ----------------------------------------------- |
60+
| `agentcore create` | Create a new AgentCore project |
61+
| `agentcore add` | Add resources (agent, memory, identity, target) |
62+
| `agentcore remove` | Remove resources |
63+
| `agentcore dev` | Run agent locally |
64+
| `agentcore deploy` | Deploy to AWS |
65+
| `agentcore status` | Show deployment status |
66+
| `agentcore invoke` | Invoke agent (local or deployed) |
67+
| `agentcore package` | Package agent artifacts |
68+
| `agentcore validate` | Validate configuration |
69+
| `agentcore update` | Check for CLI updates |
70+
71+
### Agent Types
72+
73+
- **Template agents**: Created from framework templates (Strands, LangChain_LangGraph, GoogleADK, OpenAIAgents)
74+
- **BYO agents**: Bring your own code with `agentcore add agent --type byo`
75+
76+
## Documentation
77+
78+
- [AgentCore CLI Documentation](https://github.com/aws/agentcore-cli)
79+
- [Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"targets": {
3+
"default": {
4+
"resources": {
5+
"agents": {
6+
"A2AAgent": {
7+
"runtimeId": "ProtocolTesting_A2AAgent-Z22BUr7dIc",
8+
"runtimeArn": "arn:aws:bedrock-agentcore:us-east-1:637423344544:runtime/ProtocolTesting_A2AAgent-Z22BUr7dIc",
9+
"roleArn": "arn:aws:iam::637423344544:role/AgentCore-ProtocolTesting-ApplicationAgentA2AAgentR-P4VCIE1kI5TW"
10+
},
11+
"RegularHTTPAgent": {
12+
"runtimeId": "ProtocolTesting_RegularHTTPAgent-S4D3RWDEra",
13+
"runtimeArn": "arn:aws:bedrock-agentcore:us-east-1:637423344544:runtime/ProtocolTesting_RegularHTTPAgent-S4D3RWDEra",
14+
"roleArn": "arn:aws:iam::637423344544:role/AgentCore-ProtocolTesting-ApplicationAgentRegularHT-14760GgzpATw"
15+
},
16+
"MCPProtocol": {
17+
"runtimeId": "ProtocolTesting_MCPProtocol-uRS5lWCWrv",
18+
"runtimeArn": "arn:aws:bedrock-agentcore:us-east-1:637423344544:runtime/ProtocolTesting_MCPProtocol-uRS5lWCWrv",
19+
"roleArn": "arn:aws:iam::637423344544:role/AgentCore-ProtocolTesting-ApplicationAgentMCPProtoc-D8koVzL1Uq21"
20+
}
21+
},
22+
"memories": {
23+
"A2AAgentMemory": {
24+
"memoryId": "ProtocolTesting_A2AAgentMemory-YTcq6291qc",
25+
"memoryArn": "arn:aws:bedrock-agentcore:us-east-1:637423344544:memory/ProtocolTesting_A2AAgentMemory-YTcq6291qc"
26+
}
27+
},
28+
"credentials": {
29+
"ProtocolTestingGemini": {
30+
"credentialProviderArn": "arn:aws:bedrock-agentcore:us-east-1:637423344544:token-vault/default/apikeycredentialprovider/ProtocolTestingGemini"
31+
}
32+
},
33+
"stackName": "AgentCore-ProtocolTesting-default",
34+
"identityKmsKeyArn": "arn:aws:kms:us-east-1:637423344544:key/27a9f31d-4c55-41dd-be59-d9b9b283612f"
35+
}
36+
}
37+
}
38+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Secrets (local environment files are never committed)
2+
.env.local
3+
4+
# CDK Build Artifacts
5+
cdk/cdk.out/
6+
cdk/node_modules/
7+
8+
# CLI Internals
9+
.cli/*
10+
11+
# Ephemeral Staging
12+
.cache/*
13+
14+
# Exception: Commit the State
15+
!.cli/deployed-state.json
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# LLM Context Files
2+
3+
**DO NOT EDIT THESE FILES** - They are read-only reference for AI coding assistants.
4+
5+
## Files
6+
7+
| File | JSON Config | Purpose |
8+
| ---------------- | ------------------ | ------------------------------------ |
9+
| `agentcore.ts` | `agentcore.json` | Project and agent environment config |
10+
| `aws-targets.ts` | `aws-targets.json` | Deployment targets |
11+
12+
## Usage
13+
14+
When editing schema JSON files, reference the corresponding `.ts` file here for type definitions and validation
15+
constraints (marked with `@regex`, `@min`, `@max`).
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
/**
3+
* READ-ONLY LLM CONTEXT - Do not edit this file.
4+
*
5+
* JSON File: agentcore/agentcore.json
6+
* Purpose: Top-level project configuration with flat resource model
7+
*/
8+
9+
// ─────────────────────────────────────────────────────────────────────────────
10+
// ROOT SCHEMA: AgentCoreProjectSpec
11+
// ─────────────────────────────────────────────────────────────────────────────
12+
13+
interface AgentCoreProjectSpec {
14+
name: string; // @regex ^[A-Za-z][A-Za-z0-9]{0,22}$ @max 23 - project name
15+
version: number; // Schema version (integer)
16+
agents: AgentEnvSpec[]; // Unique by name
17+
memories: Memory[]; // Unique by name
18+
credentials: Credential[]; // Unique by name
19+
}
20+
21+
// ─────────────────────────────────────────────────────────────────────────────
22+
// ENUMS
23+
// ─────────────────────────────────────────────────────────────────────────────
24+
25+
type BuildType = 'CodeZip' | 'Container';
26+
type PythonRuntime = 'PYTHON_3_10' | 'PYTHON_3_11' | 'PYTHON_3_12' | 'PYTHON_3_13';
27+
type NodeRuntime = 'NODE_18' | 'NODE_20' | 'NODE_22';
28+
type RuntimeVersion = PythonRuntime | NodeRuntime;
29+
type NetworkMode = 'PUBLIC' | 'PRIVATE';
30+
type MemoryStrategyType = 'SEMANTIC' | 'SUMMARIZATION' | 'USER_PREFERENCE';
31+
type ModelProvider = 'Bedrock' | 'Gemini' | 'OpenAI' | 'Anthropic';
32+
33+
// ─────────────────────────────────────────────────────────────────────────────
34+
// AGENT
35+
// ─────────────────────────────────────────────────────────────────────────────
36+
37+
interface AgentEnvSpec {
38+
type: 'AgentCoreRuntime';
39+
name: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
40+
build: BuildType;
41+
entrypoint: string; // @regex ^[a-zA-Z0-9_][a-zA-Z0-9_/.-]*\.(py|ts|js)(:[a-zA-Z_][a-zA-Z0-9_]*)?$ e.g. "main.py:handler" or "index.ts"
42+
codeLocation: string; // Directory path
43+
runtimeVersion: RuntimeVersion;
44+
envVars?: EnvVar[];
45+
networkMode?: NetworkMode; // default 'PUBLIC'
46+
instrumentation?: Instrumentation; // OTel settings
47+
modelProvider?: ModelProvider; // Model provider used by this agent
48+
}
49+
50+
interface Instrumentation {
51+
enableOtel: boolean; // default true - wrap entrypoint with opentelemetry-instrument
52+
}
53+
54+
interface EnvVar {
55+
name: string; // @regex ^[A-Za-z_][A-Za-z0-9_]*$ @max 255
56+
value: string;
57+
}
58+
59+
// ─────────────────────────────────────────────────────────────────────────────
60+
// MEMORY
61+
// ─────────────────────────────────────────────────────────────────────────────
62+
63+
interface Memory {
64+
type: 'AgentCoreMemory';
65+
name: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
66+
eventExpiryDuration: number; // @min 7 @max 365 (days)
67+
strategies: MemoryStrategy[]; // @min 1, unique by type
68+
}
69+
70+
interface MemoryStrategy {
71+
type: MemoryStrategyType;
72+
name?: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
73+
description?: string;
74+
namespaces?: string[];
75+
}
76+
77+
// ─────────────────────────────────────────────────────────────────────────────
78+
// CREDENTIAL
79+
// ─────────────────────────────────────────────────────────────────────────────
80+
81+
interface Credential {
82+
type: 'ApiKeyCredentialProvider';
83+
name: string; // @regex ^[A-Za-z0-9_.-]+$ @min 3 @max 255
84+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
/**
3+
* READ-ONLY LLM CONTEXT - Do not edit this file.
4+
*
5+
* JSON File: agentcore/aws-targets.json
6+
* Purpose: AWS deployment targets for AgentCore resources
7+
*/
8+
9+
// ─────────────────────────────────────────────────────────────────────────────
10+
// ROOT SCHEMA: AwsDeploymentTargets (array)
11+
// ─────────────────────────────────────────────────────────────────────────────
12+
13+
// The JSON file contains an array of deployment targets.
14+
// Target names must be unique within the array.
15+
type AwsDeploymentTargets = AwsDeploymentTarget[];
16+
17+
interface AwsDeploymentTarget {
18+
name: string; // @regex ^[a-zA-Z][a-zA-Z0-9_-]*$ @max 64 - unique identifier
19+
description?: string; // @max 256
20+
account: string; // @regex ^[0-9]{12}$ - AWS account ID (exactly 12 digits)
21+
region: AgentCoreRegion;
22+
}
23+
24+
// ─────────────────────────────────────────────────────────────────────────────
25+
// SUPPORTED REGIONS
26+
// ─────────────────────────────────────────────────────────────────────────────
27+
28+
type AgentCoreRegion =
29+
| 'ap-northeast-1'
30+
| 'ap-south-1'
31+
| 'ap-southeast-1'
32+
| 'ap-southeast-2'
33+
| 'eu-central-1'
34+
| 'eu-west-1'
35+
| 'us-east-1'
36+
| 'us-east-2'
37+
| 'us-west-2';

0 commit comments

Comments
 (0)