Build memory-aware AI agents with Agentic Retrieve on Amazon Bedrock Managed Knowledge Base

In one sentence

AWS demonstrates how to build multi-user AI agents with long-term memory and document access control using Amazon Bedrock Managed Knowledge Base and AgentCore memory.

Key points

  • By adding memoryConfiguration to AgenticRetrieveStream requests, the service automatically handles conversation storage, fact extraction, and long-term memory retrieval.
  • Combined with userContext and access control lists (ACLs), the knowledge base ensures each user only retrieves documents they are authorized to read.
  • The sample solution uses email and sub claims from Amazon Cognito tokens to enforce document ACL filtering and isolate user memory namespaces.
  • By configuring AWS IAM condition policies, the system enforces per-user memory isolation at the infrastructure level even if application code fails.

In depth

An AI-written overview of the original article, not the article itself.

The AWS Machine Learning Blog explains how to build memory-aware, multi-tenant AI agents using AgenticRetrieveStream on Amazon Bedrock Managed Knowledge Base and Amazon Bedrock AgentCore memory. By passing user identity and memory settings in a single API call, applications can deliver personalized, cited answers while strictly enforcing document access controls.

How the integration works

Previously, developers had to manually store conversations, extract user facts, and inject them into search requests. According to the post, adding memoryConfiguration and userContext to AgenticRetrieveStream delegates these tasks to the managed service.

Within one call, Managed Knowledge Base restores short-term conversation history, lets the planner retrieve relevant long-term facts, searches the knowledge base with access control list (ACL) filtering, and saves the new turn. The application only needs to authenticate users and pass their identity.

Identity mapping and memory design

The post illustrates this with a fictional company assistant using Amazon Cognito. Verified ID tokens provide two distinct claims: email is passed to userContext.userId for knowledge base ACLs, while the immutable sub claim serves as the memory actorId. Using sub prevents a reassigned email from inheriting another person's memory.

A single shared AgentCore memory resource isolates users via namespace templates like /anycompany/sub. The post recommends combining two extraction strategies: summary for capturing incidental facts and user-preference for recording formatting or workflow preferences.

Document ACLs and IAM isolation

For document security, the example stores files in Amazon S3 alongside a global ACL file mapping folders to allowed emails, though the same model works with connectors like Microsoft SharePoint and Google Drive. To guarantee memory isolation even if application code fails, the backend assumes an IAM role per user with a session tag matching their sub, conditioning memory read and write permissions on this tag.

Read originalOpens aws.amazon.com

This summary was generated by AI from the original article and may contain errors; the original is authoritative. Copyright belongs to the original author.

Recent stories from this source