--- title: "AutoGen memory: the Memory protocol and dated recall" description: "AutoGen memory adds stored context to an AssistantAgent through the Memory protocol. Its implementations, its limits, and a tool or McpWorkbench for dated recall." canonical: https://past.dev/integrations/autogen last-updated: 2026-10-09 --- # Add memory to AutoGen agents Source: https://past.dev/integrations/autogen AutoGen memory is a protocol: a store with add, query, update_context, clear and close, attached to an AssistantAgent through its memory list. Before each reply, update_context adds the retrieved entries to the agent's model context. AutoGen is in maintenance mode, and Microsoft names Microsoft Agent Framework as its successor. A tool that calls past.dev over HTTP adds timestamped ingestion and recall that returns ranked documents with dates and source excerpts. ## AutoGen memory scope The [memory guide](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/memory.html) defines the `Memory` protocol and its implementations: `ListMemory`, a chronological list, `ChromaDBVectorMemory` and `RedisMemory`, vector stores with similarity search, and integrations with other memory services. An `AssistantAgent` takes stores in `memory=[...]`, and each store's `update_context` writes what it retrieved into the agent's model context. > **Maintenance mode** > > The [AutoGen repository](https://github.com/microsoft/autogen) states that AutoGen is in maintenance mode and receives no new features. It directs new users to Microsoft Agent Framework and links a [migration guide](https://learn.microsoft.com/en-us/agent-framework/migration-guide/from-autogen/). The [Microsoft Agent Framework guide](/integrations/microsoft-agent-framework) covers the same integration there. - **An entry is content with a MIME type.** The protocol documents no event time and no validity period for an entry. - **Retrieval depends on the store.** `ListMemory` keeps entries in the order they were added; the vector stores rank entries by similarity. - **Scope is the store you attach.** Each agent reads the stores in its `memory` list. Sharing across agents and processes depends on the backend you run. ## The integration: two function tools An `AssistantAgent` takes Python functions in `tools` and wraps each one as a tool, with the docstring as its description and the signature as its parameters ([agents tutorial](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html)). ```python import os, requests from autogen_agentchat.agents import AssistantAgent BASE = "https://api.past.dev/api/v1" HEADERS = {"Authorization": f"Bearer {os.environ['PAST_API_KEY']}"} def make_past_tools(user_id: str): """Build the memory tools for one signed-in user. The model never sees user_id.""" async def remember(text: str, happened_at: str) -> str: """Store timestamped source text, readable by the whole project, authored by the current user.""" return requests.post(f"{BASE}/ingest", headers=HEADERS, json={ "content": text, "timestamp": happened_at, "identity": user_id, }).text async def recall(question: str) -> str: """Return ranked documents with dates and source excerpts for the current user.""" return requests.post(f"{BASE}/recall", headers=HEADERS, json={ "query": question, "identity": user_id, }).text return [remember, recall] agent = AssistantAgent( name="assistant", model_client=model_client, # any AutoGen model client tools=make_past_tools("demo-user"), # the signed-in user's id system_message="Call recall before you answer questions about people, decisions or history.", ) ``` `make_past_tools` builds the two tools for one request. They close over the signed-in user's id, so the model never sees it. Build the agent for each user's request. For an agent that must read memory before every reply, a custom `Memory` implementation can call the same recall endpoint in `query` and add the documents to the model context in `update_context`. > **Identity** > > The application sets the identity. The model never chooses it. Recall returns what the identity in the request may read, so take the identity from the signed-in user in code, and keep it out of every value that the model fills. Recall returns ranked documents with dates and source excerpts. The application decides whether those documents support an answer, contain a disagreement, or are insufficient; HTTP failures are handled separately. ## Or connect the MCP server `McpWorkbench` with `StreamableHttpServerParams` from `autogen_ext.tools.mcp` connects to a remote server over Streamable HTTP, and an `AssistantAgent` takes the workbench through `workbench=` ([MCP tools reference](https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.tools.mcp.html)). The project's end-user MCP server then gives the agent `recall`, `answer` and `who_am_i`, plus `remember` while the project's write toggle is on, with no tool code to write. 1. Turn on the project's end-user MCP server on **Build › MCP server** in the console. 2. Mint an access link there, or with the account server's `create_mcp_access_link` tool. The link has the form `https://api.past.dev/mcp//link/`. It is one URL that is one identity, and the server answers it with no sign-in step. 3. Keep the link in a secret store, such as the `PAST_MCP_URL` environment variable that the code below reads. The secret in its path is the credential. ```python import asyncio, os from autogen_agentchat.agents import AssistantAgent from autogen_ext.tools.mcp import McpWorkbench, StreamableHttpServerParams async def main(): params = StreamableHttpServerParams(url=os.environ["PAST_MCP_URL"]) async with McpWorkbench(server_params=params) as past: agent = AssistantAgent( "assistant", model_client=model_client, # any AutoGen model client workbench=past, ) result = await agent.run(task="What did we decide about the Q4 budget?") print(result.messages[-1].content) asyncio.run(main()) ``` Every call through the link runs as its identity, with that identity's audiences. Mint one link per install, so that a revoked link stops one agent only. When the agent serves several people, mint one link per end user, and connect each request with the link of the user who makes it. Never share one link between users. `remember` writes to the identity's own private audience, and only that identity recalls it. Send data that the whole project must recall through the ingest call. The [end-user server documentation](/docs/mcp/serving-your-own-users) describes the tools, the links and revocation. ## When to use which - Context that one agent reads before each reply, in one process: `ListMemory` or a vector memory store. - Timestamped source history with stable source ids, identity-scoped recall and dated source excerpts, shared across agents and applications: the tools or the MCP server above. - A new project: Microsoft Agent Framework, with the same tools. The [quickstart](/docs/memory-api/quickstart) shows how to ingest, wait until ingestion completes, and recall. The [benchmarks](/benchmarks) document how recall is measured. [Long-term memory](/glossary/long-term-memory) defines the layer the tools add. ## Frequently asked questions ### Does AutoGen have long-term memory? AgentChat defines a Memory protocol with list and vector implementations and integrations with other memory services. A store attached to an AssistantAgent adds retrieved entries to its model context before each reply. ### Should a new project use AutoGen? The AutoGen repository directs new users to Microsoft Agent Framework, because AutoGen is in maintenance mode. The past.dev tools and MCP server work in both. ## Related - [Memory for Microsoft Agent Framework](https://past.dev/integrations/microsoft-agent-framework) - [Memory for CrewAI](https://past.dev/integrations/crewai) - [Memory for LangGraph](https://past.dev/integrations/langgraph) - [Long-term memory](https://past.dev/glossary/long-term-memory) - [Quickstart](https://past.dev/docs/memory-api/quickstart)