agents.memory_v2.standalone_memory_agent_freeยถ
Standalone memory agent using only free resources (no API keys required).
This implementation shows how to build a functional memory agent without relying on paid APIs like OpenAI or Anthropic.
Classesยถ
Memory agent using free embeddings and local storage. |
Functionsยถ
Test the free memory agent. |
Module Contentsยถ
- class agents.memory_v2.standalone_memory_agent_free.FreeMemoryAgent(user_id, storage_path=None, embedding_model='sentence-transformers/all-MiniLM-L6-v2', k_memories=5)ยถ
Memory agent using free embeddings and local storage.
This agent provides: - Memory storage with embeddings (using HuggingFace) - Similarity-based retrieval - Persistent storage to disk - No API keys required
Initialize the free memory agent.
- Parameters:
- add_memory(content, memory_type=MemoryType.CONVERSATIONAL, importance=ImportanceLevel.MEDIUM, metadata=None)ยถ
Add a new memory.
- Parameters:
- Returns:
Memory ID
- Return type:
- get_relevant_context(query, k=None)ยถ
Get relevant context for a query.
- async process_input(user_input)ยถ
Process user input - store if itโs information, retrieve if itโs a question.
- save()ยถ
Save the vector store to disk.
- search_memories(query, k=None, memory_type=None, importance=None)ยถ
Search memories using similarity search.
- Parameters:
query (str) โ Search query
k (int | None) โ Number of results (uses k_memories if None)
memory_type (haive.agents.memory_v2.memory_state_original.MemoryType | None) โ Filter by memory type
importance (haive.agents.memory_v2.memory_state_original.ImportanceLevel | None) โ Filter by importance
- Returns:
List of memory results with scores
- Return type:
- async agents.memory_v2.standalone_memory_agent_free.test_free_memory_agent()ยถ
Test the free memory agent.