Amazon Bedrock AgentCore: Session Isolation Is Not Long-Term Agent Memory
Understand AgentCore runtime sessions, durable memory, tenant ownership checks, and the tests to run before shipping a multi-user AI agent.
An AI agent that remembers a conversation is useful. An agent that remembers another customer's conversation is a data incident. Amazon Bedrock AgentCore provides managed session isolation, but your application still decides which user is allowed to open which session and retrieve which memories.
This guide focuses on that boundary. It is for teams moving a single-user agent prototype into a service shared by multiple customers.
Runtime Sessions and Durable Memory Solve Different Problems
AWS documents AgentCore runtime sessions as isolated execution environments. A session can retain working state across invocations within its lifecycle. AgentCore Memory is a separate capability for retaining and retrieving context beyond that temporary execution environment.
Think of runtime state as a workbench and durable memory as a record store. Files created while solving a task may belong on the workbench. A customer preference that should survive a future session needs an intentional persistence policy.
Check the compute type and lifecycle configuration you actually deploy. Do not assume that every AgentCore compute option has identical isolation or persistence behavior.
Bind a Session to an Authenticated Owner
A session identifier is a routing value, not proof that the caller owns the session. Resolve ownership on your server before forwarding a request.
A simple application record can look like this:
{
"tenantId": "tenant-example",
"userId": "user-example",
"conversationId": "conversation-example",
"runtimeSessionId": "server-generated-session-id"
}This is an application data model, not an AgentCore API request. For each incoming message, authenticate the caller and load the conversation within that caller's tenant. Only then read the associated runtime session ID.
Do not accept a client-supplied tenant ID as authorization. A legitimate-looking identifier can still reference another customer's record.
Keep Memory Retrieval Inside the Same Boundary
Runtime isolation does not repair an overly broad database query. If a tool retrieves records without a tenant filter, the isolated agent can still receive data it should never see.
Apply ownership constraints in the storage layer or tool service. Use separate credentials where the security model calls for them, and make each retrieval auditable. Define retention and deletion behavior before storing conversation content indefinitely.
A support agent may need an order status for the current customer. It usually does not need the full historical conversation archive for every customer in the account.
Test the Failure Paths
Before rollout, create two test tenants with obviously different synthetic data. Run these checks:
- Start separate conversations and confirm ordinary follow-up works.
- Attempt to reuse the other tenant's conversation identifier.
- Start a fresh runtime session and verify that only explicitly persisted state returns.
- End or expire a session and test the application's recovery behavior.
- Delete a synthetic memory and verify retrieval no longer returns it.
The expected cross-tenant outcome is an authorization failure before agent execution. Passing only a happy-path chat test is insufficient.
Operate It Like an Application
Track session creation, failed ownership checks, tool calls, and lifecycle errors. Avoid logging raw sensitive prompts by default. Give the support team enough correlation information to investigate a failure without exposing customer content.
Start with a narrow agent workflow, a clear session owner, and an explicit persistence boundary. Managed isolation is valuable infrastructure; the application remains responsible for deciding what that isolated agent is allowed to access.
Further Reading
Sources
Today I Fixed
Short real fixes from production — posted daily
Stay ahead of the curve
Get the latest DevOps, Kubernetes, AWS, and AI/ML guides delivered straight to your inbox. No spam — just practical engineering content.
Related Articles
Build an AI Compliance Auditor with Claude API for AWS Infrastructure
Use Claude API to automatically audit AWS infrastructure for SOC 2, HIPAA, and CIS benchmark compliance — scanning IAM policies, S3 bucket configs, security groups, and CloudTrail settings with AI-generated remediation steps.
AI Agents for Zero-Trust Policy Generation: Where This Is Heading in 2026
Writing least-privilege IAM policies and NetworkPolicies by hand means either over-permissioning out of laziness or spending hours tracing what a service actually calls. AI agents that observe real traffic and generate tight zero-trust policies from it are becoming a practical alternative in 2026.
Autonomous Database Migration Planning: What AI Agents Can (and Can't) Do Safely in 2026
Database migrations are the highest-blast-radius operation in most infrastructure teams' playbook. AI agents that plan safe migration sequencing, detect risky schema changes, and generate rollback strategies are emerging — but full autonomy here has real limits worth understanding.