agentic-composite-memory 0.1.0__tar.gz
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-0.1.0/.gitignore +39 -0
- agentic_composite_memory-0.1.0/LICENSE +17 -0
- agentic_composite_memory-0.1.0/PKG-INFO +167 -0
- agentic_composite_memory-0.1.0/README.md +92 -0
- agentic_composite_memory-0.1.0/pyproject.toml +119 -0
- agentic_composite_memory-0.1.0/src/agentic_composite_memory/__init__.py +2 -0
- agentic_composite_memory-0.1.0/src/agentic_composite_memory/py.typed +0 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/__init__.py +163 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/__init__.py +33 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/in_memory.py +439 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/neo4j_cypher.py +65 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/neptune_cypher.py +309 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/opensearch_seed.py +322 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/postgres_pgvector.py +484 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/postgres_unified.py +511 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/redis_playbook.py +157 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adapters/redis_unified.py +490 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/adk_integration.py +250 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/auth.py +380 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/cli.py +137 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/governance.py +713 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/llm_extractors.py +616 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/models.py +443 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/ontology_loader.py +189 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/ports.py +159 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/py.typed +0 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/server/__init__.py +4 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/server/api.py +328 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/server/main.py +384 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/server/mcp_server.py +198 -0
- agentic_composite_memory-0.1.0/src/agentic_memory_sdk/service.py +1214 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Virtual environments
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
ENV/
|
|
10
|
+
env/
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
dist/
|
|
14
|
+
build/
|
|
15
|
+
*.egg-info/
|
|
16
|
+
|
|
17
|
+
# Pytest & coverage
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.coverage
|
|
20
|
+
htmlcov/
|
|
21
|
+
.mypy_cache/
|
|
22
|
+
.ruff_cache/
|
|
23
|
+
|
|
24
|
+
# Environment variables & secrets
|
|
25
|
+
.env
|
|
26
|
+
.env.local
|
|
27
|
+
*.pem
|
|
28
|
+
*.key
|
|
29
|
+
|
|
30
|
+
# OS / IDE files
|
|
31
|
+
.DS_Store
|
|
32
|
+
Thumbs.db
|
|
33
|
+
.vscode/
|
|
34
|
+
.idea/
|
|
35
|
+
|
|
36
|
+
# Local ADK runtime state
|
|
37
|
+
.adk/
|
|
38
|
+
*.db
|
|
39
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Agentic Memory SDK Contributors
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: agentic-composite-memory
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Enterprise Multi-Tenant Ontology-Grounded Composite Memory SDK, MCP Server & Platform Service for Google ADK Agents
|
|
5
|
+
License: Apache License
|
|
6
|
+
Version 2.0, January 2004
|
|
7
|
+
http://www.apache.org/licenses/
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Agentic Memory SDK Contributors
|
|
10
|
+
|
|
11
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
you may not use this file except in compliance with the License.
|
|
13
|
+
You may obtain a copy of the License at
|
|
14
|
+
|
|
15
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
|
|
17
|
+
Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
See the License for the specific language governing permissions and
|
|
21
|
+
limitations under the License.
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Keywords: a2a,agent-memory,bitemporal,google-adk,knowledge-graph,mcp,neo4j,neptune,ontology,opensearch,pgvector
|
|
24
|
+
Classifier: Development Status :: 4 - Beta
|
|
25
|
+
Classifier: Intended Audience :: Developers
|
|
26
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
27
|
+
Classifier: Programming Language :: Python :: 3
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
31
|
+
Classifier: Typing :: Typed
|
|
32
|
+
Requires-Python: >=3.11
|
|
33
|
+
Requires-Dist: a2a-sdk>=1.1.2
|
|
34
|
+
Requires-Dist: asyncpg>=0.29.0
|
|
35
|
+
Requires-Dist: fastapi>=0.111.0
|
|
36
|
+
Requires-Dist: google-adk[a2a]>=2.8.0
|
|
37
|
+
Requires-Dist: httpx>=0.27.0
|
|
38
|
+
Requires-Dist: mcp>=1.2.0
|
|
39
|
+
Requires-Dist: neo4j>=5.20.0
|
|
40
|
+
Requires-Dist: pydantic>=2.7.0
|
|
41
|
+
Requires-Dist: redis>=5.0.0
|
|
42
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
43
|
+
Provides-Extra: all
|
|
44
|
+
Requires-Dist: azure-identity>=1.16.0; extra == 'all'
|
|
45
|
+
Requires-Dist: boto3>=1.34.0; extra == 'all'
|
|
46
|
+
Requires-Dist: google-auth>=2.29.0; extra == 'all'
|
|
47
|
+
Requires-Dist: opensearch-py[async]>=2.6.0; extra == 'all'
|
|
48
|
+
Requires-Dist: pyshacl>=0.26.0; extra == 'all'
|
|
49
|
+
Requires-Dist: rdflib>=7.0.0; extra == 'all'
|
|
50
|
+
Provides-Extra: aws
|
|
51
|
+
Requires-Dist: boto3>=1.34.0; extra == 'aws'
|
|
52
|
+
Provides-Extra: azure
|
|
53
|
+
Requires-Dist: azure-identity>=1.16.0; extra == 'azure'
|
|
54
|
+
Provides-Extra: dev
|
|
55
|
+
Requires-Dist: build>=1.2.0; extra == 'dev'
|
|
56
|
+
Requires-Dist: pyshacl>=0.26.0; extra == 'dev'
|
|
57
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
58
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
59
|
+
Requires-Dist: pytest>=8.2.0; extra == 'dev'
|
|
60
|
+
Requires-Dist: rdflib>=7.0.0; extra == 'dev'
|
|
61
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
62
|
+
Requires-Dist: twine>=5.0.0; extra == 'dev'
|
|
63
|
+
Provides-Extra: gcp
|
|
64
|
+
Requires-Dist: google-auth>=2.29.0; extra == 'gcp'
|
|
65
|
+
Provides-Extra: local-embed
|
|
66
|
+
Requires-Dist: sentence-transformers>=3.0.0; extra == 'local-embed'
|
|
67
|
+
Provides-Extra: neptune
|
|
68
|
+
Requires-Dist: boto3>=1.34.0; extra == 'neptune'
|
|
69
|
+
Provides-Extra: ontology
|
|
70
|
+
Requires-Dist: pyshacl>=0.26.0; extra == 'ontology'
|
|
71
|
+
Requires-Dist: rdflib>=7.0.0; extra == 'ontology'
|
|
72
|
+
Provides-Extra: opensearch
|
|
73
|
+
Requires-Dist: opensearch-py[async]>=2.6.0; extra == 'opensearch'
|
|
74
|
+
Description-Content-Type: text/markdown
|
|
75
|
+
|
|
76
|
+
# Agentic Composite Memory (`agentic-composite-memory`)
|
|
77
|
+
|
|
78
|
+
An enterprise-grade, **domain-agnostic**, multi-tenant **Composite Memory SDK, FastAPI Service & MCP Server** engineered for **Google Agent Development Kit (ADK)** and multi-agent A2A ecosystems.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Core SDK, ADK Integration, FastAPI + MCP Server, Postgres/Redis/Neo4j adapters
|
|
86
|
+
pip install agentic-composite-memory
|
|
87
|
+
|
|
88
|
+
# With Cloud IAM Auth & Bedrock / Cloud extras
|
|
89
|
+
pip install "agentic-composite-memory[aws,gcp,azure,ontology]"
|
|
90
|
+
|
|
91
|
+
# Everything included
|
|
92
|
+
pip install "agentic-composite-memory[all]"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Key Capabilities
|
|
98
|
+
|
|
99
|
+
1. **3-Layer Ontology-Grounded Memory**:
|
|
100
|
+
- **Layer 0 (Platform Upper Ontology)**: Built-in meta-graph (`p:Actor`, `p:Object`, `p:Event`, `p:Concept`, `p:CandidateConcept`) with zero configuration required.
|
|
101
|
+
- **Layer 1 (Federated Domain Packs)**: Register domain ontologies via **JSON/YAML**, **Python Pydantic models**, or **W3C OWL/SHACL Turtle (`.ttl`)** files using `DomainPackLoader`.
|
|
102
|
+
- **Layer 2 (App-Local Extensions & Emergent Overflow)**: Two-bucket runtime governance (`TBoxRuntimeValidator`) routes validated facts to `domain:{tenant}:{domain}` and novel concepts to `app:{tenant}:{app}` with automated ontology promotion (`evolve_app_ontology_from_overflow`).
|
|
103
|
+
|
|
104
|
+
2. **3-Tier Context Graph + Procedural Playbooks**:
|
|
105
|
+
- **Tier 1 (Episodic & Seed Store)**: Hybrid RRF search (`pgvector` HNSW + BM25 GIN) with pinned user preferences and `PIIScrubber`.
|
|
106
|
+
- **Tier 2 (Bi-Temporal Semantic Knowledge Graph)**: Multi-hop reasoning (`max_hops=2`), temporal edge invalidation (`t_valid`, `t_invalid`), and `EntityResolutionGuard`.
|
|
107
|
+
- **Tier 3 (Procedural Reasoning Traces & Playbooks)**: Records agent tool-call trajectories and caches high-reward reusable playbooks.
|
|
108
|
+
|
|
109
|
+
3. **Hot-Path vs. Sleep-Time Batch Extraction**:
|
|
110
|
+
- `ExtractionMode.HOT_PATH`: Immediate LLM/rule ontology extraction on every turn.
|
|
111
|
+
- `ExtractionMode.SLEEP_TIME_BATCH`: Sub-10ms raw episodic write on the hot path, with background batch ontology extraction during `run_memory_maintenance()`.
|
|
112
|
+
|
|
113
|
+
4. **Independent Per-Port or Single-Stack Database Adapters**:
|
|
114
|
+
- Run **100% on PostgreSQL** (`CompositeMemoryService.from_postgres_stack`), **100% on Redis** (`CompositeMemoryService.from_redis_stack`), or **Mix-and-Match** per port (e.g., PostgreSQL + Neo4j/Neptune + Redis).
|
|
115
|
+
- Built-in **Enterprise Cloud DB Auth** (`AwsIamDatabaseAuthProvider`, `GcpCloudSqlIamAuthProvider`, `AzureEntraDatabaseAuthProvider`, `VaultOrSecretManagerAuthProvider`, and `EnterpriseTlsConfig` mTLS).
|
|
116
|
+
|
|
117
|
+
5. **Multi-Provider LLM & Embedding Adapters**:
|
|
118
|
+
- Google **Gemini**, **Amazon Bedrock** (Claude/Nova + Titan/Cohere Embeddings), **OpenAI / Azure OpenAI / vLLM**, **Ollama**, and local **SentenceTransformers**.
|
|
119
|
+
|
|
120
|
+
6. **Unified FastAPI + MCP Server in One Pod**:
|
|
121
|
+
- `adk-memory serve-api` serves both REST (`/v1/...`) and MCP (`/mcp/http`, `/mcp/sse`, `/v1/mcp/tools`, `/v1/mcp/call`) simultaneously.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Quickstart
|
|
126
|
+
|
|
127
|
+
### 1. Single-Stack PostgreSQL or Redis Factory
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from agentic_memory_sdk import (
|
|
131
|
+
CompositeMemoryService,
|
|
132
|
+
BedrockEmbeddingAdapter,
|
|
133
|
+
BedrockOntologyExtractorAdapter,
|
|
134
|
+
AwsIamDatabaseAuthProvider,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# Example: 100% PostgreSQL stack with AWS RDS IAM Auth + Amazon Bedrock
|
|
138
|
+
auth = AwsIamDatabaseAuthProvider(region="us-east-1", service="rds-db")
|
|
139
|
+
service = CompositeMemoryService.from_postgres_stack(
|
|
140
|
+
dsn="postgresql://iam_user@mydb.cluster.us-east-1.rds.amazonaws.com:5432/memory",
|
|
141
|
+
embedding_adapter=BedrockEmbeddingAdapter(region="us-east-1", target_dim=16),
|
|
142
|
+
extractor_adapter=BedrockOntologyExtractorAdapter(region="us-east-1"),
|
|
143
|
+
auth_provider=auth,
|
|
144
|
+
)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 2. Extending `agentic-memory-sdk` with Custom Adapters
|
|
148
|
+
|
|
149
|
+
Every boundary in `agentic-memory-sdk` is a structural `typing.Protocol` in `agentic_memory_sdk.ports` and `agentic_memory_sdk.auth`. You can extend any port without subclassing internal classes:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from agentic_memory_sdk.ports import EmbeddingAdapter, PlaybookStoreAdapter
|
|
153
|
+
from agentic_memory_sdk.models import PlaybookRecord
|
|
154
|
+
|
|
155
|
+
class MyCustomEmbeddingAdapter:
|
|
156
|
+
"""Implements EmbeddingAdapter Protocol via structural subtyping."""
|
|
157
|
+
async def embed(self, text: str) -> list[float]:
|
|
158
|
+
# Call your custom internal embedding gateway
|
|
159
|
+
return [0.1] * 16
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 3. Running the Unified FastAPI + MCP Server
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Start unified REST + MCP server on port 8095
|
|
166
|
+
adk-memory serve-api --host 0.0.0.0 --port 8095 --mode in_memory
|
|
167
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Agentic Composite Memory (`agentic-composite-memory`)
|
|
2
|
+
|
|
3
|
+
An enterprise-grade, **domain-agnostic**, multi-tenant **Composite Memory SDK, FastAPI Service & MCP Server** engineered for **Google Agent Development Kit (ADK)** and multi-agent A2A ecosystems.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Core SDK, ADK Integration, FastAPI + MCP Server, Postgres/Redis/Neo4j adapters
|
|
11
|
+
pip install agentic-composite-memory
|
|
12
|
+
|
|
13
|
+
# With Cloud IAM Auth & Bedrock / Cloud extras
|
|
14
|
+
pip install "agentic-composite-memory[aws,gcp,azure,ontology]"
|
|
15
|
+
|
|
16
|
+
# Everything included
|
|
17
|
+
pip install "agentic-composite-memory[all]"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Key Capabilities
|
|
23
|
+
|
|
24
|
+
1. **3-Layer Ontology-Grounded Memory**:
|
|
25
|
+
- **Layer 0 (Platform Upper Ontology)**: Built-in meta-graph (`p:Actor`, `p:Object`, `p:Event`, `p:Concept`, `p:CandidateConcept`) with zero configuration required.
|
|
26
|
+
- **Layer 1 (Federated Domain Packs)**: Register domain ontologies via **JSON/YAML**, **Python Pydantic models**, or **W3C OWL/SHACL Turtle (`.ttl`)** files using `DomainPackLoader`.
|
|
27
|
+
- **Layer 2 (App-Local Extensions & Emergent Overflow)**: Two-bucket runtime governance (`TBoxRuntimeValidator`) routes validated facts to `domain:{tenant}:{domain}` and novel concepts to `app:{tenant}:{app}` with automated ontology promotion (`evolve_app_ontology_from_overflow`).
|
|
28
|
+
|
|
29
|
+
2. **3-Tier Context Graph + Procedural Playbooks**:
|
|
30
|
+
- **Tier 1 (Episodic & Seed Store)**: Hybrid RRF search (`pgvector` HNSW + BM25 GIN) with pinned user preferences and `PIIScrubber`.
|
|
31
|
+
- **Tier 2 (Bi-Temporal Semantic Knowledge Graph)**: Multi-hop reasoning (`max_hops=2`), temporal edge invalidation (`t_valid`, `t_invalid`), and `EntityResolutionGuard`.
|
|
32
|
+
- **Tier 3 (Procedural Reasoning Traces & Playbooks)**: Records agent tool-call trajectories and caches high-reward reusable playbooks.
|
|
33
|
+
|
|
34
|
+
3. **Hot-Path vs. Sleep-Time Batch Extraction**:
|
|
35
|
+
- `ExtractionMode.HOT_PATH`: Immediate LLM/rule ontology extraction on every turn.
|
|
36
|
+
- `ExtractionMode.SLEEP_TIME_BATCH`: Sub-10ms raw episodic write on the hot path, with background batch ontology extraction during `run_memory_maintenance()`.
|
|
37
|
+
|
|
38
|
+
4. **Independent Per-Port or Single-Stack Database Adapters**:
|
|
39
|
+
- Run **100% on PostgreSQL** (`CompositeMemoryService.from_postgres_stack`), **100% on Redis** (`CompositeMemoryService.from_redis_stack`), or **Mix-and-Match** per port (e.g., PostgreSQL + Neo4j/Neptune + Redis).
|
|
40
|
+
- Built-in **Enterprise Cloud DB Auth** (`AwsIamDatabaseAuthProvider`, `GcpCloudSqlIamAuthProvider`, `AzureEntraDatabaseAuthProvider`, `VaultOrSecretManagerAuthProvider`, and `EnterpriseTlsConfig` mTLS).
|
|
41
|
+
|
|
42
|
+
5. **Multi-Provider LLM & Embedding Adapters**:
|
|
43
|
+
- Google **Gemini**, **Amazon Bedrock** (Claude/Nova + Titan/Cohere Embeddings), **OpenAI / Azure OpenAI / vLLM**, **Ollama**, and local **SentenceTransformers**.
|
|
44
|
+
|
|
45
|
+
6. **Unified FastAPI + MCP Server in One Pod**:
|
|
46
|
+
- `adk-memory serve-api` serves both REST (`/v1/...`) and MCP (`/mcp/http`, `/mcp/sse`, `/v1/mcp/tools`, `/v1/mcp/call`) simultaneously.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quickstart
|
|
51
|
+
|
|
52
|
+
### 1. Single-Stack PostgreSQL or Redis Factory
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from agentic_memory_sdk import (
|
|
56
|
+
CompositeMemoryService,
|
|
57
|
+
BedrockEmbeddingAdapter,
|
|
58
|
+
BedrockOntologyExtractorAdapter,
|
|
59
|
+
AwsIamDatabaseAuthProvider,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Example: 100% PostgreSQL stack with AWS RDS IAM Auth + Amazon Bedrock
|
|
63
|
+
auth = AwsIamDatabaseAuthProvider(region="us-east-1", service="rds-db")
|
|
64
|
+
service = CompositeMemoryService.from_postgres_stack(
|
|
65
|
+
dsn="postgresql://iam_user@mydb.cluster.us-east-1.rds.amazonaws.com:5432/memory",
|
|
66
|
+
embedding_adapter=BedrockEmbeddingAdapter(region="us-east-1", target_dim=16),
|
|
67
|
+
extractor_adapter=BedrockOntologyExtractorAdapter(region="us-east-1"),
|
|
68
|
+
auth_provider=auth,
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Extending `agentic-memory-sdk` with Custom Adapters
|
|
73
|
+
|
|
74
|
+
Every boundary in `agentic-memory-sdk` is a structural `typing.Protocol` in `agentic_memory_sdk.ports` and `agentic_memory_sdk.auth`. You can extend any port without subclassing internal classes:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from agentic_memory_sdk.ports import EmbeddingAdapter, PlaybookStoreAdapter
|
|
78
|
+
from agentic_memory_sdk.models import PlaybookRecord
|
|
79
|
+
|
|
80
|
+
class MyCustomEmbeddingAdapter:
|
|
81
|
+
"""Implements EmbeddingAdapter Protocol via structural subtyping."""
|
|
82
|
+
async def embed(self, text: str) -> list[float]:
|
|
83
|
+
# Call your custom internal embedding gateway
|
|
84
|
+
return [0.1] * 16
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Running the Unified FastAPI + MCP Server
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Start unified REST + MCP server on port 8095
|
|
91
|
+
adk-memory serve-api --host 0.0.0.0 --port 8095 --mode in_memory
|
|
92
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agentic-composite-memory"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Enterprise Multi-Tenant Ontology-Grounded Composite Memory SDK, MCP Server & Platform Service for Google ADK Agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = [
|
|
13
|
+
"google-adk",
|
|
14
|
+
"a2a",
|
|
15
|
+
"mcp",
|
|
16
|
+
"agent-memory",
|
|
17
|
+
"knowledge-graph",
|
|
18
|
+
"bitemporal",
|
|
19
|
+
"ontology",
|
|
20
|
+
"pgvector",
|
|
21
|
+
"neo4j",
|
|
22
|
+
"neptune",
|
|
23
|
+
"opensearch",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"License :: OSI Approved :: Apache Software License",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
33
|
+
"Typing :: Typed",
|
|
34
|
+
]
|
|
35
|
+
dependencies = [
|
|
36
|
+
"pydantic>=2.7.0",
|
|
37
|
+
"fastapi>=0.111.0",
|
|
38
|
+
"httpx>=0.27.0",
|
|
39
|
+
"uvicorn>=0.30.0",
|
|
40
|
+
"asyncpg>=0.29.0",
|
|
41
|
+
"neo4j>=5.20.0",
|
|
42
|
+
"redis>=5.0.0",
|
|
43
|
+
"mcp>=1.2.0",
|
|
44
|
+
"google-adk[a2a]>=2.8.0",
|
|
45
|
+
"a2a-sdk>=1.1.2",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.scripts]
|
|
49
|
+
adk-memory = "agentic_memory_sdk.cli:main"
|
|
50
|
+
|
|
51
|
+
[project.optional-dependencies]
|
|
52
|
+
aws = [
|
|
53
|
+
"boto3>=1.34.0",
|
|
54
|
+
]
|
|
55
|
+
gcp = [
|
|
56
|
+
"google-auth>=2.29.0",
|
|
57
|
+
]
|
|
58
|
+
azure = [
|
|
59
|
+
"azure-identity>=1.16.0",
|
|
60
|
+
]
|
|
61
|
+
local-embed = [
|
|
62
|
+
"sentence-transformers>=3.0.0",
|
|
63
|
+
]
|
|
64
|
+
opensearch = [
|
|
65
|
+
"opensearch-py[async]>=2.6.0",
|
|
66
|
+
]
|
|
67
|
+
neptune = [
|
|
68
|
+
"boto3>=1.34.0",
|
|
69
|
+
]
|
|
70
|
+
ontology = [
|
|
71
|
+
"rdflib>=7.0.0",
|
|
72
|
+
"pyshacl>=0.26.0",
|
|
73
|
+
]
|
|
74
|
+
all = [
|
|
75
|
+
"boto3>=1.34.0",
|
|
76
|
+
"google-auth>=2.29.0",
|
|
77
|
+
"azure-identity>=1.16.0",
|
|
78
|
+
"opensearch-py[async]>=2.6.0",
|
|
79
|
+
"rdflib>=7.0.0",
|
|
80
|
+
"pyshacl>=0.26.0",
|
|
81
|
+
]
|
|
82
|
+
dev = [
|
|
83
|
+
"pytest>=8.2.0",
|
|
84
|
+
"pytest-asyncio>=0.23.0",
|
|
85
|
+
"pytest-cov>=5.0.0",
|
|
86
|
+
"ruff>=0.4.0",
|
|
87
|
+
"build>=1.2.0",
|
|
88
|
+
"twine>=5.0.0",
|
|
89
|
+
"rdflib>=7.0.0",
|
|
90
|
+
"pyshacl>=0.26.0",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[tool.ruff]
|
|
94
|
+
line-length = 120
|
|
95
|
+
target-version = "py311"
|
|
96
|
+
|
|
97
|
+
[tool.ruff.lint]
|
|
98
|
+
select = ["E", "F"]
|
|
99
|
+
ignore = ["E501"]
|
|
100
|
+
|
|
101
|
+
[tool.hatch.build.targets.wheel]
|
|
102
|
+
packages = ["src/agentic_memory_sdk", "src/agentic_composite_memory"]
|
|
103
|
+
|
|
104
|
+
[tool.hatch.build.targets.sdist]
|
|
105
|
+
include = [
|
|
106
|
+
"src/agentic_memory_sdk/**",
|
|
107
|
+
"src/agentic_composite_memory/**",
|
|
108
|
+
"README.md",
|
|
109
|
+
"LICENSE",
|
|
110
|
+
"pyproject.toml",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
[tool.pytest.ini_options]
|
|
114
|
+
asyncio_mode = "auto"
|
|
115
|
+
pythonpath = ["src", "."]
|
|
116
|
+
testpaths = ["tests"]
|
|
117
|
+
filterwarnings = [
|
|
118
|
+
"ignore::UserWarning",
|
|
119
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
from .adapters import (
|
|
2
|
+
InMemoryUnifiedAdapter,
|
|
3
|
+
Neo4jGraphAdapter,
|
|
4
|
+
NeptuneOpenCypherAdapter,
|
|
5
|
+
OpenSearchSeedAdapter,
|
|
6
|
+
PostgresGraphAdapter,
|
|
7
|
+
PostgresPgVectorAdapter,
|
|
8
|
+
PostgresPlaybookAdapter,
|
|
9
|
+
PostgresUnifiedAdapter,
|
|
10
|
+
RedisEpisodicAndSeedAdapter,
|
|
11
|
+
RedisGraphAdapter,
|
|
12
|
+
RedisPlaybookAndWorkingAdapter,
|
|
13
|
+
RedisRegistryAdapter,
|
|
14
|
+
RedisUnifiedAdapter,
|
|
15
|
+
)
|
|
16
|
+
from .adk_integration import (
|
|
17
|
+
RemoteCompositeMemoryService,
|
|
18
|
+
get_adk_memory_tools,
|
|
19
|
+
non_blocking_memory_commit_callback,
|
|
20
|
+
)
|
|
21
|
+
from .auth import (
|
|
22
|
+
AwsIamDatabaseAuthProvider,
|
|
23
|
+
AzureEntraDatabaseAuthProvider,
|
|
24
|
+
CachedTokenAuthProviderBase,
|
|
25
|
+
CloudAuthProvider,
|
|
26
|
+
EnterpriseTlsConfig,
|
|
27
|
+
GcpCloudSqlIamAuthProvider,
|
|
28
|
+
StaticOrEnvAuthProvider,
|
|
29
|
+
VaultOrSecretManagerAuthProvider,
|
|
30
|
+
)
|
|
31
|
+
from .governance import (
|
|
32
|
+
AsyncCircuitBreaker,
|
|
33
|
+
EntityResolutionGuard,
|
|
34
|
+
PIIScrubber,
|
|
35
|
+
PlatformOntologyRegistrar,
|
|
36
|
+
SmartMemoryClassifier,
|
|
37
|
+
TBoxRuntimeValidator,
|
|
38
|
+
TenantRateLimiter,
|
|
39
|
+
TokenBudgetSerializer,
|
|
40
|
+
)
|
|
41
|
+
from .llm_extractors import (
|
|
42
|
+
BedrockEmbeddingAdapter,
|
|
43
|
+
BedrockOntologyExtractorAdapter,
|
|
44
|
+
DeterministicHashEmbeddingAdapter,
|
|
45
|
+
GeminiEmbeddingAdapter,
|
|
46
|
+
GeminiOntologyExtractorAdapter,
|
|
47
|
+
LocalSentenceTransformerEmbeddingAdapter,
|
|
48
|
+
OllamaEmbeddingAdapter,
|
|
49
|
+
OllamaOntologyExtractorAdapter,
|
|
50
|
+
OpenAICompatibleEmbeddingAdapter,
|
|
51
|
+
OpenAICompatibleOntologyExtractorAdapter,
|
|
52
|
+
RuleBasedMockExtractorAdapter,
|
|
53
|
+
)
|
|
54
|
+
from .models import (
|
|
55
|
+
AppMemoryManifest,
|
|
56
|
+
CompiledTBox,
|
|
57
|
+
DomainPackSpec,
|
|
58
|
+
EpisodicRecord,
|
|
59
|
+
ExtractedEntity,
|
|
60
|
+
ExtractedFact,
|
|
61
|
+
ExtractionMode,
|
|
62
|
+
ExtractionPayload,
|
|
63
|
+
GovernanceTier,
|
|
64
|
+
GraphEdgeMutation,
|
|
65
|
+
GraphFactReadResult,
|
|
66
|
+
GraphVertexUpsert,
|
|
67
|
+
MemoryScope,
|
|
68
|
+
OntologyAuditLogEntry,
|
|
69
|
+
OutboxOperation,
|
|
70
|
+
PlatformTenantContext,
|
|
71
|
+
PlaybookRecord,
|
|
72
|
+
ReasoningTraceStep,
|
|
73
|
+
RelationRule,
|
|
74
|
+
UpperConceptType,
|
|
75
|
+
)
|
|
76
|
+
from .ontology_loader import DomainPackLoader
|
|
77
|
+
from .ports import (
|
|
78
|
+
EmbeddingAdapter,
|
|
79
|
+
EpisodicAndSeedStoreAdapter,
|
|
80
|
+
GraphStoreAdapter,
|
|
81
|
+
OntologyExtractorAdapter,
|
|
82
|
+
PlaybookStoreAdapter,
|
|
83
|
+
RegistryStoreAdapter,
|
|
84
|
+
)
|
|
85
|
+
from .server import MemoryMcpServerTools, create_mcp_server, create_memory_platform_app
|
|
86
|
+
from .service import CompositeMemoryService
|
|
87
|
+
|
|
88
|
+
__all__ = [
|
|
89
|
+
"UpperConceptType",
|
|
90
|
+
"GovernanceTier",
|
|
91
|
+
"RelationRule",
|
|
92
|
+
"DomainPackSpec",
|
|
93
|
+
"AppMemoryManifest",
|
|
94
|
+
"CompiledTBox",
|
|
95
|
+
"PlatformTenantContext",
|
|
96
|
+
"EpisodicRecord",
|
|
97
|
+
"ExtractedEntity",
|
|
98
|
+
"ExtractedFact",
|
|
99
|
+
"ExtractionMode",
|
|
100
|
+
"ExtractionPayload",
|
|
101
|
+
"GraphVertexUpsert",
|
|
102
|
+
"GraphEdgeMutation",
|
|
103
|
+
"GraphFactReadResult",
|
|
104
|
+
"ReasoningTraceStep",
|
|
105
|
+
"PlaybookRecord",
|
|
106
|
+
"OutboxOperation",
|
|
107
|
+
"OntologyAuditLogEntry",
|
|
108
|
+
"MemoryScope",
|
|
109
|
+
"CloudAuthProvider",
|
|
110
|
+
"EnterpriseTlsConfig",
|
|
111
|
+
"CachedTokenAuthProviderBase",
|
|
112
|
+
"StaticOrEnvAuthProvider",
|
|
113
|
+
"AwsIamDatabaseAuthProvider",
|
|
114
|
+
"GcpCloudSqlIamAuthProvider",
|
|
115
|
+
"AzureEntraDatabaseAuthProvider",
|
|
116
|
+
"VaultOrSecretManagerAuthProvider",
|
|
117
|
+
"PIIScrubber",
|
|
118
|
+
"EntityResolutionGuard",
|
|
119
|
+
"SmartMemoryClassifier",
|
|
120
|
+
"TBoxRuntimeValidator",
|
|
121
|
+
"PlatformOntologyRegistrar",
|
|
122
|
+
"AsyncCircuitBreaker",
|
|
123
|
+
"TenantRateLimiter",
|
|
124
|
+
"TokenBudgetSerializer",
|
|
125
|
+
"DomainPackLoader",
|
|
126
|
+
"RegistryStoreAdapter",
|
|
127
|
+
"EpisodicAndSeedStoreAdapter",
|
|
128
|
+
"GraphStoreAdapter",
|
|
129
|
+
"PlaybookStoreAdapter",
|
|
130
|
+
"EmbeddingAdapter",
|
|
131
|
+
"OntologyExtractorAdapter",
|
|
132
|
+
"InMemoryUnifiedAdapter",
|
|
133
|
+
"PostgresPgVectorAdapter",
|
|
134
|
+
"PostgresGraphAdapter",
|
|
135
|
+
"PostgresPlaybookAdapter",
|
|
136
|
+
"PostgresUnifiedAdapter",
|
|
137
|
+
"OpenSearchSeedAdapter",
|
|
138
|
+
"NeptuneOpenCypherAdapter",
|
|
139
|
+
"Neo4jGraphAdapter",
|
|
140
|
+
"RedisRegistryAdapter",
|
|
141
|
+
"RedisEpisodicAndSeedAdapter",
|
|
142
|
+
"RedisGraphAdapter",
|
|
143
|
+
"RedisPlaybookAndWorkingAdapter",
|
|
144
|
+
"RedisUnifiedAdapter",
|
|
145
|
+
"GeminiEmbeddingAdapter",
|
|
146
|
+
"GeminiOntologyExtractorAdapter",
|
|
147
|
+
"BedrockEmbeddingAdapter",
|
|
148
|
+
"BedrockOntologyExtractorAdapter",
|
|
149
|
+
"OpenAICompatibleEmbeddingAdapter",
|
|
150
|
+
"OpenAICompatibleOntologyExtractorAdapter",
|
|
151
|
+
"OllamaEmbeddingAdapter",
|
|
152
|
+
"OllamaOntologyExtractorAdapter",
|
|
153
|
+
"LocalSentenceTransformerEmbeddingAdapter",
|
|
154
|
+
"DeterministicHashEmbeddingAdapter",
|
|
155
|
+
"RuleBasedMockExtractorAdapter",
|
|
156
|
+
"CompositeMemoryService",
|
|
157
|
+
"RemoteCompositeMemoryService",
|
|
158
|
+
"non_blocking_memory_commit_callback",
|
|
159
|
+
"get_adk_memory_tools",
|
|
160
|
+
"create_memory_platform_app",
|
|
161
|
+
"MemoryMcpServerTools",
|
|
162
|
+
"create_mcp_server",
|
|
163
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from .in_memory import InMemoryUnifiedAdapter
|
|
2
|
+
from .neo4j_cypher import Neo4jGraphAdapter
|
|
3
|
+
from .neptune_cypher import NeptuneOpenCypherAdapter
|
|
4
|
+
from .opensearch_seed import OpenSearchSeedAdapter
|
|
5
|
+
from .postgres_pgvector import PostgresPgVectorAdapter
|
|
6
|
+
from .postgres_unified import (
|
|
7
|
+
PostgresGraphAdapter,
|
|
8
|
+
PostgresPlaybookAdapter,
|
|
9
|
+
PostgresUnifiedAdapter,
|
|
10
|
+
)
|
|
11
|
+
from .redis_playbook import RedisPlaybookAndWorkingAdapter
|
|
12
|
+
from .redis_unified import (
|
|
13
|
+
RedisEpisodicAndSeedAdapter,
|
|
14
|
+
RedisGraphAdapter,
|
|
15
|
+
RedisRegistryAdapter,
|
|
16
|
+
RedisUnifiedAdapter,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"InMemoryUnifiedAdapter",
|
|
21
|
+
"PostgresPgVectorAdapter",
|
|
22
|
+
"PostgresGraphAdapter",
|
|
23
|
+
"PostgresPlaybookAdapter",
|
|
24
|
+
"PostgresUnifiedAdapter",
|
|
25
|
+
"OpenSearchSeedAdapter",
|
|
26
|
+
"NeptuneOpenCypherAdapter",
|
|
27
|
+
"Neo4jGraphAdapter",
|
|
28
|
+
"RedisRegistryAdapter",
|
|
29
|
+
"RedisEpisodicAndSeedAdapter",
|
|
30
|
+
"RedisGraphAdapter",
|
|
31
|
+
"RedisPlaybookAndWorkingAdapter",
|
|
32
|
+
"RedisUnifiedAdapter",
|
|
33
|
+
]
|