AG2 + Memanto

memanto-ag2 package registers Memanto memory tools on your AssistantAgent and UserProxyAgent so the LLM can store and retrieve durable memory through Moorcheh — the same remember → recall → answer pattern as other Memanto framework adapters.
Drop-in tools
register_memanto_tools() wires memanto_remember, memanto_recall, and memanto_answer in one call.AG2-native
Plain Python functions with
Annotated hints for register_for_llm / register_for_execution.Shared namespace
One Memanto
agent_id per team or app (like a memory bank); GroupChat agents can share it.Selective tools
Enable or disable remember, recall, or answer with
include_* flags.How It Works
Memory is scoped by
agent_id (e.g. my-ag2-team). Use the same id across chats and processes to share memory; use different ids to isolate tenants or teams.
Prerequisites
- Python 3.10+
- Memanto and a Moorcheh API key
- AG2 0.9.x for runtime chat:
pip install "ag2>=0.9,<1"(providesfrom autogen import AssistantAgent) - An LLM API key your AG2 config uses (e.g.
OPENAI_API_KEYfor OpenAI)
Install
1
Install the adapter
memanto-ag2 installs memanto for you via its package dependencies. Use pip install memanto memanto-ag2 only if you want to pin or upgrade memanto explicitly.2
Configure Moorcheh
memanto once to write ~/.memanto/.env.Register tools on your agents
GroupChat with shared memory
Register the sameagent_id on every assistant that should read or write shared memory; use one executor (UserProxyAgent) to run tool calls:
Global defaults
Verify persistence
- Run a chat that calls
memanto_remember(check AG2 logs forEXECUTING FUNCTION memanto_rememberand a Memanto memory ID). - Start a new Python process with the same
agent_id. - Ask the assistant to
memanto_recallormemanto_answer— prior facts should appear even though AG2 chat history is empty.
OPENAI_API_KEY and install ag2 for optional Step 6 (live AG2 chat).
Unit tests (no API key):
AgentCore vs AG2
Shared memory across integrations
All Memanto integration packages use the same Moorcheh-backed agents when they share anagent_id: