Skip to main content

getmnemo

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

pip install getmnemo

Quickstart

from getmnemo import Mnemo

memory = Mnemo(api_key="prfly_live_...", default_container_tag="user:jane")

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

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

Every call is scoped to a container — a "<type>:<id>" string such as "user:jane" or "project:alpha". Set it once on the client (default_container_tag=) or per call (container_tag=). Searching a container that has never been written to returns an empty list.

Async variant:

import asyncio
from getmnemo import AsyncMnemo

async def main() -> None:
    async with AsyncMnemo(api_key="...", default_container_tag="user:jane") as m:
        await m.add("Trip to Costa Rica was 5 days, brought 7 shirts.")
        results = await m.search("how many shirts did I pack?")
        if results:
            print(results[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_CONTAINER_TAG none default container, e.g. user:jane
GETMNEMO_WORKSPACE_ID none deprecated — identity comes from the API key
GETMNEMO_API_URL https://api.mnemohq.com override for self-hosted

API surface

Method Purpose
search(q, *, container_tag=None, limit=None) Hybrid retrieval. Returns list[SearchHit].
add(content, *, container_tag=None, metadata=None) Store an atomic fact. Returns AddResponse.
add_many(items, *, container_tag=None) Store 1–100 memories in one request. Returns AddResponse.
update(memory_id, *, content=None, metadata=None, container_tag=None) Patch existing memory.
delete(memory_id, *, container_tag=None) Remove a memory.
list(*, limit=20, cursor=None, container_tag=None) Cursor-paginated list.

All methods exist on both Mnemo (sync) and AsyncMnemo (async).

add_many items are content strings or mappings:

memory.add_many([
    "Standup moved to 9:30.",
    {"content": "Invoices are net-30.", "memory_type": "fact", "idempotency_key": "inv-policy-1"},
])

Upgrading from 0.1.x

0.2.0 tracks the current Mnemo API; 0.1.x requests are rejected by it.

  • workspace_id is no longer required (the API key carries identity); pass a container instead: Mnemo(api_key=..., default_container_tag="user:jane").
  • search("q") now returns a list[SearchHit] (was SearchResponse.hits).
  • add(...) now returns an AddResponse (was a single Memory).
  • actor_id was removed — use per-user container tags.

Development

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

License

MIT

Metadata

Release files for getmnemo 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for getmnemo 0.2.0
File Size Uploaded Provenance Actions
getmnemo-0.2.0.tar.gz 13.1 kB Without provenance Details for getmnemo-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for getmnemo 0.2.0
File Interpreter ABI Platform Actions
getmnemo-0.2.0-py3-none-any.whl Python 3 none any Details for getmnemo-0.2.0-py3-none-any.whl

Total release size: 24.6 kB

Release files / getmnemo-0.2.0.tar.gz

Download URL getmnemo-0.2.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c6378c5e7d279032c5fca494591f44d3ca6d3b983d6475df874a81c9f17e157f
BLAKE2b-256 checksum
How to use checksums
228a175a3e0107d958621c5ccf553dab67f8bb4bf11a627f340d62bfc0fd1aa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / getmnemo-0.2.0-py3-none-any.whl

Download URL getmnemo-0.2.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6da9e670d80789c89b6609b089529ad24d5dd15425663c702e4621a0f2537250
BLAKE2b-256 checksum
How to use checksums
9eab75f605ba8103758c92eb31743116ef55f3bc73c197cc699f7c493df63149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for getmnemo 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page