Skip to main content

agent-framework-recallic: Recallic memory for Microsoft Agent Framework

Website: recallic.com

Long-term memory for Microsoft Agent Framework agents, backed by a self-hosted Recallic server. It is a context provider.

  • No LLM calls for memory. Storing and searching use Recallic's local models.
  • Across sessions. Each run, what this user said before that bears on their latest message is recalled, whatever session it was said in.
  • Honest. When nothing answers it, the model is told there is no record instead of being handed near-misses to guess from.
  • Your data stays on your server, separated per user and per agent.

This package is Apache-2.0. The Recallic server is source-available.

Install

pip install agent-framework-recallic

It works with any Agent Framework chat client. The example below uses OpenAI (pip install agent-framework-openai).

Run Recallic (quickstart) and create a key with role service, which acts for each of your users (or use a user's own key and leave the user out):

python -m backend.tools.keys create --user my-agent-app --role service

Usage: RecallicContextProvider

import asyncio
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",
                                 mode="balanced")                  # or "cautious" / "helpful"
agent = Agent(client=OpenAIChatClient(), instructions="You are a helpful assistant.",
              context_providers=[memory])


async def main():
    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"
    print(await agent.run("Which city did I move to?", session=later))   # "Pune."

asyncio.run(main())

Before each run the provider recalls on the user's latest message. It adds the memories to the agent's instructions (your own instructions are kept), or tells the model there is no record. After the run it stores the user's messages. Recall runs once per run, not once per model call in a tool loop.

Whose memory. The provider reads the user for each run, in this order:

  1. session.state["user_id"], set by your app on the session.
  2. The run's options={"user": ...}, e.g. agent.run(text, options={"user": "alice"}). Note that Agent Framework also passes user on to the model provider as the end-user id.
  3. The user_id given to the constructor.

With none of these, a service key falls back to the key's own user, which every run would then share. So with a service key, always name the user. With a user's own key, leave all of them out.

Parameter Default What it does
api_key required A Recallic key. service acts for each user; a user key acts for itself.
base_url http://localhost:8000 Your Recallic server.
user_id None The user when the session and run name none.
agent_id agent-framework Recallic agent id; each agent reads back what it wrote (and what any agent shared).
mode server's recall.mode cautious reads with a stricter reader and declines more (more "I don't know"); helpful answers more counting, ordering and "how long between" questions.
limit 5 Memories given to the model per run.
store_user_messages True Store the user's messages after each run (after recalling).
tell_model_on_decline True When nothing answers, tell the model not to guess about the user's past.
add_tools False Also give the model recall_memory(query) and save_memory(fact) tools for this run's user.
source_id recallic The provider's source id in Agent Framework.

Notes:

  • memory.tools(user_id) returns the two tools for one user, if you want to add them to an agent yourself.
  • format_memories(recall_result) turns any Recallic recall result into the text the provider gives the model.
  • Only the user's messages are stored, not the model's replies.
  • Needs Recallic server 0.2.5 or newer. Tested with agent-framework-core 1.26.0.

Tests

Against a running Recallic: RECALLIC_URL=http://127.0.0.1:8000 RECALLIC_SERVICE_KEY=rx_... pytest tests. They run a real Agent with a scripted chat client, including its tool loop.

Licence: Apache-2.0.

Metadata

Release files for agent-framework-recallic 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-framework-recallic 0.1.0
File Size Uploaded Provenance Actions
agent_framework_recallic-0.1.0.tar.gz 11.0 kB Without provenance Details for agent_framework_recallic-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-framework-recallic 0.1.0
File Interpreter ABI Platform Actions
agent_framework_recallic-0.1.0-py3-none-any.whl Python 3 none any Details for agent_framework_recallic-0.1.0-py3-none-any.whl

Total release size: 21.6 kB

Release files / agent_framework_recallic-0.1.0.tar.gz

Download URL agent_framework_recallic-0.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
60d6bbec1d2daece808e44e69283f34c6bfbede8e8be1aba86309a01f0bf6de1
BLAKE2b-256 checksum
How to use checksums
a8ceb2b588896ff0a7d3d3ce84dd49066343641ae5a459d5c013fab7253d32ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / agent_framework_recallic-0.1.0-py3-none-any.whl

Download URL agent_framework_recallic-0.1.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c059615624eb484400628c64f9027a30a8da437e21fa1818ae49c4b78569d592
BLAKE2b-256 checksum
How to use checksums
05a11a7875a7cd57fcaf0abf87e19e4ba2e848fb59fb3c0e83dc6611a15f2fd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for agent-framework-recallic 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page