From ea7972e549a79debcaf1578d3f412a1d4336bd85 Mon Sep 17 00:00:00 2001 From: Jesse Turner Date: Mon, 18 May 2026 17:18:30 +0000 Subject: [PATCH 1/2] fix: align harness memory config with Smithy API model The harness API expects memory as a union type: { agentCoreMemoryConfiguration: { arn: "..." } } but the CLI was sending the wrong structure: { memoryArn: "..." } This caused the API to silently accept the request but store an empty memory config, resulting in deployed harnesses having no memory capabilities at invocation time. --- src/cli/aws/agentcore-harness.ts | 9 ++++- .../__tests__/harness-mapper.test.ts | 8 +++- .../imperative/deployers/harness-deployer.ts | 4 +- .../imperative/deployers/harness-mapper.ts | 38 ++++++++++--------- 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/cli/aws/agentcore-harness.ts b/src/cli/aws/agentcore-harness.ts index cca371fbc..52e7c8d47 100644 --- a/src/cli/aws/agentcore-harness.ts +++ b/src/cli/aws/agentcore-harness.ts @@ -37,8 +37,15 @@ export interface HarnessSkill { path: string; } +export interface HarnessAgentCoreMemoryConfiguration { + arn: string; + actorId?: string; + messagesCount?: number; + retrievalConfig?: Record; +} + export interface HarnessMemoryConfiguration { - memoryArn?: string; + agentCoreMemoryConfiguration: HarnessAgentCoreMemoryConfiguration; } export interface HarnessTruncationConfiguration { diff --git a/src/cli/operations/deploy/imperative/deployers/__tests__/harness-mapper.test.ts b/src/cli/operations/deploy/imperative/deployers/__tests__/harness-mapper.test.ts index 8d5e033d9..a2ee5256b 100644 --- a/src/cli/operations/deploy/imperative/deployers/__tests__/harness-mapper.test.ts +++ b/src/cli/operations/deploy/imperative/deployers/__tests__/harness-mapper.test.ts @@ -380,7 +380,9 @@ describe('mapHarnessSpecToCreateOptions', () => { }); expect(result.memory).toEqual({ - memoryArn: 'arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/mem-123', + agentCoreMemoryConfiguration: { + arn: 'arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/mem-123', + }, }); }); @@ -391,7 +393,9 @@ describe('mapHarnessSpecToCreateOptions', () => { const result = await mapHarnessSpecToCreateOptions({ ...BASE_OPTIONS, harnessSpec: spec }); expect(result.memory).toEqual({ - memoryArn: 'arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/custom-mem', + agentCoreMemoryConfiguration: { + arn: 'arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/custom-mem', + }, }); }); diff --git a/src/cli/operations/deploy/imperative/deployers/harness-deployer.ts b/src/cli/operations/deploy/imperative/deployers/harness-deployer.ts index 3f000e5d0..ea5b31d5f 100644 --- a/src/cli/operations/deploy/imperative/deployers/harness-deployer.ts +++ b/src/cli/operations/deploy/imperative/deployers/harness-deployer.ts @@ -192,7 +192,7 @@ export class HarnessDeployer implements ImperativeDeployer ): HarnessMemoryConfiguration | undefined { + let arn: string | undefined; + // Direct ARN takes precedence if (memory.arn) { - return { memoryArn: memory.arn }; - } - - // Resolve by name from deployed state or CDK outputs - if (memory.name) { - // Try deployed state first + arn = memory.arn; + } else if (memory.name) { + // Resolve by name from deployed state or CDK outputs const deployedMemory = deployedResources?.memories?.[memory.name]; if (deployedMemory) { - return { memoryArn: deployedMemory.memoryArn }; + arn = deployedMemory.memoryArn; + } else if (cdkOutputs) { + arn = resolveMemoryArnFromOutputs(memory.name, cdkOutputs); } - // Fall back to CDK outputs - if (cdkOutputs) { - const memoryArn = resolveMemoryArnFromOutputs(memory.name, cdkOutputs); - if (memoryArn) { - return { memoryArn }; - } + if (!arn) { + throw new Error( + `Memory "${memory.name}" referenced by harness is not in deployed state. Ensure the memory is defined in agentcore.json and has been deployed.` + ); } + } - throw new Error( - `Memory "${memory.name}" referenced by harness is not in deployed state. Ensure the memory is defined in agentcore.json and has been deployed.` - ); + if (!arn) { + return undefined; } - return undefined; + return { + agentCoreMemoryConfiguration: { + arn, + ...(memory.actorId && { actorId: memory.actorId }), + }, + }; } /** From 329a4ad54af16f6fa01fd3b6f2f21ee0e1cf4382 Mon Sep 17 00:00:00 2001 From: Jesse Turner Date: Mon, 18 May 2026 17:39:18 +0000 Subject: [PATCH 2/2] fix: add strategyId to HarnessAgentCoreMemoryRetrievalConfig The Smithy model includes strategyId in the retrieval config structure but it was missing from the TypeScript interface. --- src/cli/aws/agentcore-harness.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/aws/agentcore-harness.ts b/src/cli/aws/agentcore-harness.ts index 52e7c8d47..70684f1d2 100644 --- a/src/cli/aws/agentcore-harness.ts +++ b/src/cli/aws/agentcore-harness.ts @@ -41,7 +41,7 @@ export interface HarnessAgentCoreMemoryConfiguration { arn: string; actorId?: string; messagesCount?: number; - retrievalConfig?: Record; + retrievalConfig?: Record; } export interface HarnessMemoryConfiguration {