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.1.tar.gz (8.0 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.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for getmnemo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 82ecd0f6e91cdd165ede42261f855d7d828f1f99805f9367cd235151d74a6820
MD5 c4437204156538f7b5092eda30476395
BLAKE2b-256 1458c99425a0ce6c039e59f8ceecc4aa6a300dd4a95fd3e3fedef0cf076e36e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: getmnemo-0.1.1-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.12.13

File hashes

Hashes for getmnemo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38ec0661cb76969232115f87aac822904372a191dff21db4b369d3e65b457ebe
MD5 6c8ca6e01d800643f6dd51c665a11ba3
BLAKE2b-256 dc3873213a5989acc245a297a1712ed2c2aba54d8d7d61134f162163de10e8b4

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