Pydantic AI

Long-term memory for Pydantic AI agents

A Pydantic AI capability. Each run it recalls what this user said before that bears on their prompt, then stores the prompt. The user comes from the run's deps.

pip install recallic-pydantic-ai

Python
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")
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
agent.run_sync("Which city did I move to?", deps="alice").output   # "Pune."
  • Recalled memories go in before the prompt as data written by the user, not as instructions, as Pydantic AI recommends for memory.
  • When nothing answers, the model is told there is no record instead of guessing.
  • Optional recall_memory and save_memory tools, also available on their own with recallic_toolset().
  • Works with agent specs. Tested with Pydantic AI 2.77 using its test models.

Settings

user_id
Default
None
What it does
the user when the run's deps name none
agent_id
Default
pydantic-ai
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
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.