Microsoft Agent Framework

Long-term memory for Microsoft Agent Framework agents

A context provider. Before each run it recalls what this user said before and adds it to the agent's instructions; after the run it stores what they said.

pip install agent-framework-recallic

Python
import os
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_framework_recallic import RecallicContextProvider

memory = RecallicContextProvider(os.environ["RECALLIC_SERVICE_KEY"], base_url="http://localhost:8000")
agent = Agent(client=OpenAIChatClient(), instructions="You are a helpful assistant.",
              context_providers=[memory])

session = agent.create_session()
session.state["user_id"] = "alice"
await agent.run("I moved to Pune in March.", session=session)

later = agent.create_session()                     # days later, a new session
later.state["user_id"] = "alice"
await agent.run("Which city did I move to?", session=later)   # "Pune."
  • Recalls on the user's latest message before each run and adds the memories to the instructions; your own instructions are kept.
  • When nothing answers, the model is told there is no record instead of being handed near-misses.
  • Stores the user's messages after the run (not the model's replies). The user comes from the session state, the run, or a fixed id.
  • Optional recall_memory and save_memory tools. Tested with a real Agent run on agent-framework-core 1.26.

Settings

user_id
Default
None
What it does
the user when the session and run name none
agent_id
Default
agent-framework
What it does
Recallic agent id; each agent reads back what it wrote
mode
Default
server's
What it does
cautious, balanced or helpful
limit
Default
5
What it does
memories given to the model per run
add_tools
Default
False
What it does
also give the model recall_memory and save_memory tools

Needs a running Recallic server: set one up with Docker, or deploy it to your own Render account in one click. Nothing goes through us; your data stays on your server.