Skip to content

chore: update CP semantics to expect redesigned namespaces field#1115

Open
nborges-aws wants to merge 1 commit intomainfrom
namespaceRedesignControlPlane
Open

chore: update CP semantics to expect redesigned namespaces field#1115
nborges-aws wants to merge 1 commit intomainfrom
namespaceRedesignControlPlane

Conversation

@nborges-aws
Copy link
Copy Markdown

Description

Adds support for the new namespaceTemplates control-plane field. namespaceTemplates replaces namespaces on strategy configurations with clearer naming, as strategy namespace values have always been templates resolved at ingestion time, not literal namespaces. The old namespaces field is deprecated but remains accepted for backward compatibility.

  • agentcore.json schema accepts namespaceTemplates and reflectionNamespaceTemplates on strategy definitions. Old namespaces / reflectionNamespaces still validate. Specifying both the deprecated and preferred form for the same concept is rejected.
  • Strategy creation flows (agentcore create --memory longAndShortTerm, agentcore add memory) now write namespaceTemplates / reflectionNamespaceTemplates in the generated config.
  • Response parsing (getMemoryDetail) reads either field from the service and surfaces the new name to downstream code.
  • Import flow (agentcore import memory) writes the new field names to local config regardless of which form the service returned.
  • Dev web UI resources view exposes namespaceTemplates in the API, with fallback to namespaces for legacy data.
  • JSON schema (schemas/agentcore.schema.v1.json) regenerated from Zod to include the new fields.
  • Docs (docs/memory.md, docs/configuration.md) updated to show namespaceTemplates as primary with a deprecation note for the old name.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • [ x ] Other (please describe): Deprecation of field and addition of replacement in CP methods

Testing

How have you tested the change?

  • [ x ] I ran npm run test:unit and npm run test:integ
  • [ x ] I ran npm run typecheck
  • [ x ] I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • [ x ] I have read the CONTRIBUTING document
  • [ x ] I have added any necessary tests that prove my fix is effective or my feature works
  • [ x ] I have updated the documentation accordingly
  • [ x ] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • [ x ] My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@nborges-aws nborges-aws requested a review from a team May 4, 2026 21:44
@github-actions github-actions Bot added size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress labels May 4, 2026
@nborges-aws nborges-aws force-pushed the namespaceRedesignControlPlane branch from 7300b3f to a9a683d Compare May 4, 2026 21:47
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels May 4, 2026
@agentcore-cli-automation
Copy link
Copy Markdown

Breaks memory deployment — CDK L3 constructs still expect namespaces / reflectionNamespaces

The local schema, config writers (create, add memory, import memory), and service response parser have been switched over to namespaceTemplates / reflectionNamespaceTemplates, but the CDK L3 constructs in @aws/agentcore-cdk (currently ^0.1.0-alpha.19, latest published 0.1.0-alpha.22) have not been updated. src/cdk/constructs/components/primitives/memory/AgentCoreMemory.ts in agentcore-l3-cdk-constructs still reads:

...(strategy.namespaces && { namespaces: strategy.namespaces }),
...
...(strategy.reflectionNamespaces && {
  reflectionConfiguration: { namespaces: strategy.reflectionNamespaces },
}),

and its MemoryStrategySchema only defines namespaces / reflectionNamespaces.

The deploy flow in src/assets/cdk/bin/cdk.ts passes agentcore.json straight through to AgentCoreStackAgentCoreApplication with no translation. After this PR:

  • Running agentcore create --memory longAndShortTerm followed by agentcore deploy will produce a spec whose strategy objects carry namespaceTemplates / reflectionNamespaceTemplates. The L3 construct only looks at namespaces / reflectionNamespaces, so:
    • Non-EPISODIC strategies silently deploy with no namespace scoping (and grantWithAccess / collectNamespacePatterns will also see no namespaces, so IAM grants lose their namespace conditions).
    • EPISODIC strategies will fail the service call because reflectionConfiguration is never emitted and EPISODIC requires it.
  • agentcore import memory now writes namespaceTemplates into local config, so re-deploying an imported memory has the same problem.

The Zod schema's deprecated-alias fallback doesn't help here because the CLI always writes the new field names, so by the time the L3 construct reads the spec, only namespaceTemplates is populated.

Possible fixes

  1. Land the L3 construct change first and bump the pinned version. Update agentcore-l3-cdk-constructs (schema + AgentCoreMemory, including collectNamespacePatterns / grantWithAccess) to accept namespaceTemplates / reflectionNamespaceTemplates (with fallback to the deprecated names), publish a new @aws/agentcore-cdk version, bump src/assets/cdk/package.json to that version, and merge this PR on top of that. This matches the "Any dependent changes have been merged and published" checklist item, which is currently unchecked.

  2. Keep writing the old field names in config and only translate on read. Have create/add memory/import memory continue to emit namespaces / reflectionNamespaces in agentcore.json for now, so the unchanged L3 constructs keep working. The schema can still accept namespaceTemplates as input from users, but normalize to the old name before persisting. Then flip the persisted form in a follow-up once the L3 side is updated.

  3. Add a translation layer in the vended CDK app. In src/assets/cdk/bin/cdk.ts (or a thin adapter), normalize namespaceTemplatesnamespaces on each strategy before passing spec to AgentCoreStack. This is the smallest change but leaves a hidden coupling and will need to be removed once the L3 constructs catch up.

Option 1 is cleanest; 2 or 3 are reasonable if the L3 change can't ship in lockstep.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.06% 8998 / 20894
🔵 Statements 42.34% 9555 / 22563
🔵 Functions 39.89% 1552 / 3890
🔵 Branches 39.95% 5806 / 14531
Generated in workflow #2381 for commit a9a683d by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants