Skip to main content

Python client SDK for AtomicMemory memory and artifact storage.

Project description

atomicmemory-python

CI PyPI Python Docs License: Apache 2.0

Python client SDK for AtomicMemory memory and artifact storage.

Docs: docs.atomicstrata.ai

AtomicMemory Core currently reaches cost-Pareto SOTA on BEAM-100K, BEAM-1M, and LoCoMo10, with BEAM-10M parity against the strongest published Mem0-new result. This package brings that memory layer to Python services, agents, notebooks, and evaluation workflows.

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.

Installation

pip install atomicmemory                    # core + local search + SQLite store
pip install 'atomicmemory[embeddings]'      # + sentence-transformers for local embeddings

Quick start

Prerequisite: start atomicmemory-core first. Follow the Core Quickstart if you do not already have a backend at http://localhost:3050.

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.

Memory providers

The memory namespace supports the same provider family as the TypeScript SDK:

  • atomicmemory — AtomicMemory core backend.
  • mem0 — Mem0 OSS or hosted backend.
  • hindsight — Hindsight Cloud or self-hosted backend.
from atomicmemory import MemoryClient

with MemoryClient(
    providers={
        "hindsight": {
            "apiUrl": "http://localhost:8888",
            "apiVersion": "v1",
            "projectId": "default",
        }
    }
) as memory:
    memory.initialize()
    page = memory.search({"query": "seat preference", "scope": {"user": "demo"}})

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, and verify address artifacts by artifact_id.
  • stream_content streams 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.

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

Live provider smoke tests

Live provider tests are opt-in and are not required for normal development. They assume the backend is already running and configured with its own model.

ATOMICMEMORY_HINDSIGHT_INTEGRATION=1 \
HINDSIGHT_API_URL=http://localhost:8890 \
HINDSIGHT_TIMEOUT_SECONDS=120 \
uv run pytest tests/providers/hindsight/test_integration.py -m integration -ra

License

Apache-2.0

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

atomicmemory-1.0.1.tar.gz (205.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atomicmemory-1.0.1-py3-none-any.whl (109.9 kB view details)

Uploaded Python 3

File details

Details for the file atomicmemory-1.0.1.tar.gz.

File metadata

  • Download URL: atomicmemory-1.0.1.tar.gz
  • Upload date:
  • Size: 205.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.13

File hashes

Hashes for atomicmemory-1.0.1.tar.gz
Algorithm Hash digest
SHA256 69b01559d3b7fc3bff5c38b324b828adb402b9c251e65609f42bce6e63698d71
MD5 54f43665377241983deb15fdea3d6034
BLAKE2b-256 a3893215ae9469afcab8c885a7884377ab2144d7feb18d0dbe7d055fc885aecb

See more details on using hashes here.

File details

Details for the file atomicmemory-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for atomicmemory-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb70d072fc2008b3c13cd1c27a27adddd3781b1224a91bf2b5062729901704b3
MD5 e17211bfde4cbcc3a1b2dad4f846ea4d
BLAKE2b-256 d8df92fb8fcd61f0c7dddeee3e2ae0c4e6dfa79806e139d1f21fdf7b141078ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page