LangGraph Plugin: Memory
FloTorch LangGraph Memory services enable persistent memory capabilities for your agents, allowing them to store and retrieve information across sessions. The memory system integrates seamlessly with LangGraph’s store framework and provides long-term persistent storage for agent state and conversation history.
Important: Memory services require prior setup in the FloTorch Console. Memory capabilities are not built-in and must be explicitly configured.
Prerequisites
Section titled “Prerequisites”Before using FloTorch LangGraph Memory services, ensure you have completed the general prerequisites outlined in the LangGraph Plugin Overview, including installation and environment configuration.
Quick Setup
Section titled “Quick Setup”Store Service
Section titled “Store Service”from flotorch.langgraph.memory import FlotorchStore
# Initialize memory store (requires prior registration in FloTorch Console)memory = FlotorchStore( provider_name="your-memory-provider", api_key="your_api_key", base_url="https://gateway.flotorch.cloud", userId="user_123", appId="app_123")Configuration
Section titled “Configuration”Parameters
Section titled “Parameters”Configure your memory store with the following parameters:
FlotorchStore( provider_name: str, # Memory provider name (from FloTorch Console) - required api_key: str, # FloTorch API key for authentication (required) base_url: str, # FloTorch Gateway URL (required) userId: str, # User identifier for memory isolation (required) appId: str # Application identifier for memory isolation (required))Parameter Details:
provider_name- The name of the memory provider configured in FloTorch Consoleapi_key- Authentication key for accessing FloTorch Gateway (can be set via environment variable)base_url- FloTorch Gateway endpoint URL (can be set via environment variable)userId- User identifier for isolating memory per userappId- Application identifier for isolating memory per application
Features
Section titled “Features”BaseStore Interface
Section titled “BaseStore Interface”Fully implements LangGraph’s BaseStore interface:
- Store Operations - Supports
put,get, and search operations - State Persistence - Persists agent state and conversation history
- LangGraph Compatibility - Works seamlessly with LangGraph’s store framework
Automatic Content Management
Section titled “Automatic Content Management”Memory store provides automatic content management:
- Content Extraction - Automatically extracts content from LangGraph state
- State Persistence - Persists agent state to FloTorch Memory
- Metadata Storage - Stores conversations with associated metadata
- History Formatting - Formats history for agent context
Search Capabilities
Section titled “Search Capabilities”Provides comprehensive memory search:
- Keyword-Based Search - Performs traditional text-based searches
- User/App Filtering - Filters results by user ID and application name
- Metadata Filtering - Supports custom metadata filtering
- Date Range Queries - Allows filtering by time ranges
Usage Example
Section titled “Usage Example”Basic Memory Setup
Section titled “Basic Memory Setup”from flotorch.langgraph.agent import FlotorchLangGraphAgentfrom flotorch.langgraph.memory import FlotorchStore
# Initialize memory storememory = FlotorchStore( provider_name="your-memory-provider", api_key="your_api_key", base_url="https://gateway.flotorch.cloud", userId="user_123", appId="app_123")
# Use with agentagent_manager = FlotorchLangGraphAgent( agent_name="customer-support", store=memory, # Add memory store base_url="https://gateway.flotorch.cloud", api_key="your_api_key")
agent = agent_manager.get_agent()Store Operations
Section titled “Store Operations”from flotorch.langgraph.memory import FlotorchStore
# Initialize memory storememory = FlotorchStore( provider_name="your-memory-provider", api_key="your_api_key", base_url="https://gateway.flotorch.cloud", userId="user_123", appId="app_123")
# Store dataawait memory.aput("key", "value")
# Retrieve datavalue = await memory.aget("key")
# Search memoryresults = await memory.asearch("query")Best Practices
Section titled “Best Practices”- Memory Provider Setup - Always configure memory providers in FloTorch Console before using them in code
- User/App Isolation - Use appropriate
userIdandappIdvalues to isolate memory per user and application - Store Operations - Use store operations (
put,get,search) for managing agent state and conversation history - Error Handling - Implement proper error handling for memory operations in production environments
- Memory Cleanup - Consider implementing memory cleanup strategies for long-running applications
Next Steps
Section titled “Next Steps”- Agent Configuration - Learn how to configure agents with memory capabilities
- Session Management - Implement session persistence alongside memory
- LLM Configuration - Configure language models for your memory-enabled agents