Repository navigation
feat(pydantic-ai): HindsightMemory capability and Pydantic AI 2.x support - #7202
Merged
Merged
Conversation
…t, docs - HindsightMemory: one Pydantic AI capability that adds the memory tools and auto-recalled memories, configured once (bank, client, tags, budget) - Floor pydantic-ai-slim at 1.71.0 (first release with capabilities) - CI runs the tests on the locked 1.x, the 1.71.0 floor and 2.x - Tests that run a real Agent with TestModel - Docs: capability as the main example, Pydantic AI in the Frameworks & SDKs sidebar preview, fixed gallery description Closes #7161
Review fixes: - HindsightMemory resolves recall_tags from configure() once, so the recall tool and auto-recall filter the same way (memory_instructions never read the global config); test added - Comment why it builds on AbstractCapability and sets id directly - recall_tags docstring names the configure() fallback
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.
Closes #7161
What changes
One object for memory.
HindsightMemoryis a Pydantic AI capability: it gives the agent the memory tools and, on every run, recalls relevant memories into its instructions. Bank, client, tags and budget are set once and used by both.Flags pick what it adds:
retain,recall,reflect(tools) andauto_recall(instructions).create_hindsight_toolsandmemory_instructionsare unchanged; the capability is built from them.Pydantic AI 2.x. The code already worked on 2.x, but nothing tested it. CI now runs the tests on the locked 1.x, on the new floor 1.71.0, and on 2.x. New tests run a real
Agentwith Pydantic AI'sTestModel(no network), so a Pydantic AI change that breaks the wiring fails CI.The floor moves from 1.0.0 to 1.71.0, the first release with capabilities. Built on
AbstractCapabilityrather than the newerCapabilityhelper, which only exists after 1.100.Docs. The capability is the main example on the integration page and README. Pydantic AI joins the "Frameworks & SDKs" sidebar preview, and the gallery card no longer says "dependency injection".
Not in this PR
bank_idtaken from the run context (one agent, many users) — add when someone needs it.hindsight-cookbookrepo; it changes there.