Metadata-Version: 2.4
Name: getmnemo
Version: 0.1.0
Summary: Python SDK for Mnemo Memory — long-term memory infrastructure for AI agents.
Project-URL: Homepage, https://getmnemo.xyz
Project-URL: Documentation, https://getmnemo.xyz/docs
Project-URL: Repository, https://github.com/getmnemo/getmnemo-python
Project-URL: Issues, https://github.com/getmnemo/getmnemo-python/issues
Author-email: Mnemo <founders@getmnemo.xyz>
License: MIT
License-File: LICENSE
Keywords: agents,llm,longmemeval,memory,rag,vector
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: eval-type-backport>=0.2; python_version < '3.10'
Requires-Dist: httpx<1.0,>=0.27
Requires-Dist: pydantic<3.0,>=2.7
Requires-Dist: typing-extensions>=4.10
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-httpx>=0.32; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# ledgermem

Python SDK for [LedgerMem Memory](https://proofly.dev) — long-term memory infrastructure for AI agents.

```bash
pip install ledgermem
```

## Quickstart

```python
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:

```python
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

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

## License

MIT
