Microsoft Agent Framework
agent-framework-mnemoverse connects Microsoft Agent Framework (Python) agents to Mnemoverse memory. It is a Mnemoverse package, not a Microsoft one. The memory lives in your Mnemoverse account, so what an agent saves here is also there in Claude, ChatGPT, Cursor, VS Code and the other tools connected to the same account.
MnemoverseContextProviderrecalls the memories relevant to the user's latest message before every run and adds them to the run's instructions, within a time budget. If recall is slow or fails, the run goes on without memory.mnemoverse_tools()gives the agent three function tools:mnemoverse_search,mnemoverse_saveandmnemoverse_rate. Rating a recalled memory as helpful or misleading changes what comes back next for similar questions.bind_user()andbind_domain()name the memory domain a session reads and writes.
Install
pip install agent-framework-mnemoverseIt needs Python 3.11 or newer. Create an API key at console.mnemoverse.com and set it as MNEMOVERSE_API_KEY, or pass api_key=. The example below uses OpenAIChatClient, which is a separate package (pip install agent-framework-openai) and reads OPENAI_API_KEY and OPENAI_CHAT_MODEL, the name of the model; any Agent Framework chat client works the same way.
An agent with memory
import asyncio
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from mnemoverse import AsyncMnemoClient
from agent_framework_mnemoverse import MnemoverseContextProvider, bind_user, mnemoverse_tools
async def main() -> None:
client = AsyncMnemoClient() # reads MNEMOVERSE_API_KEY
agent = Agent(
client=OpenAIChatClient(), # reads OPENAI_API_KEY and OPENAI_CHAT_MODEL
instructions="You are a helpful assistant.",
context_providers=[MnemoverseContextProvider(client)],
tools=mnemoverse_tools(client),
)
session = agent.create_session()
bind_user(session, "ana") # this session reads and writes the domain user:ana
print(await agent.run("Remember that I always take the window seat.", session=session))
print(await agent.run("Which seat do I take on flights?", session=session))
await client.close()
asyncio.run(main())The provider reads once before each run. By default the agent saves only when it calls mnemoverse_save; with MnemoverseContextProvider(client, capture=True) the provider also saves the user's words after each run, up to the first 10,000 characters. Use one client, and the provider and tools built on it, in one event loop: the SDK's connection pool belongs to the loop that first used it.
One domain per user
Every call reads and writes one domain, such as user:ana. For one user, pass domain="user:ana" to the provider and to mnemoverse_tools(). In an app with several users, leave domain out and bind each session from your app's signed-in user on the server:
bind_user(session, user_id) # domain user:<user_id>; bind_domain(session, domain) names one directlyThe binding is kept in session.state, so it is saved with the session. With no domain= set, a session with no binding gets no memory, and a session bound to a domain other than a fixed domain= is refused rather than reading one user's memory and writing another's. A domain separates how memory is used, not who may read it: the API key reads every domain of its account, so give each app its own key (what one key shares).
Limits and cost
Each tool call is one API call, and the provider makes at most one read per run, plus one write per run with capture=True. Reads, writes and ratings count together against your plan's daily query limit (pricing). Recall reads the last 5,000 characters of the message, and the save tool refuses a memory over 10,000 characters, before any request. Settings, error handling and every option are in the package README.
Tested
Version 0.1.0 is tested with fake SDK clients and a scripted chat client that the real Agent drives, with mnemoverse 0.5.2 and agent-framework-core 1.26.0 on Python 3.11 to 3.13, and with the lowest supported agent-framework-core, 1.25.0, on Python 3.11. It has not been run against the live API yet.
Related
agent-framework-mnemoverseon GitHub: settings, errors, compatibility- Agent frameworks: Agent Framework through the MCP server, without the package
- Python SDK
- Agent memory: when to recall and what to save