supermemory/apps/docs
Dhravya 984297b62d
Add Supermemory integration for Microsoft Agent Framework (#775)
## Summary

This PR introduces comprehensive Supermemory integration for the Microsoft Agent Framework, providing three complementary approaches to add persistent memory capabilities to agents: middleware for automatic memory injection, context providers for session-based memory management, and tools for explicit memory operations.

## Key Changes

- **SupermemoryChatMiddleware**: Automatic memory injection middleware that fetches relevant memories from Supermemory before LLM calls and optionally saves conversations. Supports three modes:
  - `"profile"`: Injects all static and dynamic profile memories
  - `"query"`: Searches for memories relevant to the current user message
  - `"full"`: Combines both profile and query modes

- **SupermemoryContextProvider**: Idiomatic context provider following the Agent Framework pattern (similar to built-in Mem0 integration). Integrates with the session pipeline via `before_run()` and `after_run()` hooks for automatic memory retrieval and storage.

- **SupermemoryTools**: FunctionTool-compatible tools that agents can use for explicit memory operations:
  - `search_memories()`: Search for specific memories
  - `add_memory()`: Add new memories
  - `get_profile()`: Retrieve user profile

- **Utility Functions**: Helper functions for:
  - Memory deduplication across static, dynamic, and search result sources
  - Profile-to-markdown conversion for LLM consumption
  - Message extraction and conversation formatting
  - Logging with configurable verbosity

- **Exception Hierarchy**: Custom exceptions for better error handling:
  - `SupermemoryConfigurationError`: Missing/invalid configuration
  - `SupermemoryAPIError`: API request failures
  - `SupermemoryNetworkError`: Network connectivity issues
  - `SupermemoryMemoryOperationError`: Memory operation failures

- **Comprehensive Documentation**: README with quick start examples, configuration options, and API reference for all three integration approaches.

- **Test Suite**: Unit tests covering middleware, context provider, tools, and utility functions with proper mocking and error scenarios.

## Implementation Details

- Supports both async (aiohttp) and sync (requests) HTTP clients with automatic fallback
- Handles multiple message formats (dict, objects with attributes, content arrays)
- Configurable memory storage with optional conversation grouping via `conversation_id`
- Environment variable fallback for API key configuration (`SUPERMEMORY_API_KEY`)
- Background task management for non-blocking memory operations in middleware
- Proper async/sync compatibility for the Supermemory SDK

https://claude.ai/code/session_012idB5y6UGK3zmeFULgTc4z
2026-03-10 01:49:45 +00:00
..
.cursor/rules migrate docs to public 2025-09-28 16:42:06 -07:00
add-memories docs changes (#678) 2026-01-18 16:55:32 -08:00
ai-sdk docs changes (#678) 2026-01-18 16:55:32 -08:00
changelog Document MCP context prompt feature (#661) 2026-01-12 21:51:51 +00:00
concepts docs: add entity context documentation and fix MDX parsing (#723) 2026-02-03 22:53:21 +00:00
connectors docs: gmail connector (#690) 2026-01-22 07:52:15 +00:00
cookbook docs changes (#678) 2026-01-18 16:55:32 -08:00
deployment migrate docs to public 2025-09-28 16:42:06 -07:00
images feat: adding viaSocket integration page (#757) 2026-03-02 11:37:42 -08:00
integrations Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
list-memories docs changes (#678) 2026-01-18 16:55:32 -08:00
logo migrate docs to public 2025-09-28 16:42:06 -07:00
memory-api Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
memory-graph docs changes (#678) 2026-01-18 16:55:32 -08:00
memory-router docs changes (#678) 2026-01-18 16:55:32 -08:00
memorybench icon in overview 2025-12-24 11:22:38 -08:00
migration docs changes (#678) 2026-01-18 16:55:32 -08:00
model-enhancement fix: model names 2025-10-03 02:41:49 -07:00
openai-sdks migrate docs to public 2025-09-28 16:42:06 -07:00
overview migrate docs to public 2025-09-28 16:42:06 -07:00
search docs changes (#678) 2026-01-18 16:55:32 -08:00
snippets migrate docs to public 2025-09-28 16:42:06 -07:00
supermemory-mcp docs changes (#678) 2026-01-18 16:55:32 -08:00
update-delete-memories docs changes (#678) 2026-01-18 16:55:32 -08:00
user-profiles docs changes (#678) 2026-01-18 16:55:32 -08:00
.gitignore migrate docs to public 2025-09-28 16:42:06 -07:00
add-memories.mdx docs: add entity context documentation and fix MDX parsing (#723) 2026-02-03 22:53:21 +00:00
analytics.mdx fix: all broken links 2025-10-07 17:25:39 -07:00
authentication.mdx docs: add scoped key deletion endpoint to auth docs (#756) 2026-02-28 01:06:12 +00:00
docs.json Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
document-operations.mdx docs changes (#678) 2026-01-18 16:55:32 -08:00
favicon.png migrate docs to public 2025-09-28 16:42:06 -07:00
install.md docs: add entity context documentation and fix MDX parsing (#723) 2026-02-03 22:53:21 +00:00
intro.mdx trigger: Mintlify build (#725) 2026-02-04 14:56:37 -07:00
introduction.mdx docs changes (#678) 2026-01-18 16:55:32 -08:00
memory-operations.mdx direct add memory support 2026-02-09 18:32:24 -08:00
n8n.mdx add(docs): migration guide from zep to supermemory (#612) 2025-12-20 00:47:52 +00:00
package.json update quickstart 2025-11-27 09:53:11 -07:00
quickstart.mdx docs changes (#678) 2026-01-18 16:55:32 -08:00
README.md migrate docs to public 2025-09-28 16:42:06 -07:00
search.mdx docs changes (#678) 2026-01-18 16:55:32 -08:00
style.css feat: mobile responsive, lint formats, toast, render issue fix (#688) 2026-01-21 03:11:53 +00:00
test.py docs changes (#678) 2026-01-18 16:55:32 -08:00
test.ts mastra integration (#717) 2026-02-03 00:43:08 +00:00
user-profiles.mdx docs changes (#678) 2026-01-18 16:55:32 -08:00
vibe-coding.mdx docs changes (#678) 2026-01-18 16:55:32 -08:00
zapier.mdx add(docs): migration guide from zep to supermemory (#612) 2025-12-20 00:47:52 +00:00

supermemory Docs