Skip to main content

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

Project description

getmnemo

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

pip install getmnemo

Quickstart

from mnemo import Mnemo

memory = Mnemo(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 mnemo import AsyncMnemo

async def main() -> None:
    async with AsyncMnemo(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
GETMNEMO_API_KEY (required) from https://app.mnemohq.com/settings/api-keys
GETMNEMO_WORKSPACE_ID (required) from the dashboard URL
GETMNEMO_ACTOR_ID none optional — scopes calls to a single user
GETMNEMO_API_URL https://api.mnemohq.com 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 Mnemo (sync) and AsyncMnemo (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.2.tar.gz (7.9 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.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: getmnemo-0.1.2.tar.gz
  • Upload date:
  • Size: 7.9 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.2.tar.gz
Algorithm Hash digest
SHA256 a1d79477085088933f941351abb159f3a4dcdc5ec6d7b50bd7dff5155a169bb6
MD5 4f4621c95d85a19c5ee80069c48e15f9
BLAKE2b-256 59f86632a0086fb4e6b1e7623349e0bcf1f1831c090c1872be058a115b770fce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: getmnemo-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d96f1532f61f585684ada2f28fe4f72db9d8389aba75b3281d11724c0020f93
MD5 d376b597baf318629556081b6460d7e0
BLAKE2b-256 5e737bfa958772de12b999bd59c2f2b9cb555902f4f584bc1be4aeab421b85b5

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