Skip to main content
Microsoft’s Agent Framework is a Python framework for building AI agents with tools, handoffs, and context providers. Supermemory integrates natively as a context provider, tool set, or middleware — so your agents remember users across sessions.

What you can do

  • Automatically inject user memories before every agent run (context provider)
  • Give agents tools to search and store memories on their own
  • Intercept chat requests to add memory context via middleware
  • Combine all three for maximum flexibility

Setup

Install the package:
Or with uv:
The --pre / --prerelease=allow flag is required because agent-framework-core depends on pre-release versions of Azure packages.
Set up your environment:
Get your Supermemory API key from console.supermemory.ai.

Connection

All integration points share a single AgentSupermemory connection. This ensures the same API client, container tag, and conversation ID are used across middleware, tools, and context providers.

Connection options

Pass this connection to any integration:

The most idiomatic integration. Follows the same pattern as Agent Framework’s built-in Mem0 provider — memories are automatically fetched before the LLM runs and conversations can be stored afterward.

How it works

  1. before_run() — Searches Supermemory for the user’s profile and relevant memories, then injects them into the session context as additional instructions
  2. after_run() — If store_conversations=True, saves the conversation to Supermemory so future sessions have more context

Configuration options


Memory tools

Give agents explicit control over memory operations. The agent decides when to search or store information.

Available tools

The agent gets three tools:
  • search_memories — Search for relevant memories by query
  • add_memory — Store new information for later recall
  • get_profile — Fetch the user’s full profile (static + dynamic facts)

Chat middleware

Intercept chat requests to automatically inject memory context. Useful when you want memory injection without the session-based context provider pattern.

Memory modes


Example: support agent with memory

A support agent that remembers customers across sessions:

Error handling

The package provides specific exception types:

User profiles

How automatic profiling works

Search

Filtering and search modes

OpenAI Agents SDK

Memory for OpenAI Agents SDK

LangChain

Memory for LangChain apps