Skip to content

Commit fc326df

Browse files
zhangfengcdtclaude
andcommitted
feat: Add LangMem integration example with branch-based memory isolation
This commit introduces a comprehensive Python example demonstrating how to use ProllyTree's versioned key-value store as a backend for LangMem's memory management system, featuring Git-like branching for AI agent memory isolation. ## New Features ### ProllyTree + LangMem Integration - **ProllyTreeLangMemStore**: Custom BaseStore implementation adapting ProllyTree's VersionedKvStore to work seamlessly with LangMem's memory management - **Full BaseStore Interface**: Complete compatibility with LangGraph's storage interface (get, put, delete, list, search, batch operations) - **Vector Embeddings**: Support for OpenAI embeddings with metadata storage - **Versioned Operations**: All memory operations create Git commits for full audit trail ### Branch-Based Memory Isolation - **WorktreeManager Integration**: Git-like branching for isolated memory contexts - **Branch Management API**: create_branch(), switch_branch(), list_branches(), merge_branch() - **Context Isolation**: Each branch maintains completely separate memory state - **Intelligent Merging**: Support for conflict resolution strategies when merging branches ### Comprehensive Example - **Graceful Degradation**: Works with or without LangMem dependencies installed - **Interactive Demo**: Shows memory storage, search, versioning, and branching - **Integration Ready**: Demonstrates LangMem memory tools and managers - **Production Patterns**: Includes error handling, logging, and best practices ## Use Cases Enabled - Multi-user memory isolation - A/B testing of AI agent behaviors - Experimental feature development - Context-aware agent systems - Parallel agent execution with memory isolation ## Files Added/Modified - `python/examples/langmem_integration.py` - Main integration example (870+ lines) - `python/examples/requirements.txt` - Added LangMem dependencies - `python/examples/run_examples.sh` - Added new `langmem` example option ## Architecture Benefits - **Versioned Memory**: Every memory operation creates a Git commit - **Branch Isolation**: Use ProllyTree branches for different memory contexts - **Cryptographic Verification**: All memory operations are Merkle-tree verified - **Efficient Storage**: ProllyTree's probabilistic tree structure for optimal performance - **Cross-Language**: Works with both Python and Rust ecosystems The implementation provides a robust foundation for persistent, versioned AI agent memories with full audit trails and Git-like workflow capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b102d55 commit fc326df

3 files changed

Lines changed: 885 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)