Skip to content

Commit b8045e7

Browse files
committed
test: update snapshots for model changes
1 parent b0567d4 commit b8045e7

32 files changed

Lines changed: 5324 additions & 9 deletions

StrandsMemLifecycle/AGENTS.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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 models Agents and MCP
7+
setups with their own overloaded constructs. Agents are first-class.
8+
9+
## Mental Model
10+
11+
A good mental model for how this project works is a directed graph. We have a set of nodes: agents, memories,
12+
identities, gateways, tools, mcp servers, and future resources supported. There are rules about which nodes can connect
13+
to others in what direction.
14+
15+
For example, stand-alone memory or identity resources cannot be modeled--they need to be owned by an agent and can be
16+
used by other agents.
17+
18+
Wiring nodes creates an infrastructure and trust relationship but is not enough to complete end-to-end functionality.
19+
For example, attaching agentB as a remote tool for agentA means that agentA has permission to invoke agentB and that
20+
agentA has the ARN for agentB as an environment variable with the name specified in the agentcore.json schema.
21+
22+
To complete a functional connection, the application code in agentA needs to construct the appropriate call to
23+
`invoke_agent_runtime` which will succeed based on the wiring declared in the schema and implemented in the `cdk/`
24+
directory.
25+
26+
## Critical Invariants
27+
28+
1. **Schema-First Authority:** The `.json` files are the absolute source of truth. Do not attempt to modify agent
29+
behavior by editing the generated CDK code in `cdk/`.
30+
2. **Resource Identity:** The `name` field in the schema determines the CloudFormation Logical ID.
31+
- **Renaming** an agent, gateway, or target will **destroy and recreate** that resource.
32+
- **Modifying** other fields (descriptions, prompts, runtime config) will update the resource **in-place**.
33+
3. **1:1 Validation:** The schema maps directly to valid CloudFormation. If your JSON conforms to the types in
34+
`.llm-context/`, it will deploy successfully.
35+
36+
## Directory Structure
37+
38+
```
39+
myNewProject/
40+
├── AGENTS.md # This file - AI coding assistant context
41+
├── agentcore/ # AgentCore configuration directory
42+
│ ├── agentcore.json # Main workspace config (AgentCoreWorkspaceSpec)
43+
│ ├── mcp.json # MCP gateways and tools (AgentCoreMcpSpec)
44+
│ ├── mcp-defs.json # Tool definitions (AgentCoreCliMcpDefs)
45+
│ ├── .llm-context/ # TypeScript type definitions for AI coding assistants
46+
│ │ ├── README.md # Guide to using the schema files
47+
│ │ ├── agentcore.ts # AgentCoreWorkspaceSpec types
48+
│ │ ├── agent-env.ts # AgentEnvSpec and runtime types
49+
│ │ ├── mcp.ts # MCP gateway and tool types
50+
│ │ └── aws-targets.ts # AWS deployment target types
51+
│ └── cdk/ # AWS CDK project for deployment
52+
└── ... (your application code)
53+
```
54+
55+
## Schema Reference
56+
57+
The `agentcore/.llm-context/` directory contains TypeScript type definitions optimized for AI coding assistants. Each
58+
file maps to a JSON config file and includes validation constraints as comments.
59+
60+
| JSON Config | Schema File | Root Type |
61+
| -------------------------- | --------------------------------------- | ------------------------ |
62+
| `agentcore/agentcore.json` | `agentcore/.llm-context/agentcore.ts` | `AgentCoreWorkspaceSpec` |
63+
| `agentcore/mcp.json` | `agentcore/.llm-context/mcp.ts` | `AgentCoreMcpSpec` |
64+
| `agentcore/mcp-defs.json` | `agentcore/.llm-context/mcp.ts` | `AgentCoreCliMcpDefs` |
65+
| (aws-targets) | `agentcore/.llm-context/aws-targets.ts` | `AWSDeploymentTarget[]` |
66+
67+
### Key Types
68+
69+
- **AgentEnvSpec**: Agent configuration (runtime, memory, identity, tools)
70+
- **Runtime**: Discriminated union of `CodeZipRuntime` | `ContainerImageRuntime`
71+
- **MemoryProvider**: `OwnedMemoryProvider` (creates memory) | `ReferencedMemoryProvider` (uses existing)
72+
- **AgentCoreGateway**: MCP gateway with tool targets
73+
- **ToolDefinition**: Tool name, description, input/output schemas
74+
75+
### Common Enum Values
76+
77+
- **ArtifactType**: `'CodeZip'` | `'ContainerImage'`
78+
- **NetworkMode**: `'PUBLIC'` | `'PRIVATE'`
79+
- **Relation**: `'own'` | `'use'` (for memory providers)
80+
- **ModelProvider**: `'Bedrock'` | `'Anthropic'` | `'OpenAI'` | `'Gemini'`
81+
- **ComputeHost**: `'Lambda'` | `'AgentCoreRuntime'`
82+
83+
### Specific Context
84+
85+
Directory pathing to local projects is required for runtimes and tools backed by a modeled compute. Only Python offers a
86+
zip based direct code deploy option. All other programming languages are required to be containerized and provide a path
87+
do a `Dockerfile` definition.
88+
89+
MCP tools offer Lambda compute and AgentCore runtime compute. If something like a `FastMCP` server is desired, AgentCore
90+
runtime is a better fit. When using Lambda, the input schema needs to be modeled in `mcp-defs.json` and the lambda
91+
handler needs to be a traditional (context, event) style input shape.
92+
93+
## Deployment
94+
95+
The `agentcore/cdk/` subdirectory contains an AWS CDK node project.
96+
97+
Deployments of this project are primarily intended to be orchestrated through the `agentcore deploy` command in the CLI.
98+
99+
Alternatively, the project can be deployed directly as a traditional CDK project:
100+
101+
```bash
102+
cd agentcore/cdk
103+
npm install
104+
npx cdk synth # Preview CloudFormation template
105+
npx cdk deploy # Deploy to AWS
106+
```
107+
108+
Both CLI and direct deployment have the same source of truth and are safe to be substituted interchangeably.
109+
110+
## Editing Schemas
111+
112+
When modifying JSON config files:
113+
114+
1. Read the corresponding `agentcore/.llm-context/*.ts` file for type definitions
115+
2. Check validation constraint comments (`@regex`, `@min`, `@max`)
116+
3. Use exact enum values as string literals
117+
4. Use CloudFormation-safe names (alphanumeric, start with letter)
118+
5. Run `agentcore validate` command to verify changes.

StrandsMemLifecycle/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
├── agentcore/ # AgentCore configuration directory
10+
│ ├── agentcore.json # Main workspace config
11+
│ ├── mcp.json # MCP gateways and tools
12+
│ ├── mcp-defs.json # Tool definitions
13+
│ └── cdk/ # AWS CDK project for deployment
14+
├── app/ # Application code (if agents were created)
15+
└── AGENTS.md # AI coding assistant context
16+
```
17+
18+
## Getting Started
19+
20+
### Prerequisites
21+
22+
- [Node.js](https://nodejs.org/) (v18 or later)
23+
- [AWS CLI](https://aws.amazon.com/cli/) configured with credentials
24+
- [AgentCore CLI](https://github.com/awslabs/amazon-bedrock-agentcore) installed globally
25+
26+
### Development
27+
28+
Run your agent locally:
29+
30+
```bash
31+
agentcore dev
32+
```
33+
34+
### Deployment
35+
36+
Deploy to AWS:
37+
38+
```bash
39+
agentcore deploy
40+
```
41+
42+
Or use CDK directly:
43+
44+
```bash
45+
cd agentcore/cdk
46+
npx cdk deploy
47+
```
48+
49+
## Configuration
50+
51+
Edit the JSON files in `agentcore/` to configure your agents, memory, identity, and tools. See `agentcore/.llm-context/`
52+
for type definitions and validation constraints.
53+
54+
## Commands
55+
56+
| Command | Description |
57+
| -------------------- | ----------------------------------- |
58+
| `agentcore dev` | Run agent locally |
59+
| `agentcore deploy` | Deploy to AWS |
60+
| `agentcore status` | Show deployment status |
61+
| `agentcore invoke` | Invoke deployed agent |
62+
| `agentcore add` | Add agents, memory, identity, tools |
63+
| `agentcore remove` | Remove resources |
64+
| `agentcore validate` | Validate configuration |
65+
66+
## Documentation
67+
68+
- [AgentCore CLI Documentation](https://github.com/aws/agentcore-cli)
69+
- [Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"targets": {}
3+
}
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
| `mcp.ts` | `mcp.json` | MCP gateways and tools |
11+
| `aws-targets.ts` | `aws-targets.json` | Deployment targets |
12+
13+
## Usage
14+
15+
When editing schema JSON files, reference the corresponding `.ts` file here for type definitions and validation
16+
constraints (marked with `@regex`, `@min`, `@max`).
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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' | 'VPC';
30+
type MemoryStrategyType = 'SEMANTIC' | 'SUMMARIZATION' | 'USER_PREFERENCE' | 'CUSTOM';
31+
32+
// ─────────────────────────────────────────────────────────────────────────────
33+
// AGENT
34+
// ─────────────────────────────────────────────────────────────────────────────
35+
36+
interface AgentEnvSpec {
37+
type: 'AgentCoreRuntime';
38+
name: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
39+
build: BuildType;
40+
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"
41+
codeLocation: string; // Directory path
42+
runtimeVersion: RuntimeVersion;
43+
envVars?: EnvVar[];
44+
networkMode?: NetworkMode; // default 'PUBLIC'
45+
instrumentation?: Instrumentation; // OTel settings
46+
}
47+
48+
interface Instrumentation {
49+
enableOtel: boolean; // default true - wrap entrypoint with opentelemetry-instrument
50+
}
51+
52+
interface EnvVar {
53+
name: string; // @regex ^[A-Za-z_][A-Za-z0-9_]*$ @max 255
54+
value: string;
55+
}
56+
57+
// ─────────────────────────────────────────────────────────────────────────────
58+
// MEMORY
59+
// ─────────────────────────────────────────────────────────────────────────────
60+
61+
interface Memory {
62+
type: 'AgentCoreMemory';
63+
name: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
64+
eventExpiryDuration: number; // @min 7 @max 365 (days)
65+
strategies: MemoryStrategy[]; // @min 1, unique by type
66+
}
67+
68+
interface MemoryStrategy {
69+
type: MemoryStrategyType;
70+
name?: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
71+
description?: string;
72+
namespaces?: string[];
73+
}
74+
75+
// ─────────────────────────────────────────────────────────────────────────────
76+
// CREDENTIAL
77+
// ─────────────────────────────────────────────────────────────────────────────
78+
79+
interface Credential {
80+
type: 'ApiKeyCredentialProvider';
81+
name: string; // @regex ^[A-Za-z0-9_.-]+$ @min 3 @max 255
82+
}
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)