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. Ids longer than 64 characters are replaced by a 64-character SHA-256 digest of tenant + user_id + agent_name, so they stay stable and unique.

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