agents.memory_v2.memory_stateΒΆ
Memory state models for Memory V2 system using original Haive memory models.
This module integrates the proven memory models from haive.agents.memory.models and haive.agents.ltm.memory_schemas with our V2 enhancements for token tracking, graph integration, and advanced memory management.
ClassesΒΆ
A single memory entry with content and metadata. |
|
Metadata for a single memory entry. |
|
State schema for memory agent operations. |
|
Statistics about memory operations and performance. |
Module ContentsΒΆ
- class agents.memory_v2.memory_state.MemoryEntry(/, **data)ΒΆ
Bases:
pydantic.BaseModel
A single memory entry with content and metadata.
Represents a complete memory item that can be stored, retrieved, and analyzed by memory agents.
- Parameters:
data (Any)
- idΒΆ
Unique identifier for the memory
- contentΒΆ
The actual memory content
- metadataΒΆ
Structured metadata about the memory
- embeddingΒΆ
Optional vector embedding for similarity search
- similarity_scoreΒΆ
Similarity score when retrieved (populated during retrieval)
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.
- class agents.memory_v2.memory_state.MemoryMetadata(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Metadata for a single memory entry.
Tracks essential information about stored memories including type classification, importance, timestamps, and source information.
- Parameters:
data (Any)
- memory_typeΒΆ
Type of memory (semantic, episodic, procedural)
- importanceΒΆ
Importance level (critical, high, medium, low, transient)
- confidenceΒΆ
Confidence score for the memory (0.0-1.0)
- timestampΒΆ
When the memory was created
- sourceΒΆ
Source of the memory (user_input, agent_inference, system)
- tagsΒΆ
List of tags for categorization
- entitiesΒΆ
Named entities mentioned in the memory
- relationshipsΒΆ
Relationships extracted from the memory
- context_idΒΆ
ID linking related memories
- retrieval_countΒΆ
How many times this memory has been retrieved
- last_accessedΒΆ
When the memory was last accessed
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.
- class agents.memory_v2.memory_state.MemoryState(/, **data)ΒΆ
Bases:
haive.core.schema.prebuilt.messages_state.MessagesState
State schema for memory agent operations.
Extends MessagesState with memory-specific fields for tracking current memories, metadata, statistics, and operation results.
This state schema is used by all memory agents to maintain consistent state management and enable proper coordination between different memory strategies.
- Parameters:
data (Any)
- current_memoriesΒΆ
List of memory entries currently being processed
- retrieved_memoriesΒΆ
List of memories retrieved in the last operation
- memory_metadataΒΆ
General metadata about the memory session
- memory_statsΒΆ
Performance and usage statistics
- token_usageΒΆ
Token usage tracking for memory operations
- last_operationΒΆ
Information about the last memory operation performed
- memory_contextΒΆ
Context information for memory operations
- active_filtersΒΆ
Currently active filters for memory search/retrieval
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.
- add_memory(memory)ΒΆ
Add a memory entry to current memories.
- Parameters:
memory (MemoryEntry)
- Return type:
None
- get_memory_summary()ΒΆ
Get a comprehensive summary of the current memory state.
- update_retrieval_stats(memories, retrieval_time)ΒΆ
Update statistics after memory retrieval.
- Parameters:
memories (list[MemoryEntry])
retrieval_time (float)
- Return type:
None
- class agents.memory_v2.memory_state.MemoryStats(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Statistics about memory operations and performance.
Tracks memory system performance, usage patterns, and optimization metrics.
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)