Add zep-pydantic-ai integration#523
Conversation
4195502 to
8044f5d
Compare
Zep memory for Pydantic AI (Python) via the current capabilities API. - capabilities=[ProcessHistory(zep_history_processor)] (async) persists the latest user turn and prepends Zep's Context Block; guards the once-per-model- request re-invocation by deduping on the latest user content. - ZepDeps (deps_type) for per-run client/user/thread; create_zep_search_tool over graph.search; persist_run helper for result.new_messages(). - Depends on pydantic-ai>=1.107,<2 and zep-cloud>=3.23.0. Python >=3.11. - README, SETUP, example, 57 mock tests, Makefile, CHANGELOG. CI filter added. Verified: ruff + ruff format + mypy + pytest (57 passed); live example smoke test passed. See integrations/SPIKE_FINDINGS.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…in zep-pydantic-ai - Set MAX_MESSAGE_CHARS to 4000 (Zep rejects messages >4096) and truncate the user turn on the history-processor hot path before add_messages; warn with lengths only (no content/PII) via a shared truncate_message_content helper. - Re-scope turn dedupe to the RunContext.run_id (falling back to user/thread) so identical consecutive runs each persist; replace the unbounded module-global cache with a bounded, lock-guarded LRU. - graph.search: clamp limit to <=50 and omit reranker when scope="auto" (Zep rejects node_distance/episode_mentions there). - Add 'observations' and 'thread_summaries' to the Scope literal (zep-cloud 3.23). - Add regression tests for each fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b175f1d to
bb12c33
Compare
Code review1 issue found. Bug:
|
_format_results advertised the "observations" and "thread_summaries" scopes (in the Scope literal and docstring) but had no rendering branch for them, so those scopes always returned "No results found." regardless of API results. Add rendering branches using the correct zep_cloud types: - observations -> DerivedNode.name (+ optional summary) - thread_summaries -> GraphitiSagaNode.summary (falling back to name) Add unit tests asserting both scopes render their items. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds the
zep-pydantic-aipackage (integrations/pydantic-ai/python) — Zep memory for Pydantic AI.Hook (verified against installed
pydantic-ai1.107.0)Built on the current API
capabilities=[ProcessHistory(zep_history_processor)](not the deprecatedhistory_processors=kwarg). The async processor persists the latest user turn viathread.add_messages(return_context=True)and prepends Zep's Context Block; it dedupes on the latest user content to avoid re-persisting on the once-per-model-request re-invocation in tool-calling runs.ZepDeps(viadeps_type) carries the client/user/thread;create_zep_search_toolexposesgraph.search;persist_runwritesresult.new_messages().Deps
pydantic-ai>=1.107,<2,zep-cloud>=3.23.0. Python ≥3.11.Ships
README, SETUP.md (Zep signup), example, 57 mock tests, Makefile, CHANGELOG.
Validation
ruff + ruff format + mypy + pytest (57 passed); live example smoke test passed. Approach in
integrations/SPIKE_FINDINGS.md.🤖 Generated with Claude Code