Skip to main content

Python SDK for Mnemo Memory — long-term memory infrastructure for AI agents.

Project description

ledgermem

Python SDK for LedgerMem Memory — long-term memory infrastructure for AI agents.

pip install ledgermem

Quickstart

from ledgermem import LedgerMem

memory = LedgerMem(api_key="lk_live_...", workspace_id="ws_...")

# Store an atomic fact
memory.add("User prefers Japanese short-grain rice for onigiri.")

# Retrieve relevant facts
hits = memory.search("what kind of rice does the user like?")
for hit in hits.hits:
    print(f"{hit.score:.2f}  {hit.content}")

Async variant:

import asyncio
from ledgermem import AsyncLedgerMem

async def main() -> None:
    async with AsyncLedgerMem(api_key="...", workspace_id="...") as m:
        await m.add("Trip to Costa Rica was 5 days, brought 7 shirts.")
        res = await m.search("how many shirts did I pack?")
        print(res.hits[0].content)

asyncio.run(main())

Configuration

The client reads from env vars when arguments are not passed explicitly:

Env var Default Notes
LEDGERMEM_API_KEY (required) from https://app.proofly.dev/settings/api-keys
LEDGERMEM_WORKSPACE_ID (required) from the dashboard URL
LEDGERMEM_ACTOR_ID none optional — scopes calls to a single user
LEDGERMEM_API_URL https://api.proofly.dev override for self-hosted

API surface

Method Purpose
search(query, *, limit=8, actor_id=None) Hybrid 7-strategy retrieval. Returns SearchResponse.
add(content, *, metadata=None, actor_id=None) Store an atomic fact. Returns Memory.
update(memory_id, *, content=None, metadata=None) Patch existing memory.
delete(memory_id) Remove a memory.
list(*, limit=20, cursor=None, actor_id=None) Cursor-paginated list.

All methods exist on both LedgerMem (sync) and AsyncLedgerMem (async).

Development

pip install -e ".[dev]"
pytest
ruff check .
mypy src

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

getmnemo-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

getmnemo-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file getmnemo-0.1.0.tar.gz.

File metadata

  • Download URL: getmnemo-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for getmnemo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b0b214462a993c75630c3c83490a7b426b73f1676554df323c07e05b69d31615
MD5 26531eea5660c6ed3c386e7537bfd00c
BLAKE2b-256 5dfafd3105ea35ce3a62def414f5054a5058a407eb4c9a3d267ea337bc5dd1e3

See more details on using hashes here.

File details

Details for the file getmnemo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: getmnemo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for getmnemo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f6c38e10a42cce6dc2d45315e7f6daa2abc3d5cf7dc9778939f53282acc4ed3
MD5 4b48a8bf232004d20395a9ba1cd89c38
BLAKE2b-256 36eb21c9a1e7b9223c79483837f21cbefe732e1ee23cd83198cd7c5df41a67a1

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