feat(guardrails): add InputGuard, OutputGuard, and LLM-based guardrails#264
Closed
mustafabozkaya wants to merge 6 commits into
Closed
feat(guardrails): add InputGuard, OutputGuard, and LLM-based guardrails#264mustafabozkaya wants to merge 6 commits into
mustafabozkaya wants to merge 6 commits into
Conversation
added 6 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)
Member
|
We have a PR open for this already, please put your thoughts there #249 |
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 guardrails capability for Pydantic AI agents. This implements Issue #248 — prepackaged LLM guardrails.
What This Adds
New Capability: Guardrails
Two capabilities for input and output validation:
InputGuard— validates prompts before model requestsOutputGuard— validates outputs after model processingGuard Outcomes
allow()block(message)replace(value)retry(message)LLM-Based Guardrails
Factory helpers for LLM-powered classification:
Key Features
Files
Tests
20 tests passing:
Closes #248