|
| 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. |
0 commit comments