AivexaNewsSearch
AI news for builders and product teamsChecked every hour

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

Collected Nov 16, 2026

Amazon Bedrock Managed Knowledge Base now works with Amazon Bedrock AgentCore memory in the Agentic Retrieve flow, letting a single AgenticRetrieveStream call restore a conversation, pull durable facts about the user from long-term memory, and use them to shape the search queries sent to the knowledge base. The capability is described in an AWS Machine Learning Blog post that walks through a multi-tenant employee assistant sample, published alongside a GitHub repository containing the running code. The integration is opt-in and backward compatible: existing calls behave as before unless the application adds a memoryConfiguration to the request.

The problem being addressed is that the context which sharpens a search usually lives outside the knowledge base. A user's role, office or product tier may have come up weeks earlier in an unrelated session, and exploiting it has traditionally meant building a conversation store, running fact extraction, deciding which facts are relevant, and injecting them into each request, all with per-user isolation. With memoryConfiguration set, AgentCore memory becomes a retrieval source next to the knowledge base. Within one call the service restores the session, the planner decides when a user fact would help, retrieves it, and composes sub-queries for the knowledge base. After generation the turn is written back to memory. With persistenceMode set to DEFAULT, the question and answer are saved to the session and long-term records are extracted asynchronously according to configured strategies.

The division of labour is explicit. Managed Knowledge Base owns ingestion, ACL filtering, indexing, ranking, planning, retrieval and generation, and with memoryConfiguration also session restore, memory search and persistence. AgentCore memory owns storage, retention, encryption and extraction. The application owns authentication, the UI, and reading the user's identity from the token. A notable consequence: there is no conversation table. When the UI lists or reopens a conversation it reads the same memory resource.

Identity is carried by two separate claims from a verified Amazon Cognito ID token, and nothing is taken from the request body, which carries only a question and an optional sessionId. The sub claim becomes the memory actorId and the namespace component bound into sessionBinding. The verified email becomes userContext.userId and drives the knowledge base's ACL filter. This split matters: the knowledge base identifies people by email because its connected data source records ACLs that way, while memory needs an actorId that is stable and never reused. Emails can be changed or reassigned to a new employee, in which case the new person would inherit the old memory — the post recommends any permanently bound user ID from your own store if not using Cognito's sub.

The sample uses an ACL-enabled Amazon S3 data source. Because S3 has no permission system to crawl, a global ACL file in the same bucket maps keyPrefix values to entries naming permitted users, for example hr/ visible to three named employees, engineering/ only to the two engineers, and sales/ only to the salesperson. The data source is created with aclEnabled set to True and a globalAccessControlListS3Uri; that flag cannot be changed after creation, data source creation is asynchronous and must reach AVAILABLE, and an ingestion job must reach COMPLETE. In the sample's run, 11 documents were scanned and indexed with no failures. A document not covered by any ACL entry is not ingested, and a user whose email matches nothing gets no results. The post notes the same model extends to connectors that read permissions from source systems such as SharePoint, Google Drive and Confluence, where the knowledge base also checks results against the source in real time.

Memory layout requires care. One memory resource serves every user, and separation comes from {actorId} placeholders in namespace templates that AgentCore resolves per event at extraction time. Two strategies serve different purposes: a summary strategy captures passing mentions such as a user's laptop or office location, which can later personalize an answer about, say, PTO; a user-preference strategy records stated preferences in structured form, such as wanting short bullet answers or always deploying to a particular region first. Because retrievalConfigs accepts only one entry, the single namespacePath must be rooted so it reaches everything the planner should see — the sample puts the actor directly under the root — whereas separate sibling namespaces for profile and summaries would each be reachable by only one entry. Setting eventExpiryDuration controls how long raw conversation events are retained (30 days in the sample), and an optional customer managed key can be supplied.

Membership needs no provisioning. Creating the memory does not require a user or actor, and a new Cognito user becomes a new actor the first time they ask a question. The Cognito pool is configured with email required, verified and immutable, since a mutable email would let a signed-in user adopt a colleague's address and inherit their document access.

The most interesting part is defence in depth at the IAM layer. The backend assumes a role once per user and tags the session with userId set to the sub. Statements for event and session operations are conditioned on bedrock-agentcore:actorId equalling the principal tag, and memory-record statements on a namespacePath condition scoped to that user's prefix. ListEvents is required when sessionBinding is used, RetrieveMemoryRecords when retrievalConfigs is used, and CreateEvent when persistence is DEFAULT; ListSessions and ListMemoryRecords support the application's own conversation-list and memory-view reads rather than the retrieve call itself. The trust policy allows sts:AssumeRole, sts:TagSession and sts:SetSourceIdentity from the backend identity, such as a Lambda execution role or an ECS task role, and a customer managed key needs kms:Decrypt.

Operationally, the walkthrough targets the US West (Oregon) region, requires Python 3.10 or later and Boto3 1.43.72 or later, and expects the memory resource to sit in the same AWS account as the knowledge base and be in the ACTIVE state. The sample's setup script provisions the bucket, user pool, roles, knowledge base and memory idempotently. Traces from AgenticRetrieveStream reveal when the planner reached into memory, which is the practical way to debug unexpected personalization.

Why it matters: teams building knowledge-grounded assistants for many users can stop maintaining their own conversation store, extraction pipeline and per-user namespace plumbing, and instead hand session state to the retrieve call while the application handles authentication and identity mapping. The likely trade-off is tighter coupling to AWS identity primitives and IAM conditions: correctness of memory isolation now depends on token claims being stable and on tags being attached reliably, so getting the actorId and namespace layout right up front — and letting IAM backstop application mistakes — becomes the critical design decision. For developers already on managed knowledge bases, this replaces an earlier step in which conversation history had to be persisted by the application itself.

Read at AWS Machine Learning Blog

Based on reporting from the original publisher. Visit the source for full context and later updates.

Publisher excerpt

Amazon Bedrock Managed Knowledge Base and Amazon Bedrock AgentCore memory now store conversations, extract facts, and bring long-term memory into a single AgenticRetrieveStream call. This post shows how to build a memory-aware, multi-user assistant where each user sees only the documents they may read and each user's memory stays private.