Skip to main content

Amazon Bedrock AgentCore Runtime + Memanto

AWS AWS Amazon Bedrock AgentCore Runtime sessions are ephemeral — they terminate on inactivity and reprovision fresh environments. The memanto-agentcore package adds durable memory keyed to stable user identity (not runtimeSessionId), using the same recall → execute → retain loop as other Memanto framework adapters.

Cross-session recall

before_turn() runs semantic recall before your Bedrock call so a new runtime session still sees prior context.

Automatic retention

after_turn() stores each turn to Memanto (async by default so responses are not blocked).

Stable identity

Memory is scoped to tenant + user_id + agent_name — never to ephemeral sessionId.

Fail-open recall

If Memanto is unavailable, recall returns empty context and your agent continues.

How It Works

Memanto does not replace AgentCore or Bedrock. You deploy your handler on AgentCore Runtime; the adapter only wraps each turn with memory I/O against Moorcheh. Default Memanto agent id (memory namespace):
Only [A-Za-z0-9_-] are allowed in Memanto agent ids. The readable form above is used only when it maps back to exactly one (tenant_id, user_id, agent_name): every part already fits that charset, and the -user- / -agent- delimiters each appear exactly once. Any other identity (emails, dotted or non-Latin usernames, parts that contain a delimiter, or ids longer than 64 characters) maps to a 64-character SHA-256 hex id of the three parts instead, so two different identities never share a namespace. Without a tenant, the tenant part is default.
Upgrading from 0.1.0: earlier versions rewrote unsupported characters to _, so different users could resolve to the same agent id (for example john.doe@acme.com and john_doe@acme.com). Identities like these now get their own hashed agent id and start with empty memory. Their old agent is not adopted automatically, because it may hold memories from more than one person. Ids that were already unambiguous (e.g. tenant-acme-user-u42-agent-support, UUID user ids) are unchanged.

Prerequisites

  • Python 3.10+
  • Memanto and a Moorcheh API key (or on-prem Memanto backend configured)
  • An AgentCore Runtime handler that receives a trusted userId (JWT, AgentCore identity header, or server-side auth — never client-supplied)
  • AWS credentials and permissions for deploying and invoking AgentCore separately from Memanto

Install

1

Install the adapter

This pulls in memanto automatically (PyPI dependency). Add pip install memanto only if you want to upgrade the core package independently of the adapter.
2

Configure Moorcheh

Or run memanto once to write ~/.memanto/.env. On-prem users: memanto config backend on-prem and set the Moorcheh URL per on-prem docs.

Wrap your handler

Lower-level hooks

Identity rules

Never use runtimeSessionId as the Memanto agent id. Sessions expire; memory must survive session churn.
Preferred identity sources:
  1. Validated user ID from AgentCore JWT/OAuth (sub)
  2. X-Amzn-Bedrock-AgentCore-Runtime-User-Id header
  3. Application-supplied user ID in trusted server-side deployments
Custom namespace resolution:
If user_id is missing, the default resolver raises AgentResolutionError (fail closed).

Verify cross-session memory

Manual checklist (no AWS required for the Memanto side):
  1. Run one turn for a test user and store a preference via after_turn or run_turn.
  2. Use a new runtimeSessionId for the same userId.
  3. Call before_turn — recalled context should include the stored detail.
  4. Repeat with a second user — they must not see the first user’s memory.
From the Memanto repo you can run the automated smoke script:
CI publishes the adapter when you tag integrations/agentcore/vX.Y.Z on the memanto repository.

Shared memory across integrations

All Memanto integration packages use the same Moorcheh-backed agents when they share an agent_id:

Next Steps