Microsoft has announced a new preview integration for its Microsoft Agent Framework, enabling agents to retain memory beyond the current conversation. This capability is facilitated by Azure Cosmos DB, providing durable, cross-session memory storage.
The integration is delivered through a new Python package, agent-framework-azure-cosmos-memory, which includes the CosmosMemoryContextProvider. This context provider can be attached to an agent to automatically store conversation turns, extract durable memories, and recall relevant information in subsequent interactions.
Key Points
- A new preview integration provides durable, cross-session memory for Microsoft Agent Framework agents.
- The memory is backed by Azure Cosmos DB.
- The agent-framework-azure-cosmos-memory Python package offers CosmosMemoryContextProvider.
- This provider automatically stores conversation turns, extracts durable memories, and recalls relevant facts, summaries, and user profiles.
- The integration is currently available for Python only and its APIs may change before general availability.
- CosmosMemoryContextProvider uses both pre-run and post-run lifecycle stages to manage memory.
- Azure Cosmos DB for NoSQL stores turns and derived memories, supporting vector, full-text, and hybrid retrieval.
Context
According to Microsoft, agents become more useful when they can remember information beyond a single conversation. This integration addresses that need by allowing agents to maintain context across sessions. The CosmosMemoryContextProvider fits into the framework's existing context-provider model, where a ContextProvider runs around every agent invocation, contributing information before the model runs and reacting afterward.
Why It Matters
This integration allows developers building with the Microsoft Agent Framework to implement agents with long-term memory without orchestrating a separate retrieval pipeline. It simplifies the process of creating more sophisticated and personalized agent experiences by making memory a composable part of the agent's lifecycle.
What To Do
- Install the preview integration using
pip install --pre agent-framework-azure-cosmos-memory agent-framework-foundry. - Set environment variables for COSMOS_ENDPOINT, FOUNDRY_ENDPOINT, EMBEDDING_MODEL, and CHAT_MODEL.
- Create and add the CosmosMemoryContextProvider to an agent's
context_providerscollection. - Ensure a stable
user_idis supplied to enable cross-session memory recall.
