{"id":14412,"library":"agent-framework-mem0","title":"Mem0 Integration for Microsoft Agent Framework","description":"The `agent-framework-mem0` library provides a robust integration for Mem0, a memory framework for AI agents, with the Microsoft Agent Framework. It enables agents built on Microsoft's framework to leverage Mem0's stateful, long-term, and short-term memory capabilities, enhancing agent context and decision-making. As of the current version `1.0.0b260409`, the library is in beta, indicating active development and potential for rapid evolution. Its release cadence involves frequent beta updates.","status":"active","version":"1.0.0b260409","language":"en","source_language":"en","source_url":"https://github.com/microsoft/agent-framework-mem0","tags":["agent-framework","mem0","ai","memory","agents","microsoft"],"install":[{"cmd":"pip install agent-framework-mem0","lang":"bash","label":"Install latest beta"}],"dependencies":[{"reason":"Core memory functionality provided by Mem0.","package":"mem0","optional":false},{"reason":"Underlying agent framework for integration.","package":"microsoft-agent-framework","optional":false}],"imports":[{"symbol":"Mem0Memory","correct":"from agent_framework_mem0.memories import Mem0Memory"}],"quickstart":{"code":"import asyncio\nimport os\nfrom agent_framework_mem0.memories import Mem0Memory\n\nasync def main():\n    mem0_api_key = os.environ.get(\"MEM0_API_KEY\", \"\")\n    if not mem0_api_key:\n        print(\"Please set the MEM0_API_KEY environment variable. You can get one from mem0.ai\")\n        return\n\n    memory = Mem0Memory(mem0_api_key=mem0_api_key)\n\n    # Example usage: Add and retrieve memory\n    await memory.add(user_id=\"test_user\", text=\"I like pizza.\")\n    print(\"Added memory: 'I like pizza.'\")\n\n    retrieved_memory = await memory.get(user_id=\"test_user\", query=\"What do I like?\")\n    print(f\"Retrieved memory for 'What do I like?': {retrieved_memory}\")\n\n    await memory.add(user_id=\"test_user\", text=\"My favorite color is blue.\")\n    print(\"Added memory: 'My favorite color is blue.'\")\n\n    retrieved_memory_2 = await memory.get(user_id=\"test_user\", query=\"What is my favorite color?\")\n    print(f\"Retrieved memory for 'What is my favorite color?': {retrieved_memory_2}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to initialize `Mem0Memory` and interact with it using asynchronous calls. It requires the `MEM0_API_KEY` environment variable for authentication with the Mem0 service. The example shows adding memories and then retrieving them based on a query for a specific user ID."},"warnings":[{"fix":"Pin your dependency to specific patch versions during development and review breaking changes before updating. Consult the official GitHub repository for the latest documentation.","message":"As a beta library, API interfaces, configuration options, and internal implementations are subject to frequent breaking changes without prior notice. Always check the latest GitHub README and changelog.","severity":"breaking","affected_versions":"All 1.x.x beta versions"},{"fix":"Ensure `os.environ['MEM0_API_KEY']` is set before running your application, or pass `mem0_api_key='YOUR_KEY'` to the `Mem0Memory` constructor.","message":"Authentication requires a `MEM0_API_KEY` which must be provided either directly during initialization or via the `MEM0_API_KEY` environment variable. Forgetting this will lead to authentication errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `await` when calling `Mem0Memory` methods and ensure your application's entry point correctly uses `asyncio.run()` or integrates into an existing asynchronous framework.","message":"The library primarily exposes an asynchronous API. All interactions with `Mem0Memory` methods (e.g., `add`, `get`) must be `await`-ed within an `async` function and run using `asyncio.run()` or similar asynchronous event loop management.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use a dedicated virtual environment. If conflicts arise, consider using tools like `pipdeptree` or `poetry` to inspect and resolve dependency conflicts. Refer to the `pyproject.toml` or `setup.py` on GitHub for exact dependency requirements.","message":"The library typically pins specific versions of its core dependencies (`mem0` and `microsoft-agent-framework`). This can lead to dependency conflicts if other libraries in your project require different versions of these same packages.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[],"ecosystem":"pypi"}