recallic-pydantic-ai: Recallic memory for Pydantic AI
Website: recallic.com
Long-term memory for Pydantic AI agents, backed by a self-hosted Recallic server. It is a Pydantic AI capability.
- No LLM calls for memory. Storing and searching use Recallic's local models.
- Across runs and conversations. Each run, what this user said before that bears on their prompt is recalled, whatever conversation 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 recallic-pydantic-ai
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-pydantic-app --role service
Automatic memory: RecallicMemory
import os
from pydantic_ai import Agent
from recallic_pydantic_ai import RecallicMemory
memory = RecallicMemory(os.environ["RECALLIC_SERVICE_KEY"], base_url="http://localhost:8000",
mode="balanced") # or "cautious" / "helpful"
agent = Agent("openai:gpt-5-mini", instructions="You are a helpful assistant.", deps_type=str,
capabilities=[memory])
agent.run_sync("I moved to Pune in March.", deps="alice")
# days later, a new conversation
print(agent.run_sync("Which city did I move to?", deps="alice").output) # "Pune."
At the start of each run the capability recalls on the user's prompt. It puts the memories in front of the model,
just before the prompt, as a <user_memories> block marked as written by the user. Your own instructions are kept.
When nothing answers, it adds a short instruction telling the model there is no record. Then it stores the prompt.
Recall runs once per run, not once per model request in a tool loop.
Whose memory. The user comes from the run's deps: a string is the user id, otherwise deps["user_id"] or
deps.user_id. When the deps name no user, the user_id field is used. With neither, 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.
| Parameter | Default | What it does |
|---|---|---|
api_key |
RECALLIC_API_KEY env var |
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 run's deps name none. |
agent_id |
pydantic-ai |
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 prompt each run (after recalling). |
tell_model_on_decline |
True |
When nothing answers, tell the model not to guess about the user's past. |
tools |
False |
Also give the model recall_memory(query) and save_memory(fact) tools. |
RecallicMemory has the default id recallic_memory. It also loads from an agent spec:
Agent.from_spec(spec, custom_capability_types=[RecallicMemory]), with - RecallicMemory: {mode: cautious} in
YAML and the key in RECALLIC_API_KEY.
Tools only: recallic_toolset()
When the agent should decide itself when to look things up or save them:
from recallic_pydantic_ai import recallic_toolset
tools = recallic_toolset(os.environ["RECALLIC_SERVICE_KEY"]) # recall_memory(query), save_memory(fact)
agent = Agent("openai:gpt-5-mini", deps_type=str, toolsets=[tools])
agent.run_sync("What's my sister's name?", deps="alice")
The tools read the user from the run's deps in the same way.
Notes:
- The memories and the no-record note are capability parts (
RecalledMemoriesPart,NoRecordPart), so they are kept in the run's message history and you can find them by type. format_memories(recall_result)turns any Recallic recall result into plain text, as therecall_memorytool returns it.- Only the user's prompts are stored, not the model's replies.
- Needs Recallic server 0.2.5 or newer. Tested with pydantic-ai-slim 2.77.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 FunctionModel, including its tool loop, and one with TestModel.
Licence: Apache-2.0.
Metadata
Release files for recallic-pydantic-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| recallic_pydantic_ai-0.1.0.tar.gz | 11.6 kB | Without provenance | Details for recallic_pydantic_ai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| recallic_pydantic_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for recallic_pydantic_ai-0.1.0-py3-none-any.whl |
Total release size: 22.7 kB
Release files / recallic_pydantic_ai-0.1.0.tar.gz
| Download URL | recallic_pydantic_ai-0.1.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
259d793427dee4b65c523c2ba6c775e11d1f1dfc5c7709ce93d224a3ba16bcbf
|
|
BLAKE2b-256 checksum How to use checksums |
0c4992f899cb1da8daf101604e5687539cf5f4d0b02dd5296ee76548f6dbfcfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / recallic_pydantic_ai-0.1.0-py3-none-any.whl
| Download URL | recallic_pydantic_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
140e76f5758638f90ad5c290451fe0288603a0b1dfa466f3cf42b66771637c15
|
|
BLAKE2b-256 checksum How to use checksums |
177a451f34233c57917cac0ff6d55c15ae6b8871de197fe933bfef6451ecab46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for recallic-pydantic-ai 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.