agents.memory.core.storesΒΆ
Memory store management system integrating with existing Haive store tools.
This module provides enhanced memory storage and retrieval capabilities that build on the existing store tools with intelligent classification, self-query retrieval, and memory lifecycle management.
ClassesΒΆ
Configuration for enhanced memory store management. |
|
Enhanced memory store manager with intelligent classification and retrieval. |
Module ContentsΒΆ
- class agents.memory.core.stores.MemoryStoreConfig(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Configuration for enhanced memory store management.
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.core.stores.MemoryStoreManager(config)ΒΆ
Enhanced memory store manager with intelligent classification and retrieval.
This manager builds on the existing store tools to provide: - Automatic memory classification and metadata extraction - Self-query retrieval with memory context - Memory lifecycle management and consolidation - Multi-type memory retrieval strategies
Initialize memory store manager with configuration.
- Parameters:
config (MemoryStoreConfig)
- async consolidate_memories(namespace=None, max_age_hours=None, dry_run=False)ΒΆ
Consolidate memories by removing duplicates, summarizing old memories, and cleaning up.
- Parameters:
- Returns:
MemoryConsolidationResult with consolidation statistics
- Return type:
haive.agents.memory.core.types.MemoryConsolidationResult
- async delete_memory(memory_id)ΒΆ
Delete a memory by ID.
- async get_memory_by_id(memory_id)ΒΆ
Retrieve a specific memory by ID and update access metadata.
- async get_memory_statistics(namespace=None)ΒΆ
Get statistics about stored memories.
- async retrieve_memories(query, namespace=None, memory_types=None, limit=None, time_range=None, importance_threshold=None)ΒΆ
Retrieve memories using intelligent query analysis and ranking.
- Parameters:
query (str) β Search query (natural language)
namespace (tuple[str, Ellipsis] | None) β Memory namespace to search
memory_types (list[haive.agents.memory.core.types.MemoryType] | None) β Specific memory types to search (if None, auto-detect)
limit (int | None) β Maximum number of results
time_range (tuple[datetime.datetime, datetime.datetime] | None) β Optional time range filter (start, end)
importance_threshold (float | None) β Minimum importance score
- Returns:
List of retrieved memories with metadata
- Return type:
- async store_memory(content, namespace=None, user_context=None, conversation_context=None, force_classification=None, importance_override=None)ΒΆ
Store a memory with automatic classification and metadata extraction.
- Parameters:
content (str) β Memory content to store
namespace (tuple[str, Ellipsis] | None) β Memory namespace (defaults to configured default)
user_context (dict[str, Any] | None) β User-specific context for classification
conversation_context (dict[str, Any] | None) β Conversation context for classification
force_classification (haive.agents.memory.core.types.MemoryType | None) β Override automatic classification
importance_override (float | None) β Override automatic importance scoring
- Returns:
Memory ID for later retrieval
- Return type:
- async update_memory(memory_id, content=None, additional_metadata=None, reclassify=False)ΒΆ
Update an existing memory with new content or metadata.
- Parameters:
- Returns:
True if successful, False otherwise
- Return type: