Skip to content

Commit 36dc3b2

Browse files
Merge branch 'main' into fix/name-constraints
2 parents 63472c3 + 2f1d59f commit 36dc3b2

35 files changed

Lines changed: 195 additions & 59 deletions

File tree

docs/commands.md

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Run `agentcore` without arguments to launch the interactive TUI. Flags marked `[
99

1010
| Command | Alias |
1111
| --------- | ----- |
12-
| `deploy` | `p` |
12+
| `deploy` | `dp` |
1313
| `dev` | `d` |
1414
| `invoke` | `i` |
1515
| `status` | `s` |
@@ -65,30 +65,30 @@ agentcore create \
6565
--memory none
6666
```
6767

68-
| Flag | Description |
69-
| ------------------------- | -------------------------------------------------------------------------------- |
70-
| `--name <name>` | Project name (alphanumeric, starts with letter, max 23 chars) |
71-
| `--defaults` | Use defaults (Python, Strands, Bedrock, no memory) |
72-
| `--no-agent` | Skip agent creation |
73-
| `--type <type>` | `create` (default) or `import` |
74-
| `--language <lang>` | `Python` (default) |
75-
| `--framework <fw>` | `Strands`, `LangChain_LangGraph`, `CrewAI`, `GoogleADK`, `OpenAIAgents` |
76-
| `--model-provider <p>` | `Bedrock`, `Anthropic`, `OpenAI`, `Gemini` |
77-
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
78-
| `--api-key <key>` | API key for non-Bedrock providers |
79-
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` |
80-
| `--protocol <protocol>` | `HTTP` (default), `MCP`, `A2A` |
81-
| `--network-mode <mode>` | `PUBLIC` (default) or `VPC` |
82-
| `--subnets <ids>` | Comma-separated subnet IDs (required for VPC mode) |
83-
| `--security-groups <ids>` | Comma-separated security group IDs (required for VPC mode) |
84-
| `--agent-id <id>` | Bedrock Agent ID (import only) |
85-
| `--agent-alias-id <id>` | Bedrock Agent Alias ID (import only) |
86-
| `--region <region>` | AWS region for Bedrock Agent (import only) |
87-
| `--output-dir <dir>` | Output directory |
88-
| `--skip-git` | Skip git initialization |
89-
| `--skip-python-setup` | Skip venv setup |
90-
| `--dry-run` | Preview without creating |
91-
| `--json` | JSON output |
68+
| Flag | Description |
69+
| ------------------------- | -------------------------------------------------------------------------------------------------------------- |
70+
| `--name <name>` | Project name (alphanumeric, starts with letter, max 23 chars) |
71+
| `--defaults` | Use defaults (Python, Strands, Bedrock, no memory) |
72+
| `--no-agent` | Skip agent creation |
73+
| `--type <type>` | `create` (default) or `import` |
74+
| `--language <lang>` | `Python` (default) |
75+
| `--framework <fw>` | `Strands`, `LangChain_LangGraph`, `CrewAI`, `GoogleADK`, `OpenAIAgents` |
76+
| `--model-provider <p>` | `Bedrock`, `Anthropic`, `OpenAI`, `Gemini` |
77+
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
78+
| `--api-key <key>` | API key for non-Bedrock providers |
79+
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` (see [Memory Shorthand Mapping](memory.md#--memory-shorthand-mapping)) |
80+
| `--protocol <protocol>` | `HTTP` (default), `MCP`, `A2A` |
81+
| `--network-mode <mode>` | `PUBLIC` (default) or `VPC` |
82+
| `--subnets <ids>` | Comma-separated subnet IDs (required for VPC mode) |
83+
| `--security-groups <ids>` | Comma-separated security group IDs (required for VPC mode) |
84+
| `--agent-id <id>` | Bedrock Agent ID (import only) |
85+
| `--agent-alias-id <id>` | Bedrock Agent Alias ID (import only) |
86+
| `--region <region>` | AWS region for Bedrock Agent (import only) |
87+
| `--output-dir <dir>` | Output directory |
88+
| `--skip-git` | Skip git initialization |
89+
| `--skip-python-setup` | Skip venv setup |
90+
| `--dry-run` | Preview without creating |
91+
| `--json` | JSON output |
9292

9393
### deploy
9494

@@ -193,26 +193,27 @@ agentcore add agent \
193193
--memory none
194194
```
195195

196-
| Flag | Description |
197-
| ------------------------- | -------------------------------------------------------------------------------- |
198-
| `--name <name>` | Agent name (alphanumeric + underscores, starts with letter, max 48 chars) |
199-
| `--type <type>` | `create` (default), `byo`, or `import` |
200-
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
201-
| `--language <lang>` | `Python` (create); `Python`, `TypeScript`, `Other` (BYO) |
202-
| `--framework <fw>` | `Strands`, `LangChain_LangGraph`, `CrewAI`, `GoogleADK`, `OpenAIAgents` |
203-
| `--model-provider <p>` | `Bedrock`, `Anthropic`, `OpenAI`, `Gemini` |
204-
| `--api-key <key>` | API key for non-Bedrock providers |
205-
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` (create and import) |
206-
| `--protocol <protocol>` | `HTTP` (default), `MCP`, `A2A` |
207-
| `--code-location <path>` | Path to existing code (BYO only) |
208-
| `--entrypoint <file>` | Entry file relative to code-location (BYO, default: `main.py`) |
209-
| `--network-mode <mode>` | `PUBLIC` (default) or `VPC` |
210-
| `--subnets <ids>` | Comma-separated subnet IDs (required for VPC mode) |
211-
| `--security-groups <ids>` | Comma-separated security group IDs (required for VPC mode) |
212-
| `--agent-id <id>` | Bedrock Agent ID (import only) |
213-
| `--agent-alias-id <id>` | Bedrock Agent Alias ID (import only) |
214-
| `--region <region>` | AWS region for Bedrock Agent (import only) |
215-
| `--json` | JSON output |
196+
197+
| Flag | Description |
198+
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
199+
| `--name <name>` | Agent name (alphanumeric + underscores, starts with letter, max 48 chars) |
200+
| `--type <type>` | `create` (default), `byo`, or `import` |
201+
| `--build <type>` | `CodeZip` (default) or `Container` (see [Container Builds](container-builds.md)) |
202+
| `--language <lang>` | `Python` (create); `Python`, `TypeScript`, `Other` (BYO) |
203+
| `--framework <fw>` | `Strands`, `LangChain_LangGraph`, `CrewAI`, `GoogleADK`, `OpenAIAgents` |
204+
| `--model-provider <p>` | `Bedrock`, `Anthropic`, `OpenAI`, `Gemini` |
205+
| `--api-key <key>` | API key for non-Bedrock providers |
206+
| `--memory <opt>` | `none`, `shortTerm`, `longAndShortTerm` (create and import; see [Memory Shorthand Mapping](memory.md#--memory-shorthand-mapping)) |
207+
| `--protocol <protocol>` | `HTTP` (default), `MCP`, `A2A` |
208+
| `--code-location <path>` | Path to existing code (BYO only) |
209+
| `--entrypoint <file>` | Entry file relative to code-location (BYO, default: `main.py`) |
210+
| `--network-mode <mode>` | `PUBLIC` (default) or `VPC` |
211+
| `--subnets <ids>` | Comma-separated subnet IDs (required for VPC mode) |
212+
| `--security-groups <ids>` | Comma-separated security group IDs (required for VPC mode) |
213+
| `--agent-id <id>` | Bedrock Agent ID (import only) |
214+
| `--agent-alias-id <id>` | Bedrock Agent Alias ID (import only) |
215+
| `--region <region>` | AWS region for Bedrock Agent (import only) |
216+
| `--json` | JSON output |
216217

217218
### add memory
218219

@@ -542,7 +543,7 @@ agentcore logs --json # JSON Lines output
542543
| `--since <time>` | Start time (defaults to 1h ago in search mode; e.g. `1h`, `30m`, `2d`, ISO 8601) |
543544
| `--until <time>` | End time (defaults to now in search mode; e.g. `now`, ISO 8601) |
544545
| `--level <level>` | Filter by log level: `error`, `warn`, `info`, `debug` |
545-
| `-n, --lines <n>` | Maximum number of log lines to return |
546+
| `-n, --limit <n>` | Maximum number of log lines to return |
546547
| `--query <text>` | Server-side text filter |
547548
| `--json` | Output as JSON Lines |
548549

@@ -675,7 +676,7 @@ agentcore logs evals --follow --json
675676
| `-a, --agent <name>` | Filter by agent |
676677
| `--since <time>` | Start time (e.g. `1h`, `30m`, `2d`, ISO 8601) |
677678
| `--until <time>` | End time |
678-
| `-n, --lines <count>` | Maximum log lines |
679+
| `-n, --limit <count>` | Maximum log lines |
679680
| `-f, --follow` | Stream in real-time |
680681
| `--json` | JSON Lines output |
681682

docs/memory.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ async def invoke(payload, context):
149149
agentcore deploy
150150
```
151151

152+
## `--memory` Shorthand Mapping
153+
154+
The `create` and `add agent` commands accept a `--memory` flag with one of three shorthand values. Each maps to a
155+
specific memory configuration:
156+
157+
| Shorthand | Strategies Created |
158+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
159+
| `none` | No memory resource created |
160+
| `shortTerm` | Memory with no strategies (session context via event expiry only, default 30 days) |
161+
| `longAndShortTerm` | Memory with four strategies: `SEMANTIC` (`/users/{actorId}/facts`), `USER_PREFERENCE` (`/users/{actorId}/preferences`), `SUMMARIZATION` (`/summaries/{actorId}/{sessionId}`), `EPISODIC` (`/episodes/{actorId}/{sessionId}`, reflection: `/episodes/{actorId}`) |
162+
163+
**Short-term memory** provides basic conversation context within a session — events are stored and expire after the
164+
configured duration, but no long-term extraction or search is performed.
165+
166+
**Long-and-short-term memory** adds persistent strategies that extract facts, preferences, summaries, and episodes from
167+
conversations, enabling cross-session recall via semantic search.
168+
152169
## Memory Strategies
153170

154171
| Strategy | Description |

e2e-tests/e2e-helper.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
BedrockAgentCoreControlClient,
1111
DeleteApiKeyCredentialProviderCommand,
1212
GetAgentRuntimeCommand,
13+
ListApiKeyCredentialProvidersCommand,
1314
} from '@aws-sdk/client-bedrock-agentcore-control';
1415
import { execSync } from 'node:child_process';
1516
import { randomUUID } from 'node:crypto';
@@ -46,6 +47,8 @@ export function createE2ESuite(cfg: E2EConfig) {
4647
beforeAll(async () => {
4748
if (!canRun) return;
4849

50+
await cleanupStaleCredentialProviders();
51+
4952
testDir = join(tmpdir(), `agentcore-e2e-${randomUUID()}`);
5053
await mkdir(testDir, { recursive: true });
5154

@@ -329,6 +332,37 @@ export function installCdkTarball(projectPath: string): void {
329332
}
330333
}
331334

335+
/**
336+
* Delete stale E2e* credential providers older than the given max age.
337+
* Runs in beforeAll to prevent accumulation from previous runs that
338+
* crashed or timed out before their afterAll teardown could execute.
339+
*/
340+
export async function cleanupStaleCredentialProviders(maxAgeMs: number = 60 * 60 * 1000): Promise<void> {
341+
const region = process.env.AWS_REGION ?? 'us-east-1';
342+
const client = new BedrockAgentCoreControlClient({ region });
343+
const cutoff = new Date(Date.now() - maxAgeMs);
344+
345+
let nextToken: string | undefined;
346+
do {
347+
const response = await client.send(new ListApiKeyCredentialProvidersCommand({ nextToken }));
348+
const providers = response.credentialProviders ?? [];
349+
const stale = providers.filter(p => p.name?.startsWith('E2e') && p.createdTime && p.createdTime < cutoff);
350+
351+
await Promise.all(
352+
stale.map(async p => {
353+
try {
354+
await client.send(new DeleteApiKeyCredentialProviderCommand({ name: p.name! }));
355+
console.log(`Cleaned up stale credential provider: ${p.name}`);
356+
} catch {
357+
console.warn(`Failed to clean up stale credential provider: ${p.name}`);
358+
}
359+
})
360+
);
361+
362+
nextToken = response.nextToken;
363+
} while (nextToken);
364+
}
365+
332366
export async function teardownE2EProject(projectPath: string, agentName: string, modelProvider: string): Promise<void> {
333367
await spawnAndCollect('agentcore', ['remove', 'all', '--json'], projectPath);
334368
const result = await spawnAndCollect('agentcore', ['deploy', '--yes', '--json'], projectPath);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ test('AgentCoreStack synthesizes with empty spec', () => {
376376
spec: {
377377
name: 'testproject',
378378
version: 1,
379+
managedBy: 'CDK' as const,
379380
agents: [],
380381
memories: [],
381382
credentials: [],

src/assets/cdk/test/cdk.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test('AgentCoreStack synthesizes with empty spec', () => {
88
spec: {
99
name: 'testproject',
1010
version: 1,
11+
managedBy: 'CDK' as const,
1112
agents: [],
1213
memories: [],
1314
credentials: [],

src/cli/commands/create/action.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function createDefaultProjectSpec(projectName: string): AgentCoreProjectSpec {
2828
return {
2929
name: projectName,
3030
version: 1,
31+
managedBy: 'CDK' as const,
3132
agents: [],
3233
memories: [],
3334
credentials: [],

src/cli/commands/deploy/command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async function handleDeployCLI(options: DeployOptions): Promise<void> {
130130
export const registerDeploy = (program: Command) => {
131131
program
132132
.command('deploy')
133-
.alias('p')
133+
.alias('dp')
134134
.description(COMMAND_DESCRIPTIONS.deploy)
135135
.option('--target <target>', 'Deployment target name (default: "default") [non-interactive]')
136136
.option('-y, --yes', 'Auto-confirm prompts, read credentials from env [non-interactive]')

src/cli/commands/logs/__tests__/action.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('resolveAgentContext', () => {
4343
project: {
4444
name: 'TestProject',
4545
version: 1,
46+
managedBy: 'CDK' as const,
4647
agents: [
4748
{
4849
type: 'AgentCoreRuntime' as const,
@@ -96,6 +97,7 @@ describe('resolveAgentContext', () => {
9697
project: {
9798
name: 'TestProject',
9899
version: 1,
100+
managedBy: 'CDK' as const,
99101
agents: [
100102
{
101103
type: 'AgentCoreRuntime' as const,
@@ -138,6 +140,7 @@ describe('resolveAgentContext', () => {
138140
project: {
139141
name: 'TestProject',
140142
version: 1,
143+
managedBy: 'CDK' as const,
141144
agents: [
142145
{
143146
type: 'AgentCoreRuntime' as const,
@@ -207,6 +210,7 @@ describe('resolveAgentContext', () => {
207210
project: {
208211
name: 'TestProject',
209212
version: 1,
213+
managedBy: 'CDK' as const,
210214
agents: [],
211215
memories: [],
212216
credentials: [],

0 commit comments

Comments
 (0)