Skip to content

Commit 6d7572d

Browse files
authored
docs: update AGENTS.md and llm-context for container support (#348)
* docs: update AGENTS.md and llm-context for container support Document container build type, dev server architecture, packaging pipeline, and template rendering across all AGENTS.md files. Add missing modelProvider field to llm-compacted agentcore.ts. * test: update asset snapshot tests for AGENTS.md changes
1 parent 3fc5d1f commit 6d7572d

File tree

8 files changed

+121
-16
lines changed

8 files changed

+121
-16
lines changed

AGENTS.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,25 @@ Note: CDK L3 constructs are in a separate package `@aws/agentcore-cdk`.
2727
- `remove` - Remove resources (agent, memory, identity, target, all)
2828
- `deploy` - Deploy infrastructure to AWS
2929
- `status` - Check deployment status
30-
- `dev` - Local development server
30+
- `dev` - Local development server (CodeZip: uvicorn with hot-reload; Container: Docker build + run with volume mount)
3131
- `invoke` - Invoke agents (local or deployed)
32-
- `package` - Package agent artifacts without deploying
32+
- `package` - Package agent artifacts without deploying (zip for CodeZip, container image build for Container)
3333
- `validate` - Validate configuration files
3434
- `update` - Check for CLI updates
3535
- `help` - Display help information
3636

3737
### Agent Types
3838

39-
- **Template agents**: Created from framework templates (Strands, LangChain_LangGraph, GoogleADK, OpenAIAgents)
39+
- **Template agents**: Created from framework templates (Strands, LangChain_LangGraph, CrewAI, GoogleADK, OpenAIAgents,
40+
AutoGen)
4041
- **BYO agents**: Bring your own code with `agentcore add agent --type byo`
4142

43+
### Build Types
44+
45+
- **CodeZip**: Python source is packaged into a zip artifact and deployed to AgentCore Runtime (default)
46+
- **Container**: Agent is built as a Docker container image, deployed via ECR and CodeBuild. Requires a `Dockerfile` in
47+
the agent's code directory. Supported container runtimes: Docker, Podman, Finch.
48+
4249
### Coming Soon
4350

4451
- MCP gateway and tool support (`add gateway`, `add mcp-tool`) - currently hidden

src/assets/AGENTS.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,36 @@
33
This directory stores:
44

55
- Template assets for agents written in different Languages, SDKs and having different configurations
6+
- Container templates (`container/python/`) with `Dockerfile` and `.dockerignore` for Container build agents
67

7-
The rendering logic is rooted in the `AgentEnvSpec` and must ALWAYS respect the configuration in the Spec
8+
### Directory Layout
9+
10+
```
11+
assets/
12+
├── python/ # Framework templates (one per SDK)
13+
│ ├── strands/
14+
│ ├── langchain_langgraph/
15+
│ ├── crewai/
16+
│ ├── googleadk/
17+
│ ├── openaiagents/
18+
│ └── autogen/
19+
├── container/ # Container build templates
20+
│ └── python/
21+
│ ├── Dockerfile
22+
│ └── dockerignore.template
23+
└── agents/ # AGENTS.md vended to user projects
24+
```
25+
26+
The rendering logic is rooted in the `AgentEnvSpec` and must ALWAYS respect the configuration in the Spec.
27+
28+
For Container builds, `BaseRenderer.render()` automatically copies the `container/<language>/` templates (Dockerfile,
29+
.dockerignore) into the agent directory when `buildType === 'Container'`.
830

931
## Guidance for template changes
1032

1133
- Always make sure the templates are as close to working code as possible
1234
- AVOID as much as possible using any conditionals within the templates
1335

14-
# How to use the assets in this directory
36+
## How to use the assets in this directory
1537

16-
- These assets are rendered by the CLI's template renderer in `packages/agentcore-cli/src/templates`.
38+
- These assets are rendered by the CLI's template renderer in `src/cli/templates/`.

src/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2752,17 +2752,39 @@ exports[`Assets Directory Snapshots > Root-level assets > AGENTS.md should match
27522752
This directory stores:
27532753
27542754
- Template assets for agents written in different Languages, SDKs and having different configurations
2755+
- Container templates (\`container/python/\`) with \`Dockerfile\` and \`.dockerignore\` for Container build agents
27552756
2756-
The rendering logic is rooted in the \`AgentEnvSpec\` and must ALWAYS respect the configuration in the Spec
2757+
### Directory Layout
2758+
2759+
\`\`\`
2760+
assets/
2761+
├── python/ # Framework templates (one per SDK)
2762+
│ ├── strands/
2763+
│ ├── langchain_langgraph/
2764+
│ ├── crewai/
2765+
│ ├── googleadk/
2766+
│ ├── openaiagents/
2767+
│ └── autogen/
2768+
├── container/ # Container build templates
2769+
│ └── python/
2770+
│ ├── Dockerfile
2771+
│ └── dockerignore.template
2772+
└── agents/ # AGENTS.md vended to user projects
2773+
\`\`\`
2774+
2775+
The rendering logic is rooted in the \`AgentEnvSpec\` and must ALWAYS respect the configuration in the Spec.
2776+
2777+
For Container builds, \`BaseRenderer.render()\` automatically copies the \`container/<language>/\` templates (Dockerfile,
2778+
.dockerignore) into the agent directory when \`buildType === 'Container'\`.
27572779
27582780
## Guidance for template changes
27592781
27602782
- Always make sure the templates are as close to working code as possible
27612783
- AVOID as much as possible using any conditionals within the templates
27622784
2763-
# How to use the assets in this directory
2785+
## How to use the assets in this directory
27642786
2765-
- These assets are rendered by the CLI's template renderer in \`packages/agentcore-cli/src/templates\`.
2787+
- These assets are rendered by the CLI's template renderer in \`src/cli/templates/\`.
27662788
"
27672789
`;
27682790
@@ -2912,21 +2934,32 @@ file maps to a JSON config file and includes validation constraints as comments.
29122934
29132935
### Common Enum Values
29142936
2915-
- **BuildType**: \`'CodeZip'\`
2937+
- **BuildType**: \`'CodeZip'\` | \`'Container'\`
29162938
- **NetworkMode**: \`'PUBLIC'\`
29172939
- **RuntimeVersion**: \`'PYTHON_3_10'\` | \`'PYTHON_3_11'\` | \`'PYTHON_3_12'\` | \`'PYTHON_3_13'\`
29182940
- **MemoryStrategyType**: \`'SEMANTIC'\` | \`'SUMMARIZATION'\` | \`'USER_PREFERENCE'\`
29192941
2942+
### Build Types
2943+
2944+
- **CodeZip**: Python source is packaged as a zip artifact and deployed directly to AgentCore Runtime.
2945+
- **Container**: Agent code is built as a Docker container image. Requires a \`Dockerfile\` in the agent's \`codeLocation\`
2946+
directory. At deploy time, the source is uploaded to S3, built in CodeBuild (ARM64), pushed to a per-agent ECR
2947+
repository, and the container URI is provided to the AgentCore Runtime. For local development (\`agentcore dev\`), the
2948+
container is built and run locally with volume-mounted hot-reload.
2949+
29202950
### Supported Frameworks (for template agents)
29212951
29222952
- **Strands** - Works with Bedrock, Anthropic, OpenAI, Gemini
29232953
- **LangChain_LangGraph** - Works with Bedrock, Anthropic, OpenAI, Gemini
2954+
- **CrewAI** - Works with Bedrock, Anthropic, OpenAI, Gemini
29242955
- **GoogleADK** - Gemini only
29252956
- **OpenAIAgents** - OpenAI only
2957+
- **AutoGen** - Works with Bedrock, Anthropic, OpenAI, Gemini
29262958
29272959
### Specific Context
29282960
2929-
Directory pathing to local projects is required for runtimes. Only Python offers a zip based direct code deploy option.
2961+
Directory pathing to local projects is required for runtimes. Both CodeZip (Python zip) and Container (Docker image)
2962+
deployment options are available.
29302963
29312964
## Deployment
29322965

src/assets/agents/AGENTS.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,32 @@ file maps to a JSON config file and includes validation constraints as comments.
6060

6161
### Common Enum Values
6262

63-
- **BuildType**: `'CodeZip'`
63+
- **BuildType**: `'CodeZip'` | `'Container'`
6464
- **NetworkMode**: `'PUBLIC'`
6565
- **RuntimeVersion**: `'PYTHON_3_10'` | `'PYTHON_3_11'` | `'PYTHON_3_12'` | `'PYTHON_3_13'`
6666
- **MemoryStrategyType**: `'SEMANTIC'` | `'SUMMARIZATION'` | `'USER_PREFERENCE'`
6767

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+
6876
### Supported Frameworks (for template agents)
6977

7078
- **Strands** - Works with Bedrock, Anthropic, OpenAI, Gemini
7179
- **LangChain_LangGraph** - Works with Bedrock, Anthropic, OpenAI, Gemini
80+
- **CrewAI** - Works with Bedrock, Anthropic, OpenAI, Gemini
7281
- **GoogleADK** - Gemini only
7382
- **OpenAIAgents** - OpenAI only
83+
- **AutoGen** - Works with Bedrock, Anthropic, OpenAI, Gemini
7484

7585
### Specific Context
7686

77-
Directory pathing to local projects is required for runtimes. Only Python offers a zip based direct code deploy option.
87+
Directory pathing to local projects is required for runtimes. Both CodeZip (Python zip) and Container (Docker image)
88+
deployment options are available.
7889

7990
## Deployment
8091

src/cli/AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ appropriate to test the relevant surface area.
6565

6666
If start up issues are encountered, read the console error to troubleshoot bugs and update the harness.
6767

68+
## Dev Server Architecture
69+
70+
The `dev` command uses a strategy pattern with a `DevServer` base class and two implementations:
71+
72+
- **CodeZipDevServer**: Runs uvicorn locally with Python venv hot-reload
73+
- **ContainerDevServer**: Builds and runs a Docker container with volume mount for hot-reload. Detects
74+
Docker/Podman/Finch via the `detectContainerRuntime()` utility.
75+
76+
The server selection is based on `agent.build` (`CodeZip` or `Container`).
77+
6878
## Commands Directory Structure
6979

7080
Commands live in `commands/`. Each command has its own directory with an `index.ts` barrel file and a file called

src/cli/templates/AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ Template **assets** live in the `assets/` directory at the repository root.
66

77
The rendering logic is rooted in the `AgentEnvSpec` and must ALWAYS respect the configuration in the Spec.
88

9+
### Rendering Pipeline
10+
11+
1. `createRenderer()` selects a renderer based on framework/language
12+
2. `BaseRenderer.render()` copies and renders the framework base template
13+
3. If `hasMemory`, capability templates are layered on top
14+
4. If `buildType === 'Container'`, the container templates (`Dockerfile`, `.dockerignore`) from
15+
`assets/container/<language>/` are copied into the agent directory
16+
17+
### LLM Context Files
18+
19+
`schema-assets.ts` imports llm-compacted TypeScript files that are embedded at build time via the esbuild text-loader
20+
plugin. `CDKRenderer.writeLlmContext()` writes these to `agentcore/.llm-context/` during project initialization.
21+
922
## Guidance for template changes
1023

1124
- Always make sure the templates are as close to working code as possible

src/lib/AGENTS.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ module serves the important goal of making sure that the CDK implementations don
55

66
## Functions
77

8-
**Packaging**: Installing dependencies and then producing a `.zip` file artifact that is ready to be deployed on
9-
AgentCore runtime. This is surfaced as a modular function in the CLI and used as a bundling CDK asset in the CDK. A core
10-
problem this functionality solves is attempting to produce an artifact that can run on ARM64 arch hardware.
8+
**Packaging**: Producing deployment artifacts for AgentCore runtimes. Two packagers are available:
9+
10+
- **PythonPackager / NodePackager** (CodeZip): Installs dependencies and produces a `.zip` artifact targeting ARM64
11+
architecture.
12+
- **ContainerPackager** (Container): Validates the Dockerfile exists, detects a local container runtime
13+
(Docker/Podman/Finch), builds the image locally, and validates the 1GB size limit. If no local runtime is available,
14+
the local build is skipped (deploy uses CodeBuild).
15+
16+
Container constants (`CONTAINER_RUNTIMES`, `DOCKERFILE_NAME`, `CONTAINER_INTERNAL_PORT`) and the `ContainerRuntime` type
17+
are in `lib/constants.ts`.
1118

1219
**ConfigIO**: This module defines utilities to read and write configs which satisfy schemas to the local file system.
1320
Both the CLI and the CDK require this functionality.

src/schema/llm-compacted/agentcore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type NodeRuntime = 'NODE_18' | 'NODE_20' | 'NODE_22';
2828
type RuntimeVersion = PythonRuntime | NodeRuntime;
2929
type NetworkMode = 'PUBLIC' | 'PRIVATE';
3030
type MemoryStrategyType = 'SEMANTIC' | 'SUMMARIZATION' | 'USER_PREFERENCE';
31+
type ModelProvider = 'Bedrock' | 'Gemini' | 'OpenAI' | 'Anthropic';
3132

3233
// ─────────────────────────────────────────────────────────────────────────────
3334
// AGENT
@@ -43,6 +44,7 @@ interface AgentEnvSpec {
4344
envVars?: EnvVar[];
4445
networkMode?: NetworkMode; // default 'PUBLIC'
4546
instrumentation?: Instrumentation; // OTel settings
47+
modelProvider?: ModelProvider; // Model provider used by this agent
4648
}
4749

4850
interface Instrumentation {

0 commit comments

Comments
 (0)