agents.ltm.agent¶
Long-Term Memory Agent implementation following Haive patterns.
This agent integrates LangMem functionality within the Haive framework, providing memory extraction, processing, and tool-based memory management.
Classes¶
Functions¶
|
Check if memory extraction succeeded. |
|
Check if there are critical processing errors. |
|
Check if categorization is needed. |
|
Check if consolidation is needed. |
|
Check if KG processing is needed. |
|
Check if memory tools should be activated. |
|
Check if all processing is complete. |
Module Contents¶
- class agents.ltm.agent.LTMAgent(name='LTM Agent', llm_config=None, enable_kg_processing=True, enable_categorization=True, enable_consolidation=True, enable_reflection=True, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Long-Term Memory Agent with LangMem integration.
This agent provides comprehensive memory management capabilities including: - Memory extraction from conversations using LangMem - Knowledge graph processing using Haive KG extraction - Memory categorization using TNT taxonomy - Memory consolidation and quality improvement - Tool-based memory management interface - Background reflection processing
The agent follows Haive patterns with proper conditional edges and state management.
Initialize LTM agent.
- Parameters:
name (str) – Agent name
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration for memory processing
enable_kg_processing (bool) – Enable knowledge graph extraction
enable_categorization (bool) – Enable memory categorization
enable_consolidation (bool) – Enable memory consolidation
enable_reflection (bool) – Enable background reflection
**kwargs – Additional Agent arguments
- build_graph()¶
Build LTM graph with proper conditional edges.
This is the FIRST PHASE - just memory extraction and basic routing. We’ll add more nodes incrementally.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- complete_processing_node(state)¶
Complete processing (Phase 1 implementation).
- extract_memories_node(state)¶
Extract memories using LangMem memory manager (Phase 2 implementation).
- get_processing_summary(state)¶
Get summary of processing results.
- handle_errors_node(state)¶
Handle processing errors.
- setup_agent()¶
Setup LTM agent engines and components.
- Return type:
None
- class agents.ltm.agent.LTMState(/, **data)¶
Bases:
pydantic.BaseModel
LTM Agent State following Haive patterns.
This state schema tracks the progression through memory processing stages and maintains all necessary data for the LTM workflow.
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)
- agents.ltm.agent.extraction_succeeded(state)¶
Check if memory extraction succeeded.
- agents.ltm.agent.has_processing_errors(state)¶
Check if there are critical processing errors.
- agents.ltm.agent.needs_categorization(state)¶
Check if categorization is needed.
- agents.ltm.agent.needs_consolidation(state)¶
Check if consolidation is needed.
- agents.ltm.agent.needs_kg_processing(state)¶
Check if KG processing is needed.
- agents.ltm.agent.needs_tool_activation(state)¶
Check if memory tools should be activated.