AWS describes a proposed defense against memory poisoning in Amazon Bedrock AgentCore Memory: an AWS Lambda interceptor checks writes before they reach memory through AgentCore Gateway. The design weighs four signals and can allow, quarantine or deny a write. It covers the Gateway path; direct SDK writes can bypass it. AWS’s description of the design
Memory poisoning means placing malicious or misleading content in an agent’s persistent memory. Checking a write before it is stored can help limit that risk, but only when the write passes through the check.
What the proposed validation checks
AWS’s design places a Lambda interceptor in front of the destination memory namespace. It combines four signals into a score:
- Semantic drift (40%) compares a proposed memory with the current session context. AWS describes using Amazon Titan Text Embeddings V2 for this signal.
- Instruction patterns (25%) looks for known prompt-injection markers using pattern matching.
- Namespace boundaries (25%) checks whether the session is permitted to write to the target namespace.
- Write-rate anomalies (10%) compares a session’s write activity with a learned baseline, using a counter in Amazon DynamoDB.
The design routes each write to one of three outcomes: ALLOW lets it proceed, QUARANTINE redirects it to an isolated namespace, and DENY blocks it and sends an alert through Amazon SNS. AWS also describes Cedar policies for separating namespaces: for example, runtime agents cannot write to system/ or another user’s namespace, and only Lambda can write to quarantine/.
The check protects a write only when that write passes through the Gateway interceptor; direct SDK calls need their own validation or controls.
Which memory writes the interceptor covers
The interceptor runs before writes routed through AgentCore Gateway. AWS says a write made directly through the SDK can bypass that Gateway layer, so teams using both paths would need to account for both. AWS points to application-side validation or other controls for direct writes.
For teams assessing the sample, AWS lists AgentCore Runtime with Memory enabled, AgentCore Gateway, AgentCore Policy, Lambda, DynamoDB, SNS, access to Titan Text Embeddings V2 and AWS CDK v2 among the prerequisites. Its described deployment sequence is to deploy the CDK infrastructure, attach Lambda as the Gateway pre-write interceptor, configure Cedar namespace policies, then subscribe a security-team endpoint to SNS notifications.
There is also an availability choice if validation becomes unavailable: failurePolicy set to ALLOW permits the write to continue, while BLOCK rejects it. The first favors write availability; the second avoids accepting writes when the check cannot run.
What AWS’s demo and sample repository report
AWS reports that its demo returned the expected decision in 11 scenarios. For the demo, however, it used keyword overlap as a substitute for the semantic-similarity signal rather than Titan Text Embeddings V2. That result describes the demo’s scenarios and method, not the embedding-based signal AWS outlines for the design.
The README in the AWS Samples repository describes a nine-scenario test script and characterizes the code as an educational demonstration that needs additional security testing before production use. The blog and README also classify a composite score of 35 differently. They do not establish whether the two scenario counts refer to the same test suite.
That distinction matters when evaluating the sample: its published demo result is not a substitute for testing the implementation and write paths in the environment where it would run.