feat(memory): add MemoryCapability with SQLite backend#263
Open
mustafabozkaya wants to merge 5 commits into
Open
feat(memory): add MemoryCapability with SQLite backend#263mustafabozkaya wants to merge 5 commits into
mustafabozkaya wants to merge 5 commits into
Conversation
added 5 commits
May 31, 2026 12:10
Add persistent memory capability for Pydantic AI agents. This capability provides five tools: memory_store, memory_retrieve, memory_list, memory_delete, and memory_compact. Key features: - SQLite backend with FTS5 full-text search - AbstractMemoryBackend interface for custom storage engines - Tag-based filtering and glob pattern matching - Access tracking and automatic compaction - 18 tests covering models, backend, and edge cases Implements: pydantic#179 (Persistent key-value memory)
Add guardrails capability for Pydantic AI agents. This capability provides input and output validation using callable guards. Key features: - InputGuard: validate prompts before model requests - OutputGuard: validate outputs after model processing - GuardResult: fine-grained control (allow, block, replace, retry) - llm_input_guard/llm_output_guard: factory helpers for LLM-based classification - Fail-open on LLM errors (safe default) - 20 tests covering primitives, integration, and LLM guards Implements: pydantic#248 (prepackaged LLM guardrails)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add persistent memory capability for Pydantic AI agents. This is the first implementation of the Persistent key-value memory feature request.
What This Adds
New Capability: MemoryCapability
Provides five tools for persistent memory management:
memory_store— Save information with key, value, tags, and metadatamemory_retrieve— Full-text search across stored memories (FTS5)memory_list— List entries with glob pattern and tag filteringmemory_delete— Remove an entry by keymemory_compact— Clean up old, rarely-accessed entriesArchitecture
The implementation follows the established CodeMode capability pattern:
_abstract.py— AbstractMemoryBackend interface for custom backends_capability.py— MemoryCapability (AbstractCapability subclass)_models.py— Pydantic models (MemoryEntry, input schemas)_sqlite.py— SQLiteMemoryBackend (default backend with FTS5)_toolset.py— MemoryToolset (tool implementations)Key Features
Usage
Checklist
Closes #179