agentic-composite-memory 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentic_composite_memory/__init__.py +2 -0
- agentic_composite_memory/py.typed +0 -0
- agentic_composite_memory-0.1.0.dist-info/METADATA +167 -0
- agentic_composite_memory-0.1.0.dist-info/RECORD +31 -0
- agentic_composite_memory-0.1.0.dist-info/WHEEL +4 -0
- agentic_composite_memory-0.1.0.dist-info/entry_points.txt +2 -0
- agentic_composite_memory-0.1.0.dist-info/licenses/LICENSE +17 -0
- agentic_memory_sdk/__init__.py +163 -0
- agentic_memory_sdk/adapters/__init__.py +33 -0
- agentic_memory_sdk/adapters/in_memory.py +439 -0
- agentic_memory_sdk/adapters/neo4j_cypher.py +65 -0
- agentic_memory_sdk/adapters/neptune_cypher.py +309 -0
- agentic_memory_sdk/adapters/opensearch_seed.py +322 -0
- agentic_memory_sdk/adapters/postgres_pgvector.py +484 -0
- agentic_memory_sdk/adapters/postgres_unified.py +511 -0
- agentic_memory_sdk/adapters/redis_playbook.py +157 -0
- agentic_memory_sdk/adapters/redis_unified.py +490 -0
- agentic_memory_sdk/adk_integration.py +250 -0
- agentic_memory_sdk/auth.py +380 -0
- agentic_memory_sdk/cli.py +137 -0
- agentic_memory_sdk/governance.py +713 -0
- agentic_memory_sdk/llm_extractors.py +616 -0
- agentic_memory_sdk/models.py +443 -0
- agentic_memory_sdk/ontology_loader.py +189 -0
- agentic_memory_sdk/ports.py +159 -0
- agentic_memory_sdk/py.typed +0 -0
- agentic_memory_sdk/server/__init__.py +4 -0
- agentic_memory_sdk/server/api.py +328 -0
- agentic_memory_sdk/server/main.py +384 -0
- agentic_memory_sdk/server/mcp_server.py +198 -0
- agentic_memory_sdk/service.py +1214 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import asyncio
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main(argv: list[str] | None = None) -> int:
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
prog="adk-memory",
|
|
11
|
+
description="CLI for the Enterprise Multi-Tenant Composite Memory SDK & Platform Service",
|
|
12
|
+
)
|
|
13
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
14
|
+
|
|
15
|
+
# 1. serve-api: Run centralized FastAPI Memory Platform Server
|
|
16
|
+
p_api = sub.add_parser(
|
|
17
|
+
"serve-api",
|
|
18
|
+
help="Start the centralized FastAPI Memory Platform Server for 100s of ADK agents",
|
|
19
|
+
)
|
|
20
|
+
p_api.add_argument("--host", default="127.0.0.1", help="Bind host (default: 127.0.0.1)")
|
|
21
|
+
p_api.add_argument("--port", type=int, default=8095, help="Bind port (default: 8095)")
|
|
22
|
+
p_api.add_argument(
|
|
23
|
+
"--backend",
|
|
24
|
+
choices=["docker", "memory"],
|
|
25
|
+
default=None,
|
|
26
|
+
help="Override MEMORY_BACKEND ('docker' for Postgres+Neo4j, 'memory' for InMemory)",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# 2. serve-mcp: Run Model Context Protocol (MCP) Server
|
|
30
|
+
p_mcp = sub.add_parser(
|
|
31
|
+
"serve-mcp",
|
|
32
|
+
help="Start the Model Context Protocol (MCP) Server exposing Composite Memory tools",
|
|
33
|
+
)
|
|
34
|
+
p_mcp.add_argument(
|
|
35
|
+
"--transport",
|
|
36
|
+
choices=["stdio", "sse", "streamable-http"],
|
|
37
|
+
default="stdio",
|
|
38
|
+
help="MCP transport protocol (default: stdio)",
|
|
39
|
+
)
|
|
40
|
+
p_mcp.add_argument(
|
|
41
|
+
"--backend",
|
|
42
|
+
choices=["docker", "memory"],
|
|
43
|
+
default=None,
|
|
44
|
+
help="Override MEMORY_BACKEND ('docker' or 'memory')",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# 3. init-db: Initialize PostgreSQL + pgvector RLS schema and partitions
|
|
48
|
+
p_init = sub.add_parser(
|
|
49
|
+
"init-db",
|
|
50
|
+
help="Initialize PostgreSQL + pgvector RLS tables, partitions, and HNSW indexes",
|
|
51
|
+
)
|
|
52
|
+
p_init.add_argument(
|
|
53
|
+
"--dsn",
|
|
54
|
+
default="postgresql://platform_admin:platform_secret@127.0.0.1:5433/adk_memory_platform",
|
|
55
|
+
help="PostgreSQL connection DSN",
|
|
56
|
+
)
|
|
57
|
+
p_init.add_argument(
|
|
58
|
+
"--embedding-dim",
|
|
59
|
+
type=int,
|
|
60
|
+
default=1536,
|
|
61
|
+
help="Vector embedding dimensionality (e.g. 768, 1536, 3072)",
|
|
62
|
+
)
|
|
63
|
+
p_init.add_argument(
|
|
64
|
+
"--tenant",
|
|
65
|
+
default="t1",
|
|
66
|
+
help="Initial tenant ID to provision partitions for (default: t1)",
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# 4. flush-outbox: Drain pending transactional outbox batch
|
|
70
|
+
p_outbox = sub.add_parser(
|
|
71
|
+
"flush-outbox",
|
|
72
|
+
help="Drain pending graph mutations from the Transactional Outbox to the Graph Store",
|
|
73
|
+
)
|
|
74
|
+
p_outbox.add_argument("--batch-size", type=int, default=50, help="Batch size (default: 50)")
|
|
75
|
+
|
|
76
|
+
args = parser.parse_args(argv)
|
|
77
|
+
|
|
78
|
+
if args.command == "serve-api":
|
|
79
|
+
import os
|
|
80
|
+
import uvicorn
|
|
81
|
+
|
|
82
|
+
if args.backend:
|
|
83
|
+
os.environ["MEMORY_BACKEND"] = args.backend
|
|
84
|
+
uvicorn.run(
|
|
85
|
+
"agentic_memory_sdk.server.main:app",
|
|
86
|
+
host=args.host,
|
|
87
|
+
port=args.port,
|
|
88
|
+
log_level="info",
|
|
89
|
+
)
|
|
90
|
+
return 0
|
|
91
|
+
|
|
92
|
+
if args.command == "serve-mcp":
|
|
93
|
+
import os
|
|
94
|
+
from .server.main import build_platform_service_from_env
|
|
95
|
+
from .server.mcp_server import create_mcp_server
|
|
96
|
+
|
|
97
|
+
if args.backend:
|
|
98
|
+
os.environ["MEMORY_BACKEND"] = args.backend
|
|
99
|
+
service, registrar = build_platform_service_from_env()
|
|
100
|
+
mcp = create_mcp_server(service=service, registrar=registrar)
|
|
101
|
+
mcp.run(transport=args.transport)
|
|
102
|
+
return 0
|
|
103
|
+
|
|
104
|
+
if args.command == "init-db":
|
|
105
|
+
from .adapters.postgres_pgvector import PostgresPgVectorAdapter
|
|
106
|
+
|
|
107
|
+
async def _run_init() -> None:
|
|
108
|
+
adapter = PostgresPgVectorAdapter(dsn=args.dsn, min_pool_size=1, max_pool_size=2)
|
|
109
|
+
try:
|
|
110
|
+
await adapter.init_schema(
|
|
111
|
+
embedding_dim=args.embedding_dim, default_tenant=args.tenant
|
|
112
|
+
)
|
|
113
|
+
print(
|
|
114
|
+
f"Initialized PostgreSQL + pgvector RLS schema (dim={args.embedding_dim}, tenant={args.tenant})."
|
|
115
|
+
)
|
|
116
|
+
finally:
|
|
117
|
+
await adapter.close()
|
|
118
|
+
|
|
119
|
+
asyncio.run(_run_init())
|
|
120
|
+
return 0
|
|
121
|
+
|
|
122
|
+
if args.command == "flush-outbox":
|
|
123
|
+
from .server.main import build_platform_service_from_env
|
|
124
|
+
|
|
125
|
+
async def _run_flush() -> None:
|
|
126
|
+
service, _ = build_platform_service_from_env()
|
|
127
|
+
count = await service.process_outbox_batch(batch_size=args.batch_size)
|
|
128
|
+
print(f"Flushed {count} outbox operations.")
|
|
129
|
+
|
|
130
|
+
asyncio.run(_run_flush())
|
|
131
|
+
return 0
|
|
132
|
+
|
|
133
|
+
return 1
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
if __name__ == "__main__":
|
|
137
|
+
sys.exit(main())
|