agents.memory_v2.react_memory_coordinator¶
ReactAgent Memory Coordinator with Tool Integration.
This implements the ReactAgent version with memory tools as requested: - Uses ReactAgent for reasoning and planning - Integrates LongTermMemoryAgent as a tool - Provides memory search, storage, and analysis capabilities - Follows the “get into the react version with the tools” directive
Architecture: - ReactAgent with memory tools for reasoning about memory operations - LongTermMemoryAgent tool for persistent memory operations - ConversationMemoryAgent tool for conversation context - Memory analysis and coordination through ReactAgent reasoning
Classes¶
Configuration for ReactMemoryCoordinator. |
|
ReactAgent-based memory coordinator with tool integration. |
Functions¶
Demo ReactAgent memory coordinator functionality. |
Module Contents¶
- class agents.memory_v2.react_memory_coordinator.MemoryCoordinatorConfig(/, **data)¶
Bases:
pydantic.BaseModel
Configuration for ReactMemoryCoordinator.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.memory_v2.react_memory_coordinator.ReactMemoryCoordinator(user_id, config=None, name='react_memory_coordinator')¶
ReactAgent-based memory coordinator with tool integration.
This implements the ReactAgent pattern for memory coordination: 1. Uses ReactAgent for reasoning about memory operations 2. Provides memory tools for search, storage, and analysis 3. Coordinates between different memory types 4. Enables complex memory reasoning and planning
Key Features: - ReactAgent with memory tools for reasoning - Long-term memory search and storage - Conversation memory retrieval - Memory analysis and insights - Cross-memory coordination
Examples
Basic usage:
coordinator = ReactMemoryCoordinator(user_id="user123") await coordinator.initialize() # Memory-enhanced conversation with reasoning response = await coordinator.run( "What do you remember about my work preferences and how should I schedule my week?" )
With custom LLM config:
config = MemoryCoordinatorConfig( llm_config=AzureLLMConfig(deployment_name="gpt-4"), temperature=0.3 # Lower temp for more focused reasoning ) coordinator = ReactMemoryCoordinator( user_id="user123", config=config)
Initialize ReactMemoryCoordinator.
- Parameters:
user_id (str)
config (MemoryCoordinatorConfig | None)
name (str)
- async add_conversation_batch(messages)¶
Add a batch of conversation messages to memory.
- classmethod create(user_id, llm_config=None, enable_all_memory=True, name='react_memory_coordinator')¶
Factory method to create ReactMemoryCoordinator.
- Parameters:
- Return type:
- classmethod create_focused(user_id, llm_config=None, name='focused_memory_coordinator')¶
Create coordinator optimized for focused reasoning.
- Parameters:
- Return type:
- async get_comprehensive_memory_summary()¶
Get comprehensive summary of all memory systems.
- async initialize()¶
Initialize the ReactAgent and memory agents.
- Return type:
None
- async run(query, add_to_conversation=True)¶
Run memory-enhanced conversation with ReactAgent reasoning.
This implements the ReactAgent pattern for memory operations: 1. ReactAgent reasons about what memory operations are needed 2. Uses memory tools to search, store, and analyze information 3. Provides comprehensive response with memory context 4. Optionally stores the conversation for future reference
- async agents.memory_v2.react_memory_coordinator.demo_react_memory_coordinator()¶
Demo ReactAgent memory coordinator functionality.