feat: add semanticOverride support for SEMANTIC memory strategies#696
Merged
aidandaly24 merged 1 commit intoaws:mainfrom Mar 27, 2026
Merged
Conversation
Contributor
Author
TUI ScreenshotsScreenshots captured during E2E testing of the SemanticOverride feature:
|
a42ba14 to
e692ae4
Compare
…s#678) Add SemanticOverride schema support to memory strategies, allowing users to customize extraction and consolidation behavior with custom prompts and model IDs on SEMANTIC strategy types. Changes: - Add SemanticExtractionOverrideSchema, SemanticConsolidationOverrideSchema, and SemanticOverrideSchema with at-least-one validation - Add cross-field validation rejecting semanticOverride on non-SEMANTIC types - Export new schemas and types through barrel files - Update LLM-compacted types with semanticOverride interface - Add 13 new unit tests for override validation - Add 2 integration tests for agentcore-project validation Constraint: semanticOverride only valid on SEMANTIC strategy type Constraint: At least one of extraction or consolidation must be provided Rejected: Allow override on all strategy types | CFn only supports it on SEMANTIC Confidence: high Scope-risk: narrow
e692ae4 to
911f3e9
Compare
jesseturner21
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
semanticOverridesupport for SEMANTIC memory strategies, allowing users to customize extraction and consolidation behavior with custom prompts and model IDs.Changes
SemanticExtractionOverrideSchema,SemanticConsolidationOverrideSchema, andSemanticOverrideSchemawith Zod validation.refine()rejectssemanticOverrideon non-SEMANTIC strategy types with a clear error messageprimitives/index.ts,agentcore-project.tsfor new schema/type exportsagentcore.tsinterface withsemanticOverridefieldSchema Structure
{ "strategies": [{ "type": "SEMANTIC", "namespaces": ["/users/{actorId}/facts"], "semanticOverride": { "extraction": { "appendToPrompt": "Extract key facts about the user", "modelId": "anthropic.claude-3-sonnet-20240229-v1:0" }, "consolidation": { "appendToPrompt": "Consolidate user memories", "modelId": "anthropic.claude-3-haiku-20240307-v1:0" } } }] }TUI Screenshots
Validation — pass and fail:

agentcore.json with semanticOverride config:

Synthesized CloudFormation template with SemanticOverride:

All memory unit tests passing (vitest):

Service-Side Note
The CloudFormation resource
AWS::BedrockAgentCore::Memoryin us-east-1 does not yet includeSemanticOverridein its schema. The CLI schema validation and CDK template generation are correct — deployments with overrides will succeed once the service-side schema is updated. Backward compatibility (SEMANTIC without override) is confirmed working.Related Issue
Closes #678
Documentation PR
N/A — pending service-side schema availability
Type of Change
Testing
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsTest Coverage
Checklist
Dependent CDK PR: aws/agentcore-l3-cdk-constructs#120 (companion PR with addPropertyOverride implementation)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.