Agent-native memory fabric for AI agents. Scoped, multi-agent, self-hosted.
Project description
Aegis Memory
The memory engine for multi-agent systems.
Aegis Memory is a production-ready, self-hostable memory engine designed to give AI agents a persistent learning loop. By combining semantic search, scope-aware access control, and ACE (Agentic Context Engineering), Aegis allows agents to share state, vote on strategies, and extract actionable reflections from their failures.
Quick Start
1. Start the Server (2 min)
git clone https://github.com/quantifylabs/aegis-memory.git
cd aegis-memory
export OPENAI_API_KEY=sk-...
docker-compose up -d
# Verify
curl http://localhost:8000/health
2. Install the CLI + SDK
pip install aegis-memory
3. Configure & Use
# First-time setup
aegis config init
# Check connection
aegis status
# Add your first memory
aegis add "User prefers concise responses" -a assistant -s global
# Query memories
aegis query "user preferences"
# View stats
aegis stats
CLI Reference
Aegis provides a powerful CLI for all memory operations:
# Core Operations
aegis add "content" # Add a memory
aegis query "search text" # Semantic search
aegis get <id> # Get single memory
aegis delete <id> # Delete memory
aegis vote <id> helpful # Vote on memory
# ACE Patterns
aegis playbook "error handling" # Query proven strategies
aegis progress show <session> # View session progress
aegis features list # Track feature status
# Data Management
aegis export -o backup.jsonl # Export memories
aegis import backup.jsonl # Import memories
aegis stats # Namespace statistics
Python SDK
from aegis_memory import AegisClient
client = AegisClient(api_key="dev-key", base_url="http://localhost:8000")
# Add a memory
client.add("User prefers concise responses", agent_id="assistant")
# Query memories
memories = client.query("user preferences", agent_id="assistant")
# Vote on usefulness (ACE pattern)
client.vote(memories[0].id, "helpful", voter_agent_id="assistant")
# Cross-agent memory sharing
client.add(
content="Task: Build login. Steps: 1) Form, 2) Validation, 3) API",
agent_id="planner",
scope="agent-shared",
shared_with_agents=["executor"]
)
Why Aegis Memory?
| Challenge | DIY Solution | Aegis Memory |
|---|---|---|
| Multi-agent memory sharing | Custom access control | Built-in scopes (private/shared/global) |
| Long-running agent state | File-based progress tracking | Structured session & feature tracking |
| Context window limits | Dump everything in prompt | Semantic search + effectiveness scoring |
| Learning from mistakes | Manual prompt tuning | Memory voting + reflection patterns |
Aegis Memory is not just another vector database. It's an active strategy engine with primitives designed to turn agent execution into persistent organizational intelligence.
Features
Core Memory
- Semantic Search — pgvector HNSW index for O(log n) queries at scale
- Scope-Aware Access —
agent-private,agent-shared,globalwith automatic ACL - Multi-Agent Handoffs — Structured state transfer between agents
- Auto-Deduplication — Hash-based O(1) duplicate detection
ACE Patterns
- Memory Voting — Track which memories help vs harm task completion
- Delta Updates — Incremental changes that prevent context collapse
- Reflections — Store insights from failures for future reference
- Session Progress — Track work across context windows
- Feature Tracking — Prevent premature task completion
Production Ready
- Self-Hostable — Docker, Kubernetes, any cloud
- Observable — Prometheus metrics, structured logging
- Fast — 30-80ms queries on 1M+ memories
- Safe — Data export, migrations, no vendor lock-in
Framework Integrations
Drop-in support for popular agent frameworks:
# LangChain
from aegis_memory.integrations.langchain import AegisMemory
chain = ConversationChain(llm=llm, memory=AegisMemory(agent_id="assistant"))
# CrewAI
from aegis_memory.integrations.crewai import AegisCrewMemory
crew = Crew(agents=[...], memory=AegisCrewMemory())
ACE Patterns
Aegis implements patterns from recent research on self-improving agents:
Memory Voting
# After a memory helped complete a task
aegis vote <memory-id> helpful -c "Successfully paginated API"
# Query only effective strategies
aegis playbook "API pagination" -e 0.3
Session Progress
# Track work across context windows
aegis progress create build-dashboard -a coder
aegis progress update build-dashboard -c auth -i routing
aegis progress show build-dashboard
Performance
| Operation | Latency | Notes |
|---|---|---|
| Query (1M memories) | 30-80ms | HNSW index |
| Add single | ~100ms | Includes embedding |
| Add batch (50) | ~300ms | Batched embedding |
| Deduplication | <1ms | Hash lookup |
Documentation
- Quickstart — Get running in 15 minutes
- ACE Patterns — Self-improving agent patterns
- Operations — Backup, monitoring, upgrades
- Design — Technical deep-dive
- Recipes — 10 production-ready patterns
- API Reference — OpenAPI docs (when running)
Deployment
Docker Compose
docker-compose up -d
Kubernetes
kubectl apply -f k8s/
Configuration
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
postgresql+asyncpg://... |
PostgreSQL connection |
OPENAI_API_KEY |
— | For embeddings |
AEGIS_API_KEY |
dev-key |
API authentication |
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Run tests
pytest tests/ -v
# Run linting
ruff check server/
License
Apache 2.0 — Use it however you want. See LICENSE.
Links
Built with ❤️ for the agent community
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aegis_memory-1.2.0.tar.gz.
File metadata
- Download URL: aegis_memory-1.2.0.tar.gz
- Upload date:
- Size: 38.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa71641ddc0f191b9b29d429fac2bdc0e19c1ea73835e77bad0ef02d4e86ae83
|
|
| MD5 |
a4af0a0d75a5310cab30c503a1f09140
|
|
| BLAKE2b-256 |
20fe137858188d62039521b6f26e58728a6c11258a305afd4906ec889cb58f5b
|
File details
Details for the file aegis_memory-1.2.0-py3-none-any.whl.
File metadata
- Download URL: aegis_memory-1.2.0-py3-none-any.whl
- Upload date:
- Size: 49.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36b21504196287c03c05911735c6ce95225f45158cd9a5c51f4b5560ac5d2efa
|
|
| MD5 |
731f726b42ad62c34d82e5f83a865624
|
|
| BLAKE2b-256 |
1b3770f839f14eec8c25ca108332d6b4485e8e8069e43086761783bb3c231375
|