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

MemoryCoordinatorConfig

Configuration for ReactMemoryCoordinator.

ReactMemoryCoordinator

ReactAgent-based memory coordinator with tool integration.

Functions

demo_react_memory_coordinator()

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:
async add_conversation_batch(messages)

Add a batch of conversation messages to memory.

Parameters:

messages (list[langchain_core.messages.BaseMessage])

Return type:

dict[str, Any]

classmethod create(user_id, llm_config=None, enable_all_memory=True, name='react_memory_coordinator')

Factory method to create ReactMemoryCoordinator.

Parameters:
  • user_id (str)

  • llm_config (haive.core.models.llm.base.LLMConfig | None)

  • enable_all_memory (bool)

  • name (str)

Return type:

ReactMemoryCoordinator

classmethod create_focused(user_id, llm_config=None, name='focused_memory_coordinator')

Create coordinator optimized for focused reasoning.

Parameters:
  • user_id (str)

  • llm_config (haive.core.models.llm.base.LLMConfig | None)

  • name (str)

Return type:

ReactMemoryCoordinator

async get_comprehensive_memory_summary()

Get comprehensive summary of all memory systems.

Return type:

dict[str, Any]

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

Parameters:
  • query (str)

  • add_to_conversation (bool)

Return type:

dict[str, Any]

async agents.memory_v2.react_memory_coordinator.demo_react_memory_coordinator()

Demo ReactAgent memory coordinator functionality.