Enterprise-Grade AI Memory Platform for Production Applications
Documentation β’ Examples β’ Changelog β’ Contributing
AgentMem is a high-performance, enterprise-grade memory management platform built in Rust, designed specifically for AI agents and LLM-powered applications. It provides persistent memory, intelligent semantic search, and enterprise-grade reliability with a modular plugin architecture.
Modern LLM applications face critical limitations that AgentMem solves:
| Problem | AgentMem Solution |
|---|---|
| β No persistent memory | β Cross-session memory retention |
| β Context window limits | β Intelligent memory retrieval |
| β High API costs ($300K/month for 1M users) | β 90% cost reduction via selective retrieval |
| β Poor personalization | β User-specific memory scoping |
| β No enterprise features | β RBAC, audit logs, multi-tenancy |
- 216,000 ops/sec plugin throughput
- <100ms semantic search latency (P95)
- 93,000x cache acceleration ratio
- 5,000 ops/s memory addition throughput
- Asynchronous, lock-free architecture
- Automatic fact extraction powered by LLMs
- 5 search engines: Vector, BM25, Full-Text, Fuzzy, Hybrid (RRF)
- Conflict resolution for contradictory information
- Memory importance scoring and decay
- Graph-based reasoning with relationship traversal
- WASM plugin system with hot-reload capability
- 18 modular crates for clear separation of concerns
- 20+ LLM providers: OpenAI, Anthropic, DeepSeek, Google, Azure, and more
- Multi-backend storage: LibSQL, PostgreSQL, Pinecone, LanceDB, Qdrant
- Language bindings: Python, JavaScript, Go, Cangjie
- RBAC (Role-Based Access Control) with fine-grained permissions
- JWT & Session authentication
- Comprehensive audit logging
- Full observability: Prometheus, OpenTelemetry, Grafana
- Multi-modal support: Text, images, audio, video
- Kubernetes-ready with Helm charts
- 99.9% uptime SLA capability
Add to your Cargo.toml:
[dependencies]
agent-mem = "2.0"
tokio = { version = "1", features = ["full"] }docker pull agentmem/server:latest
docker run -p 8080:8080 agentmem/server:latestgit clone https://github.com/louloulin/agentmem.git
cd agentmem
cargo build --releaseuse agent_mem::Memory;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Zero-configuration initialization
let memory = Memory::new().await?;
// Add memories with automatic fact extraction
memory.add("I love pizza").await?;
memory.add("I live in San Francisco").await?;
memory.add("My favorite food is pizza").await?; // Auto-deduplicated
// Semantic search
let results = memory.search("What do you know about me?").await?;
for result in results {
println!("- {} (score: {:.2})", result.memory, result.score);
}
Ok(())
}# Start the full-stack server (API + UI)
cargo run --bin agent-mem-server
# Or use Docker Compose
docker-compose up -dAccess Points:
- π API:
http://localhost:8080 - π₯οΈ Web UI:
http://localhost:3001 - π API Docs:
http://localhost:8080/swagger-ui/
| Operation | Throughput | Latency (P50) | Latency (P99) |
|---|---|---|---|
| Add Memory | 5,000 ops/s | 20ms | 50ms |
| Vector Search | 10,000 ops/s | 10ms | 30ms |
| BM25 Search | 15,000 ops/s | 5ms | 15ms |
| Plugin Call | 216,000 ops/s | 1ms | 5ms |
| Batch Operations | 50,000 ops/s | 100ms | 300ms |
| Graph Traversal | 1,000 queries/s | 50ms | 200ms |
Benchmarks run on: Apple M2 Pro, 32GB RAM, LibSQL backend
AgentMem is organized into 18 specialized crates with clear separation of concerns:
agentmem/
βββ agent-mem-traits # Core abstractions and traits
βββ agent-mem-core # Memory management engine (32K lines)
βββ agent-mem # Unified high-level API
βββ agent-mem-llm # 20+ LLM provider integrations
βββ agent-mem-embeddings # Embedding models (FastEmbed, ONNX)
βββ agent-mem-storage # Multi-backend storage layer
βββ agent-mem-intelligence # AI reasoning engine (DeepSeek, etc.)
βββ agent-mem-plugin-sdk # WASM plugin SDK
βββ agent-mem-plugins # Plugin manager with hot-reload
βββ agent-mem-server # HTTP REST API (175+ endpoints)
βββ agent-mem-client # HTTP client library
βββ agent-mem-compat # Mem0 compatibility layer
βββ agent-mem-observability # Monitoring and metrics
βββ agent-mem-performance # Performance optimizations
βββ agent-mem-deployment # Kubernetes deployment
βββ agent-mem-distributed # Distributed support
βββ agent-mem-python # Python bindings (PyO3)
Total: 275,000+ lines of production Rust code
AgentMem features a high-performance WASM plugin system with sandbox isolation:
use agent_mem_plugins::PluginManager;
// Create plugin manager with LRU cache
let plugin_manager = PluginManager::new(100);
// Register plugins with hot-reload
plugin_manager.register(weather_plugin).await?;
// Execute plugins in isolated sandbox
let result = plugin_manager.execute("weather", &input).await?;Plugin Features:
- π Sandbox isolation - WebAssembly security
- β‘ LRU caching - 93,000x speedup on cached calls
- π Hot-reload - Load/unload without restart
- ποΈ Capability system - Fine-grained permissions
- π Performance monitoring - Built-in metrics
AgentMem provides a complete Model Context Protocol (MCP) server implementation, enabling seamless integration with Claude Code, Claude Desktop, and other MCP-compatible clients.
- β 5 Core Tools: Memory management, search, chat, system prompts, and agent listing
- β Multiple Transports: stdio, HTTP, SSE (Server-Sent Events)
- β Resource Management: Dynamic resource discovery and subscription
- β Prompt Templates: Reusable prompt templates with variables
- β Authentication: JWT and API key support
- β Production Ready: Battle-tested with Claude Code integration
# 1. Build the MCP server
cargo build --package mcp-stdio-server --release
# 2. Create .mcp.json in your project root
cat > .mcp.json << EOF
{
"mcpServers": {
"agentmem": {
"command": "./target/release/agentmem-mcp-server",
"args": [],
"env": {
"AGENTMEM_API_URL": "http://127.0.0.1:8080",
"RUST_LOG": "info"
}
}
}
}
EOF
# 3. Start Claude Code in the project directory
claude| Tool | Description | Parameters |
|---|---|---|
agentmem_add_memory |
Add a new memory to the system | content, user_id, agent_id (optional), memory_type (optional) |
agentmem_search_memories |
Search memories semantically | query, user_id, limit (optional), search_type (optional) |
agentmem_chat |
Intelligent chat with memory context | message, user_id, agent_id (optional) |
agentmem_get_system_prompt |
Get personalized system prompt | user_id, agent_id (optional) |
agentmem_list_agents |
List all available agents | None |
User: Remember that I prefer dark mode and use Rust for backend development
Claude: [Calls agentmem_add_memory]
β
Memory saved successfully
User: What do you know about my preferences?
Claude: [Calls agentmem_search_memories]
Based on your saved memories:
- You prefer dark mode
- You use Rust for backend development
- π MCP Complete Guide - Full integration guide
- π Claude Code Quickstart - 5-minute setup
- π§ MCP Commands Reference - All available commands
- π₯οΈ Claude Desktop Integration - Desktop app setup
AgentMem provides official SDKs for multiple languages:
from agentmem import Memory
memory = Memory()
memory.add("User prefers dark mode")
results = memory.search("user preferences")Installation: pip install agentmem
import { Memory } from 'agentmem';
const memory = new Memory();
await memory.add("User prefers dark mode");
const results = await memory.search("user preferences");Installation: npm install agentmem
import "github.com/agentmem/agentmem-go"
memory := agentmem.NewMemory()
memory.Add("User prefers dark mode")
results := memory.Search("user preferences")import agentmem.*
let memory = Memory.create()
memory.add("User prefers dark mode")
let results = memory.search("user preferences")See: SDKs Documentation
π Complete Documentation Index - Central hub for all documentation
- π Installation Guide - Detailed setup instructions
- π Quick Start Guide - Get started in 5 minutes
- π API Reference - Complete API documentation
- π¬ Claude Code Integration - MCP integration guide
- π User Guide - Comprehensive user documentation
- π Search Guide - Search engine usage
- π Plugin Guide - Plugin development
- π MCP Complete Guide - Full MCP integration documentation
- ποΈ Architecture - System architecture and design
- π§ Developer Guide - Development setup and guidelines
- π Deployment Guide - Production deployment strategies
- π§ͺ Testing Guide - Testing strategies and best practices
- π Security Documentation - Security model and best practices
- π API Reference - Complete REST API documentation
- π MCP Tools Reference - Model Context Protocol tools
- π OpenAPI Specification - Machine-readable API spec
Provide persistent memory for conversational AI:
memory.add("user123", "Prefers dark mode").await?;
let context = memory.search("user preferences", "user123").await?;Build enterprise knowledge bases:
memory.add("company_kb", "Vacation policy: 20 days/year").await?;
let results = memory.search("vacation policy", "company_kb").await?;Coordinate multiple AI agents with shared memory:
let scope = MemoryScope::Agent {
user_id: "alice",
agent_id: "coding-assistant"
};
memory.add_with_scope("Prefers Rust", scope).await?;Drop-in replacement for Mem0:
use agent_mem_compat::Mem0Client;
let client = Mem0Client::new().await?;
let id = client.add("user", "content", None).await?;We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Ways to contribute:
- π Bug fixes and reports
- π‘ Feature requests
- π Documentation improvements
- π§ͺ Test cases
- π§ Performance optimizations
- π Internationalization
# Clone the repository
git clone https://github.com/louloulin/agentmem.git
cd agentmem
# Build the workspace
cargo build --workspace
# Run tests
cargo test --workspace
# Run linting
cargo clippy --workspace -- -D warnings
# Format code
cargo fmt --all- β Core memory management
- β 5 search engines
- β WASM plugin system
- β Multi-backend storage
- β Enterprise features (RBAC, audit logs)
- β Language bindings (Python, JS, Go, Cangjie)
- π Code-native memory (AST parsing)
- π GitHub integration
- π Claude Code deep integration
- π Advanced context management
- π Performance optimizations
See: Roadmap
AgentMem is battle-tested and production-ready:
- β 99.9% uptime capability
- β Horizontal scaling support
- β Multi-region deployment ready
- β Disaster recovery with backup/restore
- β Security audits and vulnerability scanning
- β Comprehensive monitoring and alerting
Dual-licensed under:
- MIT License - See LICENSE-MIT
- Apache-2.0 License - See LICENSE-APACHE
Built with amazing open-source projects:
- Rust - Core language
- Tokio - Async runtime
- Extism - WASM plugin framework
- DeepSeek - AI reasoning
- LanceDB - Vector database
- LibSQL - Embedded SQL database
AgentMem - Give your AI the memory it deserves. π§ β¨
GitHub Β· Documentation Β· Examples Β· Discord Β· Blog Β· δΈζζζ‘£
Made with β€οΈ by the AgentMem team