Python client SDK for AtomicMemory memory and artifact storage.
Project description
atomicmemory-python
Python client SDK for AtomicMemory memory and artifact storage.
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.
This is a Python port of the TypeScript atomicmemory-sdk. It mirrors the public surface 1:1 while staying idiomatic to Python (Pydantic models, httpx sync + async clients, match statements, snake_case).
Status
Stable release — 1.0.0 on PyPI.
Quick start
from atomicmemory import AtomicMemoryClient
with AtomicMemoryClient({
"apiUrl": "http://localhost:3050",
"apiKey": "server-api-key",
"userId": "demo",
}) as client:
client.memory.initialize()
client.memory.ingest({
"mode": "messages",
"messages": [
{"role": "user", "content": "I prefer aisle seats on flights."},
],
"scope": {"user": "demo"},
})
page = client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
for hit in page.results:
print(hit.memory.content, hit.score)
artifact = client.storage.put({
"mode": "pointer",
"uri": "https://example.com/manual.pdf",
"contentType": "application/pdf",
})
print(artifact.artifact_id)
Async usage
import asyncio
from atomicmemory import AsyncAtomicMemoryClient
async def main() -> None:
async with AsyncAtomicMemoryClient({
"apiUrl": "http://localhost:3050",
"apiKey": "server-api-key",
"userId": "demo",
}) as client:
await client.memory.initialize()
results = await client.memory.search({"query": "seat preference", "scope": {"user": "demo"}})
for hit in results.results:
print(hit.memory.content)
asyncio.run(main())
AtomicMemory-specific features
When configured with the atomicmemory provider, the client exposes a typed handle for backend-specific routes:
trail = client.memory.atomicmemory.audit.trail(memory_id="mem-123", user_id="demo")
health = client.memory.atomicmemory.config.health()
Categories: lifecycle, audit, lessons, config, agents.
Artifact storage
The client.storage namespace mirrors the TypeScript SDK's direct storage API:
capabilities()reports active backend support.put({"mode": "pointer", ...})registers a pointer to caller-owned bytes.put({"mode": "managed", "body": b"...", ...})uploads known-length bytes to the configured raw content store.get,get_content,head,delete, andverifyaddress artifacts byartifact_id.stream_contentstreams large artifact bodies without buffering the entire response in memory.
Every storage request sends Authorization: Bearer <apiKey> and X-AtomicMemory-User-Id. The SDK never sends the legacy ?user_id= URL parameter.
Installation
pip install atomicmemory # core + local search + SQLite store
pip install 'atomicmemory[embeddings]' # + sentence-transformers for local embeddings
Development
uv sync --extra dev --extra embeddings
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy atomicmemory --strict
uv run vulture atomicmemory tests .vulture_whitelist.py --min-confidence 90
License
MIT
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 atomicmemory-1.0.0.tar.gz.
File metadata
- Download URL: atomicmemory-1.0.0.tar.gz
- Upload date:
- Size: 191.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90953854567dc0c47f4a6d204df251ad77eeccbea2780f05e2597ca2e0a039e4
|
|
| MD5 |
1ca9f36bccba301b3d10c3503baddaa6
|
|
| BLAKE2b-256 |
50363a895f0416a03316dbd562c082fbf0720ebb25342dbaa2455d57006f0a7f
|
File details
Details for the file atomicmemory-1.0.0-py3-none-any.whl.
File metadata
- Download URL: atomicmemory-1.0.0-py3-none-any.whl
- Upload date:
- Size: 94.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
148a4278facad49e289b182de85cefb6fe3949b33906c6812520247b3c54101f
|
|
| MD5 |
5cef2289df114d055ab6d96c15ace2bc
|
|
| BLAKE2b-256 |
17b17ab3d6f3e0044772780d056441576cf304c610d19ad723d2eb8474e2308a
|