Welcome to the Agentic Shared Memory documentation. This repository contains comprehensive documentation for implementing and optimizing the A-MEM (Associative Memory) system utilizing both vector and graph memory for dynamic memory organization.
The A-MEM system implements a memory graph architecture with the following components:
- Memory Nodes: Atomic units of knowledge with content, embeddings, and metadata
- Dynamic Links: Bidirectional connections between semantically related nodes
- Vector Database: LanceDB for efficient vector storage and similarity search
- Embedding Generation: OpenAI embeddings for semantic representation
- Graph Traversal: Methods for exploring connected knowledge nodes
- Versioning: Support for handling conflicting information and knowledge evolution
The A-MEM system is built on several key implementation features that enable its functionality:
A-MEM Requirement | Implementation |
---|---|
Atomic Note Creation | Text chunking + metadata extraction |
Dynamic Linking | Hybrid search (vector + semantic analysis) |
Continuous Evolution | memory_graph.update_node() API |
Context-Aware Retrieval | memory_graph.retrieve(context=...) |
- Zettelkasten-Scale Performance: Handles 10k+ notes with <100ms query latency
- Dynamic Context Handling: Automatically injects relevant memories into prompts
- Multi-Agent Sync: Shared memory graph enables team collaboration
- Continuous Learning: Daily automatic node reindexing
- This repo uses Agno for agent orchestration
- Use Agno's monitoring=True flag to track memory graph metrics
- Implement conflict resolution with versioned_nodes table
- Schedule periodic memory_graph.optimize() calls for large datasets
- For multi-agent collaboration, instantiate multiple agents all referencing the same memory_graph
This implementation demonstrates how Agno's modular architecture and performance characteristics make it ideal for building A-MEM systems that require dynamic knowledge organization and efficient retrieval.
To get started with Agno Shared Memory:
-
Clone this repository and set up your environment:
# Create a Python 3.12 virtual environment python3.12 -m venv .venv # Activate the virtual environment source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies pip install -r requirements.txt
-
Examine the Memory Workflow to understand how information flows through the system
-
Run the example script to see the memory graph in action:
python3 example.py
-
Explore the implementation in main.py to understand how the MemoryGraph class works
-
For advanced use cases, refer to the specialized documentation:
- Multi-Agent Collaboration for building collaborative agent systems
- Memory Graph Optimization for scaling and performance tuning
- LanceDB Implementation for implementing memory graphs with LanceDB
The project is organized into several key files:
- main.py: Core implementation of the MemoryGraph class
- example.py: Example code demonstrating how to use the MemoryGraph with Agno agents
- test_memory_graph.py: Test script for the MemoryGraph implementation with LanceDB
- simple_test.py: Simplified test implementation using in-memory storage
To run the example code:
python3 example.py
This will demonstrate:
- Initializing a memory graph with LanceDB
- Configuring an agent with shared memory
- Processing documents and storing knowledge
- Querying with memory integration
- Performance optimization techniques
-
Node Schema:
- Content: The actual knowledge or information
- Embedding: Vector representation for semantic similarity
- Links: Connections to related nodes
- Link Scores: Similarity scores for each connection
- Tags: Categorical metadata for organization
- Version: For tracking updates and changes
- Timestamps: Creation and update times
-
Key Operations:
- Node Creation: Adding new knowledge to the graph
- Dynamic Linking: Automatically connecting related information
- Semantic Search: Finding relevant information based on meaning
- Graph Traversal: Exploring connected knowledge
- Knowledge Updates: Evolving information over time
- Atomic Note Creation: Generate discrete knowledge units from various sources
- Dynamic Linking: Automatically connect related information
- Continuous Evolution: Update and refine knowledge over time
- Context-Aware Retrieval: Retrieve information based on contextual relevance
- Multi-Agent Collaboration: Enable multiple agents to share and build upon knowledge
- Performance Optimization: Scale to handle large knowledge bases efficiently
For detailed best practices, refer to the specialized documentation files:
- Multi-Agent Collaboration includes best practices for agent specialization, memory partitioning, and collaboration workflows
- Memory Graph Optimization includes best practices for performance tuning, maintenance, and scaling strategies
- LanceDB Implementation includes best practices for implementing memory graphs with LanceDB
- Research Knowledge Management: Organize and synthesize information from research papers
- Customer Support Systems: Build collaborative agent teams for customer interactions
- Content Creation: Develop systems that can collaboratively generate and refine content
- Decision Support: Create memory-augmented systems for complex decision-making
- Knowledge Evolution: Track how information changes and evolves over time
- Multi-Agent Memory: Enable multiple specialized agents to share and build upon knowledge
- Semantic Knowledge Graphs: Build rich knowledge representations with dynamic relationships
- Continuous Learning Systems: Develop systems that learn and improve over time
A-MEM: Agentic Memory for LLM Agents
Agentic Memory(A-MEM): Long-Term Knowledge Management for LLM Agents
To contribute to this documentation:
- Fork the repository
- Make your changes
- Submit a pull request with a clear description of your improvements