Skip to content

Commit bdab032

Browse files
committed
feat: add local/in-process mode (SQLite + numpy, no server needed)
Add mode='local' to AegisClient and AsyncAegisClient for zero-config in-process memory. pip install aegis-memory[local] is now a fully self-contained experience with no server, Docker, or PostgreSQL needed.
1 parent bc1d783 commit bdab032

16 files changed

Lines changed: 3781 additions & 74 deletions

aegis_memory/__init__.py

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@
99
- First-class multi-agent support (cross-agent queries, structured handoffs, scoped ACLs)
1010
- Production-oriented design (FastAPI + Postgres + pgvector)
1111
12-
Quick Start (Manual Control):
12+
Quick Start (Local Mode - Zero Config):
13+
from aegis_memory import local_client
14+
15+
client = local_client()
16+
client.add("User prefers dark mode", agent_id="ui-agent")
17+
memories = client.query("user preferences", agent_id="ui-agent")
18+
19+
Quick Start (Remote Server):
1320
from aegis_memory import AegisClient
14-
21+
1522
client = AegisClient(api_key="your-key", base_url="http://localhost:8000")
16-
23+
1724
# Add a memory
1825
result = client.add("User prefers dark mode", agent_id="ui-agent")
19-
20-
# Query memories
26+
27+
# Query memories
2128
memories = client.query("user preferences", agent_id="ui-agent")
2229
2330
Quick Start (Smart Memory - Zero Config):
@@ -54,7 +61,7 @@
5461
For more examples, see: https://github.com/quantifylabs/aegis-memory/tree/main/examples
5562
"""
5663

57-
__version__ = "2.1.0"
64+
__version__ = "2.2.0"
5865

5966
# Core client (manual control)
6067
from aegis_memory.client import (
@@ -70,6 +77,41 @@
7077
ConsolidationCandidate,
7178
)
7279

80+
81+
def local_client(
82+
*,
83+
db_path: str = None,
84+
openai_api_key: str = None,
85+
embedding_model: str = None,
86+
embedding_provider=None,
87+
signing_key: str = "aegis-local-default-key",
88+
) -> AegisClient:
89+
"""
90+
Create a local-mode AegisClient (SQLite + numpy, no server needed).
91+
92+
Usage::
93+
94+
from aegis_memory import local_client
95+
client = local_client()
96+
client.add("User prefers dark mode", agent_id="ui-agent")
97+
memories = client.query("user preferences", agent_id="ui-agent")
98+
99+
Args:
100+
db_path: SQLite database path (default: ~/.aegis/memory.db)
101+
openai_api_key: OpenAI key for embeddings (or set OPENAI_API_KEY env var).
102+
If omitted and sentence-transformers is installed, uses local embeddings.
103+
embedding_model: Override the embedding model name.
104+
embedding_provider: Custom EmbeddingProvider instance.
105+
signing_key: HMAC signing key for integrity hashes.
106+
"""
107+
return AegisClient(
108+
mode="local",
109+
db_path=db_path,
110+
openai_api_key=openai_api_key,
111+
embedding_model=embedding_model,
112+
embedding_provider=embedding_provider,
113+
)
114+
73115
# Smart memory (automatic extraction)
74116
from aegis_memory.smart import (
75117
SmartMemory,
@@ -103,6 +145,7 @@
103145
# Core
104146
"AegisClient",
105147
"AsyncAegisClient",
148+
"local_client",
106149
"Memory",
107150
"PlaybookEntry",
108151
"SessionProgress",

0 commit comments

Comments
 (0)