atomicmemory 1.0.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.
- atomicmemory-1.0.0/.gitignore +55 -0
- atomicmemory-1.0.0/CHANGELOG.md +20 -0
- atomicmemory-1.0.0/LICENSE +21 -0
- atomicmemory-1.0.0/PKG-INFO +146 -0
- atomicmemory-1.0.0/README.md +108 -0
- atomicmemory-1.0.0/atomicmemory/__init__.py +166 -0
- atomicmemory-1.0.0/atomicmemory/_version.py +3 -0
- atomicmemory-1.0.0/atomicmemory/client/__init__.py +22 -0
- atomicmemory-1.0.0/atomicmemory/client/async_memory_client.py +202 -0
- atomicmemory-1.0.0/atomicmemory/client/atomic_memory_client.py +181 -0
- atomicmemory-1.0.0/atomicmemory/client/memory_client.py +292 -0
- atomicmemory-1.0.0/atomicmemory/core/__init__.py +34 -0
- atomicmemory-1.0.0/atomicmemory/core/errors.py +122 -0
- atomicmemory-1.0.0/atomicmemory/core/events.py +65 -0
- atomicmemory-1.0.0/atomicmemory/core/logging.py +37 -0
- atomicmemory-1.0.0/atomicmemory/core/retry.py +124 -0
- atomicmemory-1.0.0/atomicmemory/core/validation.py +22 -0
- atomicmemory-1.0.0/atomicmemory/embeddings/__init__.py +16 -0
- atomicmemory-1.0.0/atomicmemory/embeddings/base.py +39 -0
- atomicmemory-1.0.0/atomicmemory/embeddings/sentence_transformers.py +104 -0
- atomicmemory-1.0.0/atomicmemory/kv_cache/__init__.py +17 -0
- atomicmemory-1.0.0/atomicmemory/kv_cache/adapter.py +50 -0
- atomicmemory-1.0.0/atomicmemory/kv_cache/memory_storage.py +98 -0
- atomicmemory-1.0.0/atomicmemory/kv_cache/sqlite_storage.py +122 -0
- atomicmemory-1.0.0/atomicmemory/memory/__init__.py +82 -0
- atomicmemory-1.0.0/atomicmemory/memory/filters.py +68 -0
- atomicmemory-1.0.0/atomicmemory/memory/pipeline.py +42 -0
- atomicmemory-1.0.0/atomicmemory/memory/provider.py +397 -0
- atomicmemory-1.0.0/atomicmemory/memory/registry.py +95 -0
- atomicmemory-1.0.0/atomicmemory/memory/service.py +199 -0
- atomicmemory-1.0.0/atomicmemory/memory/types.py +398 -0
- atomicmemory-1.0.0/atomicmemory/providers/__init__.py +5 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/__init__.py +43 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/agents.py +156 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/async_handle_impl.py +198 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/async_provider.py +245 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/audit.py +74 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/config.py +38 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/config_handle.py +123 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/handle.py +513 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/handle_impl.py +325 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/http.py +255 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/lessons.py +133 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/lifecycle.py +202 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/mappers.py +125 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/path.py +20 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/provider.py +300 -0
- atomicmemory-1.0.0/atomicmemory/providers/atomicmemory/scope_mapper.py +98 -0
- atomicmemory-1.0.0/atomicmemory/providers/mem0/__init__.py +41 -0
- atomicmemory-1.0.0/atomicmemory/providers/mem0/async_provider.py +191 -0
- atomicmemory-1.0.0/atomicmemory/providers/mem0/config.py +51 -0
- atomicmemory-1.0.0/atomicmemory/providers/mem0/http.py +195 -0
- atomicmemory-1.0.0/atomicmemory/providers/mem0/mappers.py +145 -0
- atomicmemory-1.0.0/atomicmemory/providers/mem0/provider.py +202 -0
- atomicmemory-1.0.0/atomicmemory/py.typed +0 -0
- atomicmemory-1.0.0/atomicmemory/search/__init__.py +47 -0
- atomicmemory-1.0.0/atomicmemory/search/chunking.py +161 -0
- atomicmemory-1.0.0/atomicmemory/search/ranking.py +94 -0
- atomicmemory-1.0.0/atomicmemory/search/semantic_search.py +130 -0
- atomicmemory-1.0.0/atomicmemory/search/similarity.py +110 -0
- atomicmemory-1.0.0/atomicmemory/storage/__init__.py +63 -0
- atomicmemory-1.0.0/atomicmemory/storage/_mapping.py +305 -0
- atomicmemory-1.0.0/atomicmemory/storage/async_client.py +208 -0
- atomicmemory-1.0.0/atomicmemory/storage/client.py +339 -0
- atomicmemory-1.0.0/atomicmemory/storage/errors.py +115 -0
- atomicmemory-1.0.0/atomicmemory/storage/types.py +305 -0
- atomicmemory-1.0.0/atomicmemory/utils/__init__.py +5 -0
- atomicmemory-1.0.0/atomicmemory/utils/environment.py +23 -0
- atomicmemory-1.0.0/examples/async_pipeline.py +22 -0
- atomicmemory-1.0.0/examples/basic_ingest_search.py +33 -0
- atomicmemory-1.0.0/examples/local_search.py +31 -0
- atomicmemory-1.0.0/pyproject.toml +117 -0
- atomicmemory-1.0.0/tests/__init__.py +0 -0
- atomicmemory-1.0.0/tests/client/__init__.py +0 -0
- atomicmemory-1.0.0/tests/client/test_async_memory_client.py +115 -0
- atomicmemory-1.0.0/tests/client/test_atomic_memory_client.py +87 -0
- atomicmemory-1.0.0/tests/client/test_memory_client.py +233 -0
- atomicmemory-1.0.0/tests/conftest.py +36 -0
- atomicmemory-1.0.0/tests/core/__init__.py +0 -0
- atomicmemory-1.0.0/tests/core/test_errors.py +59 -0
- atomicmemory-1.0.0/tests/core/test_events.py +64 -0
- atomicmemory-1.0.0/tests/core/test_retry.py +103 -0
- atomicmemory-1.0.0/tests/embeddings/__init__.py +0 -0
- atomicmemory-1.0.0/tests/embeddings/test_sentence_transformers.py +33 -0
- atomicmemory-1.0.0/tests/kv_cache/__init__.py +0 -0
- atomicmemory-1.0.0/tests/kv_cache/test_memory_storage.py +79 -0
- atomicmemory-1.0.0/tests/kv_cache/test_sqlite_storage.py +95 -0
- atomicmemory-1.0.0/tests/memory/__init__.py +0 -0
- atomicmemory-1.0.0/tests/memory/test_filters.py +55 -0
- atomicmemory-1.0.0/tests/memory/test_provider_base.py +104 -0
- atomicmemory-1.0.0/tests/memory/test_registry.py +78 -0
- atomicmemory-1.0.0/tests/memory/test_service.py +109 -0
- atomicmemory-1.0.0/tests/memory/test_types.py +88 -0
- atomicmemory-1.0.0/tests/providers/__init__.py +0 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/__init__.py +0 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_async_provider.py +213 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_handle_agents.py +67 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_handle_audit.py +106 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_handle_base.py +174 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_handle_config.py +84 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_handle_lessons.py +82 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_handle_lifecycle.py +143 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_http.py +85 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_mappers.py +123 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_path.py +24 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_provider.py +267 -0
- atomicmemory-1.0.0/tests/providers/atomicmemory/test_scope_mapper.py +66 -0
- atomicmemory-1.0.0/tests/providers/mem0/__init__.py +0 -0
- atomicmemory-1.0.0/tests/providers/mem0/test_mappers.py +103 -0
- atomicmemory-1.0.0/tests/providers/mem0/test_provider.py +133 -0
- atomicmemory-1.0.0/tests/search/__init__.py +0 -0
- atomicmemory-1.0.0/tests/search/test_chunking.py +59 -0
- atomicmemory-1.0.0/tests/search/test_semantic_search.py +86 -0
- atomicmemory-1.0.0/tests/search/test_similarity.py +53 -0
- atomicmemory-1.0.0/tests/storage/__init__.py +1 -0
- atomicmemory-1.0.0/tests/storage/test_async_storage_client.py +65 -0
- atomicmemory-1.0.0/tests/storage/test_storage_client.py +274 -0
- atomicmemory-1.0.0/tests/test_package_imports.py +40 -0
- atomicmemory-1.0.0/uv.lock +1985 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
env/
|
|
27
|
+
ENV/
|
|
28
|
+
|
|
29
|
+
# uv
|
|
30
|
+
.uv-cache/
|
|
31
|
+
|
|
32
|
+
# Tooling
|
|
33
|
+
.mypy_cache/
|
|
34
|
+
.ruff_cache/
|
|
35
|
+
.pytest_cache/
|
|
36
|
+
.coverage
|
|
37
|
+
.coverage.*
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.hypothesis/
|
|
41
|
+
|
|
42
|
+
# Editor
|
|
43
|
+
.vscode/
|
|
44
|
+
.idea/
|
|
45
|
+
*.swp
|
|
46
|
+
*.swo
|
|
47
|
+
|
|
48
|
+
# OS
|
|
49
|
+
.DS_Store
|
|
50
|
+
Thumbs.db
|
|
51
|
+
|
|
52
|
+
# Local
|
|
53
|
+
*.log
|
|
54
|
+
.env
|
|
55
|
+
.env.local
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `atomicmemory` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [1.0.0]
|
|
10
|
+
|
|
11
|
+
Initial public stable release.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `AtomicMemoryClient` and `AsyncAtomicMemoryClient` as the primary public client surfaces.
|
|
15
|
+
- Memory ingestion, search, package, get, list, and delete support.
|
|
16
|
+
- AtomicMemory and Mem0 provider adapters.
|
|
17
|
+
- Typed AtomicMemory namespace handles for lifecycle, audit, lessons, agents, and runtime config.
|
|
18
|
+
- Direct artifact storage client with pointer and managed artifact workflows.
|
|
19
|
+
- Local embedding, semantic search, and KV cache helpers.
|
|
20
|
+
- Pydantic models, typed exceptions, and `py.typed` marker for downstream type checkers.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AtomicMemory
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: atomicmemory
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python client SDK for AtomicMemory memory and artifact storage.
|
|
5
|
+
Project-URL: Homepage, https://github.com/atomicstrata/atomicmemory-python
|
|
6
|
+
Project-URL: Repository, https://github.com/atomicstrata/atomicmemory-python
|
|
7
|
+
Project-URL: Issues, https://github.com/atomicstrata/atomicmemory-python/issues
|
|
8
|
+
Author: AtomicMemory
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agent,atomicmemory,llm,mem0,memory,rag
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: numpy>=1.26
|
|
26
|
+
Requires-Dist: pydantic>=2.7
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-mock>=3.12; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
34
|
+
Requires-Dist: vulture>=2.11; extra == 'dev'
|
|
35
|
+
Provides-Extra: embeddings
|
|
36
|
+
Requires-Dist: sentence-transformers>=3.0; extra == 'embeddings'
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# atomicmemory-python
|
|
40
|
+
|
|
41
|
+
Python client SDK for [AtomicMemory](https://github.com/atomicstrata) memory and artifact storage.
|
|
42
|
+
|
|
43
|
+
A backend-agnostic memory and storage client: ingest conversations and documents, search them semantically, package retrieval-ready context, register or upload raw artifacts, and access AtomicMemory-specific features (lifecycle, audit, lessons, agents/trust, runtime config) through typed namespace handles.
|
|
44
|
+
|
|
45
|
+
This is a Python port of the TypeScript [`atomicmemory-sdk`](https://github.com/atomicstrata/atomicmemory-sdk). It mirrors the public surface 1:1 while staying idiomatic to Python (Pydantic models, `httpx` sync + async clients, `match` statements, `snake_case`).
|
|
46
|
+
|
|
47
|
+
## Status
|
|
48
|
+
|
|
49
|
+
Stable release — `1.0.0` on [PyPI](https://pypi.org/project/atomicmemory/).
|
|
50
|
+
|
|
51
|
+
## Quick start
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from atomicmemory import AtomicMemoryClient
|
|
55
|
+
|
|
56
|
+
with AtomicMemoryClient({
|
|
57
|
+
"apiUrl": "http://localhost:3050",
|
|
58
|
+
"apiKey": "server-api-key",
|
|
59
|
+
"userId": "demo",
|
|
60
|
+
}) as client:
|
|
61
|
+
client.memory.initialize()
|
|
62
|
+
|
|
63
|
+
client.memory.ingest({
|
|
64
|
+
"mode": "messages",
|
|
65
|
+
"messages": [
|
|
66
|
+
{"role": "user", "content": "I prefer aisle seats on flights."},
|
|
67
|
+
],
|
|
68
|
+
"scope": {"user": "demo"},
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
page = client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
|
|
72
|
+
for hit in page.results:
|
|
73
|
+
print(hit.memory.content, hit.score)
|
|
74
|
+
|
|
75
|
+
artifact = client.storage.put({
|
|
76
|
+
"mode": "pointer",
|
|
77
|
+
"uri": "https://example.com/manual.pdf",
|
|
78
|
+
"contentType": "application/pdf",
|
|
79
|
+
})
|
|
80
|
+
print(artifact.artifact_id)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Async usage
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import asyncio
|
|
87
|
+
from atomicmemory import AsyncAtomicMemoryClient
|
|
88
|
+
|
|
89
|
+
async def main() -> None:
|
|
90
|
+
async with AsyncAtomicMemoryClient({
|
|
91
|
+
"apiUrl": "http://localhost:3050",
|
|
92
|
+
"apiKey": "server-api-key",
|
|
93
|
+
"userId": "demo",
|
|
94
|
+
}) as client:
|
|
95
|
+
await client.memory.initialize()
|
|
96
|
+
results = await client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
|
|
97
|
+
for hit in results.results:
|
|
98
|
+
print(hit.memory.content)
|
|
99
|
+
|
|
100
|
+
asyncio.run(main())
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## AtomicMemory-specific features
|
|
104
|
+
|
|
105
|
+
When configured with the `atomicmemory` provider, the client exposes a typed handle for backend-specific routes:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
trail = client.memory.atomicmemory.audit.trail(memory_id="mem-123", user_id="demo")
|
|
109
|
+
health = client.memory.atomicmemory.config.health()
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Categories: `lifecycle`, `audit`, `lessons`, `config`, `agents`.
|
|
113
|
+
|
|
114
|
+
## Artifact storage
|
|
115
|
+
|
|
116
|
+
The `client.storage` namespace mirrors the TypeScript SDK's direct storage API:
|
|
117
|
+
|
|
118
|
+
- `capabilities()` reports active backend support.
|
|
119
|
+
- `put({"mode": "pointer", ...})` registers a pointer to caller-owned bytes.
|
|
120
|
+
- `put({"mode": "managed", "body": b"...", ...})` uploads known-length bytes to the configured raw content store.
|
|
121
|
+
- `get`, `get_content`, `head`, `delete`, and `verify` address artifacts by `artifact_id`.
|
|
122
|
+
- `stream_content` streams large artifact bodies without buffering the entire response in memory.
|
|
123
|
+
|
|
124
|
+
Every storage request sends `Authorization: Bearer <apiKey>` and `X-AtomicMemory-User-Id`. The SDK never sends the legacy `?user_id=` URL parameter.
|
|
125
|
+
|
|
126
|
+
## Installation
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pip install atomicmemory # core + local search + SQLite store
|
|
130
|
+
pip install 'atomicmemory[embeddings]' # + sentence-transformers for local embeddings
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
uv sync --extra dev --extra embeddings
|
|
137
|
+
uv run pytest
|
|
138
|
+
uv run ruff check .
|
|
139
|
+
uv run ruff format --check .
|
|
140
|
+
uv run mypy atomicmemory --strict
|
|
141
|
+
uv run vulture atomicmemory tests .vulture_whitelist.py --min-confidence 90
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# atomicmemory-python
|
|
2
|
+
|
|
3
|
+
Python client SDK for [AtomicMemory](https://github.com/atomicstrata) memory and artifact storage.
|
|
4
|
+
|
|
5
|
+
A backend-agnostic memory and storage client: ingest conversations and documents, search them semantically, package retrieval-ready context, register or upload raw artifacts, and access AtomicMemory-specific features (lifecycle, audit, lessons, agents/trust, runtime config) through typed namespace handles.
|
|
6
|
+
|
|
7
|
+
This is a Python port of the TypeScript [`atomicmemory-sdk`](https://github.com/atomicstrata/atomicmemory-sdk). It mirrors the public surface 1:1 while staying idiomatic to Python (Pydantic models, `httpx` sync + async clients, `match` statements, `snake_case`).
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
|
|
11
|
+
Stable release — `1.0.0` on [PyPI](https://pypi.org/project/atomicmemory/).
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from atomicmemory import AtomicMemoryClient
|
|
17
|
+
|
|
18
|
+
with AtomicMemoryClient({
|
|
19
|
+
"apiUrl": "http://localhost:3050",
|
|
20
|
+
"apiKey": "server-api-key",
|
|
21
|
+
"userId": "demo",
|
|
22
|
+
}) as client:
|
|
23
|
+
client.memory.initialize()
|
|
24
|
+
|
|
25
|
+
client.memory.ingest({
|
|
26
|
+
"mode": "messages",
|
|
27
|
+
"messages": [
|
|
28
|
+
{"role": "user", "content": "I prefer aisle seats on flights."},
|
|
29
|
+
],
|
|
30
|
+
"scope": {"user": "demo"},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
page = client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
|
|
34
|
+
for hit in page.results:
|
|
35
|
+
print(hit.memory.content, hit.score)
|
|
36
|
+
|
|
37
|
+
artifact = client.storage.put({
|
|
38
|
+
"mode": "pointer",
|
|
39
|
+
"uri": "https://example.com/manual.pdf",
|
|
40
|
+
"contentType": "application/pdf",
|
|
41
|
+
})
|
|
42
|
+
print(artifact.artifact_id)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Async usage
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import asyncio
|
|
49
|
+
from atomicmemory import AsyncAtomicMemoryClient
|
|
50
|
+
|
|
51
|
+
async def main() -> None:
|
|
52
|
+
async with AsyncAtomicMemoryClient({
|
|
53
|
+
"apiUrl": "http://localhost:3050",
|
|
54
|
+
"apiKey": "server-api-key",
|
|
55
|
+
"userId": "demo",
|
|
56
|
+
}) as client:
|
|
57
|
+
await client.memory.initialize()
|
|
58
|
+
results = await client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
|
|
59
|
+
for hit in results.results:
|
|
60
|
+
print(hit.memory.content)
|
|
61
|
+
|
|
62
|
+
asyncio.run(main())
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## AtomicMemory-specific features
|
|
66
|
+
|
|
67
|
+
When configured with the `atomicmemory` provider, the client exposes a typed handle for backend-specific routes:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
trail = client.memory.atomicmemory.audit.trail(memory_id="mem-123", user_id="demo")
|
|
71
|
+
health = client.memory.atomicmemory.config.health()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Categories: `lifecycle`, `audit`, `lessons`, `config`, `agents`.
|
|
75
|
+
|
|
76
|
+
## Artifact storage
|
|
77
|
+
|
|
78
|
+
The `client.storage` namespace mirrors the TypeScript SDK's direct storage API:
|
|
79
|
+
|
|
80
|
+
- `capabilities()` reports active backend support.
|
|
81
|
+
- `put({"mode": "pointer", ...})` registers a pointer to caller-owned bytes.
|
|
82
|
+
- `put({"mode": "managed", "body": b"...", ...})` uploads known-length bytes to the configured raw content store.
|
|
83
|
+
- `get`, `get_content`, `head`, `delete`, and `verify` address artifacts by `artifact_id`.
|
|
84
|
+
- `stream_content` streams large artifact bodies without buffering the entire response in memory.
|
|
85
|
+
|
|
86
|
+
Every storage request sends `Authorization: Bearer <apiKey>` and `X-AtomicMemory-User-Id`. The SDK never sends the legacy `?user_id=` URL parameter.
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install atomicmemory # core + local search + SQLite store
|
|
92
|
+
pip install 'atomicmemory[embeddings]' # + sentence-transformers for local embeddings
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uv sync --extra dev --extra embeddings
|
|
99
|
+
uv run pytest
|
|
100
|
+
uv run ruff check .
|
|
101
|
+
uv run ruff format --check .
|
|
102
|
+
uv run mypy atomicmemory --strict
|
|
103
|
+
uv run vulture atomicmemory tests .vulture_whitelist.py --min-confidence 90
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""atomicmemory — Python client SDK for AtomicMemory.
|
|
2
|
+
|
|
3
|
+
Top-level re-exports for the public API. Users typically only need to
|
|
4
|
+
import `AtomicMemoryClient` plus the type they're working with — every
|
|
5
|
+
type they could need is re-exported here.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from atomicmemory._version import __version__
|
|
9
|
+
from atomicmemory.client.async_memory_client import AsyncMemoryClient, AsyncProviderStatus
|
|
10
|
+
from atomicmemory.client.atomic_memory_client import (
|
|
11
|
+
AsyncAtomicMemoryClient,
|
|
12
|
+
AtomicMemoryClient,
|
|
13
|
+
AtomicMemoryClientConfig,
|
|
14
|
+
MemoryNamespaceConfig,
|
|
15
|
+
)
|
|
16
|
+
from atomicmemory.client.memory_client import MemoryClient, ProviderStatus
|
|
17
|
+
from atomicmemory.core.errors import (
|
|
18
|
+
AtomicMemoryError,
|
|
19
|
+
ConfigError,
|
|
20
|
+
NetworkError,
|
|
21
|
+
NotInitializedError,
|
|
22
|
+
ProviderError,
|
|
23
|
+
RateLimitError,
|
|
24
|
+
ValidationError,
|
|
25
|
+
)
|
|
26
|
+
from atomicmemory.memory.filters import FieldFilter, FieldFilterOp, FilterExpr
|
|
27
|
+
from atomicmemory.memory.types import (
|
|
28
|
+
Capabilities,
|
|
29
|
+
CapabilitiesExtensions,
|
|
30
|
+
CapabilitiesRequiredScope,
|
|
31
|
+
ContextPackage,
|
|
32
|
+
GraphEdge,
|
|
33
|
+
GraphNode,
|
|
34
|
+
GraphResult,
|
|
35
|
+
GraphSearchRequest,
|
|
36
|
+
HealthStatus,
|
|
37
|
+
IngestBase,
|
|
38
|
+
IngestInput,
|
|
39
|
+
IngestResult,
|
|
40
|
+
Insight,
|
|
41
|
+
ListRequest,
|
|
42
|
+
ListResultPage,
|
|
43
|
+
Memory,
|
|
44
|
+
MemoryKind,
|
|
45
|
+
MemoryRef,
|
|
46
|
+
MemoryVersion,
|
|
47
|
+
MemoryVersionEvent,
|
|
48
|
+
Message,
|
|
49
|
+
MessageIngest,
|
|
50
|
+
MessageRole,
|
|
51
|
+
PackageFormat,
|
|
52
|
+
PackageRequest,
|
|
53
|
+
Profile,
|
|
54
|
+
Provenance,
|
|
55
|
+
Scope,
|
|
56
|
+
SearchRequest,
|
|
57
|
+
SearchResult,
|
|
58
|
+
SearchResultPage,
|
|
59
|
+
TextIngest,
|
|
60
|
+
VerbatimIngest,
|
|
61
|
+
)
|
|
62
|
+
from atomicmemory.storage import (
|
|
63
|
+
ArtifactHead,
|
|
64
|
+
ArtifactInUseError,
|
|
65
|
+
ArtifactMetadata,
|
|
66
|
+
ArtifactNotFoundError,
|
|
67
|
+
ArtifactRange,
|
|
68
|
+
ArtifactRef,
|
|
69
|
+
AsyncStorageClient,
|
|
70
|
+
DeleteArtifactOptions,
|
|
71
|
+
DeleteArtifactPolicy,
|
|
72
|
+
DeleteArtifactResult,
|
|
73
|
+
FilecoinDirectStorageNotSupportedError,
|
|
74
|
+
PointerContentNotManagedError,
|
|
75
|
+
PutArtifactInput,
|
|
76
|
+
PutManagedInput,
|
|
77
|
+
PutPointerInput,
|
|
78
|
+
StorageArtifactStatus,
|
|
79
|
+
StorageCapabilities,
|
|
80
|
+
StorageClient,
|
|
81
|
+
StorageClientConfig,
|
|
82
|
+
StorageClientError,
|
|
83
|
+
StoredArtifact,
|
|
84
|
+
UnsupportedCapabilityError,
|
|
85
|
+
VerificationResult,
|
|
86
|
+
VerifyArtifactOptions,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
__all__ = [
|
|
90
|
+
"ArtifactHead",
|
|
91
|
+
"ArtifactInUseError",
|
|
92
|
+
"ArtifactMetadata",
|
|
93
|
+
"ArtifactNotFoundError",
|
|
94
|
+
"ArtifactRange",
|
|
95
|
+
"ArtifactRef",
|
|
96
|
+
"AsyncAtomicMemoryClient",
|
|
97
|
+
"AsyncMemoryClient",
|
|
98
|
+
"AsyncProviderStatus",
|
|
99
|
+
"AsyncStorageClient",
|
|
100
|
+
"AtomicMemoryClient",
|
|
101
|
+
"AtomicMemoryClientConfig",
|
|
102
|
+
"AtomicMemoryError",
|
|
103
|
+
"Capabilities",
|
|
104
|
+
"CapabilitiesExtensions",
|
|
105
|
+
"CapabilitiesRequiredScope",
|
|
106
|
+
"ConfigError",
|
|
107
|
+
"ContextPackage",
|
|
108
|
+
"DeleteArtifactOptions",
|
|
109
|
+
"DeleteArtifactPolicy",
|
|
110
|
+
"DeleteArtifactResult",
|
|
111
|
+
"FieldFilter",
|
|
112
|
+
"FieldFilterOp",
|
|
113
|
+
"FilecoinDirectStorageNotSupportedError",
|
|
114
|
+
"FilterExpr",
|
|
115
|
+
"GraphEdge",
|
|
116
|
+
"GraphNode",
|
|
117
|
+
"GraphResult",
|
|
118
|
+
"GraphSearchRequest",
|
|
119
|
+
"HealthStatus",
|
|
120
|
+
"IngestBase",
|
|
121
|
+
"IngestInput",
|
|
122
|
+
"IngestResult",
|
|
123
|
+
"Insight",
|
|
124
|
+
"ListRequest",
|
|
125
|
+
"ListResultPage",
|
|
126
|
+
"Memory",
|
|
127
|
+
"MemoryClient",
|
|
128
|
+
"MemoryKind",
|
|
129
|
+
"MemoryNamespaceConfig",
|
|
130
|
+
"MemoryRef",
|
|
131
|
+
"MemoryVersion",
|
|
132
|
+
"MemoryVersionEvent",
|
|
133
|
+
"Message",
|
|
134
|
+
"MessageIngest",
|
|
135
|
+
"MessageRole",
|
|
136
|
+
"NetworkError",
|
|
137
|
+
"NotInitializedError",
|
|
138
|
+
"PackageFormat",
|
|
139
|
+
"PackageRequest",
|
|
140
|
+
"PointerContentNotManagedError",
|
|
141
|
+
"Profile",
|
|
142
|
+
"Provenance",
|
|
143
|
+
"ProviderError",
|
|
144
|
+
"ProviderStatus",
|
|
145
|
+
"PutArtifactInput",
|
|
146
|
+
"PutManagedInput",
|
|
147
|
+
"PutPointerInput",
|
|
148
|
+
"RateLimitError",
|
|
149
|
+
"Scope",
|
|
150
|
+
"SearchRequest",
|
|
151
|
+
"SearchResult",
|
|
152
|
+
"SearchResultPage",
|
|
153
|
+
"StorageArtifactStatus",
|
|
154
|
+
"StorageCapabilities",
|
|
155
|
+
"StorageClient",
|
|
156
|
+
"StorageClientConfig",
|
|
157
|
+
"StorageClientError",
|
|
158
|
+
"StoredArtifact",
|
|
159
|
+
"TextIngest",
|
|
160
|
+
"UnsupportedCapabilityError",
|
|
161
|
+
"ValidationError",
|
|
162
|
+
"VerbatimIngest",
|
|
163
|
+
"VerificationResult",
|
|
164
|
+
"VerifyArtifactOptions",
|
|
165
|
+
"__version__",
|
|
166
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Public client facades for memory and storage namespaces."""
|
|
2
|
+
|
|
3
|
+
from atomicmemory.client.async_memory_client import AsyncMemoryClient, AsyncProviderStatus
|
|
4
|
+
from atomicmemory.client.atomic_memory_client import (
|
|
5
|
+
AsyncAtomicMemoryClient,
|
|
6
|
+
AtomicMemoryClient,
|
|
7
|
+
AtomicMemoryClientConfig,
|
|
8
|
+
MemoryNamespaceConfig,
|
|
9
|
+
)
|
|
10
|
+
from atomicmemory.client.memory_client import MemoryClient, MemoryProviderConfigs, ProviderStatus
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"AsyncAtomicMemoryClient",
|
|
14
|
+
"AsyncMemoryClient",
|
|
15
|
+
"AsyncProviderStatus",
|
|
16
|
+
"AtomicMemoryClient",
|
|
17
|
+
"AtomicMemoryClientConfig",
|
|
18
|
+
"MemoryClient",
|
|
19
|
+
"MemoryNamespaceConfig",
|
|
20
|
+
"MemoryProviderConfigs",
|
|
21
|
+
"ProviderStatus",
|
|
22
|
+
]
|