Skip to main content

Lunaris — agent memory engine (Python bindings, PyO3 0.26).

Project description

lunaris

PyO3 0.26 Python bindings for the Lunaris agent memory engine.

Installation

From source (development):

cd crates/lunaris-py
uv venv --python 3.11 .venv
source .venv/bin/activate
uv pip install maturin
maturin develop --release

A PyPI wheel will ship with the v0.1.1 release via the Plan 08-04 multi-platform prebuild matrix.

For the full user-facing install + quickstart guide covering both Python and TypeScript, see docs/bindings.md.

Requirements

  • Python 3.11+ (abi3 stable ABI — one wheel covers 3.11, 3.12, 3.13)
  • A Moon or Postgres backend reachable from the process; moon:// and postgres:// URL schemes are supported.

Example

import asyncio
import lunaris

async def main():
    handle = await lunaris.open("moon://127.0.0.1:6380")
    lsn = await handle.ingest({
        "id": "01JABCDEFGHJKMNPQRSTVWXYZ0",
        "source": "py-example",
        "content": "Lunaris bi-temporal hello.",
        "metadata": {},
        "t_ref": None,
        "bt": {"valid": [{"wall_ms": 0, "counter": 0, "node_id": 0}, None],
               "sys":   [{"wall_ms": 0, "counter": 0, "node_id": 0}, None]},
    })
    print("ingested at", lsn)

    hits = await handle.recall().execute()
    for h in hits:
        print(h)

asyncio.run(main())

Custom embedder + reranker

The default embedder is granite-embedding-311m-multilingual-r2 (768-d), served from a Q4_K_M GGUF in-process via llama.cpp — no Ollama, no external service required. Stage the GGUF at ~/.lunaris/models/ (the MCP server does this lazily; other deployments download out-of-band). An air-gapped Ollama HTTP embedder remains available as an operator escape hatch behind --features embed-remote.

The EmbedderConfig and RerankerConfig factories swap the backend at handle-construction time; the env-driven default remains in place for callers that don't pass one.

import asyncio
import lunaris
from lunaris import EmbedderConfig, RerankerConfig

async def main():
    mem = await lunaris.open(
        "moon://127.0.0.1:6380",
        embedder=EmbedderConfig.llamacpp(),   # granite-r2 Q4_K_M GGUF, in-process llama.cpp
        reranker=RerankerConfig.llamacpp(),   # bge-reranker-v2-m3 Q5_K_M GGUF cross-encoder
    )
    # ... ingest / recall as usual

asyncio.run(main())

See docs/sdk/embedder-config.md for the full customization guide — in-process llama.cpp, noop, and the operator Ollama escape hatch — with troubleshooting and the FFI-cliff limits.

Surface parity

The Python class / method surface is generated from crates/lunaris-codegen/annotations/surface.toml (Plan 08-01). The parity-check CI job fails any PR that drifts the committed snapshot from the regenerated output — pip install lunaris never lags the Rust crate.

Three-surface pipeline toggles

The GraphPipeline and ConsolidatorPipeline default to OFF (blueprint §5.1 / §5.2). Flip them at any of three surfaces:

Surface Example
Code handle.graph_pipeline.enable()
Env LUNARIS_GRAPH_ENABLED=1 python run.py
Config await lunaris.open(url, config={"graph_pipeline": {"enabled": True}})

Resolution order: code > env > config — code is always authoritative.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

lunaris-0.6.0rc1-cp311-abi3-win_amd64.whl (9.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

lunaris-0.6.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl (34.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

lunaris-0.6.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl (32.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

lunaris-0.6.0rc1-cp311-abi3-macosx_11_0_arm64.whl (9.7 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

lunaris-0.6.0rc1-cp311-abi3-macosx_10_15_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.11+macOS 10.15+ x86-64

File details

Details for the file lunaris-0.6.0rc1-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for lunaris-0.6.0rc1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 961fc331252df6b1080ca6b707532f67cd08aff05531a39e26ad273dce22336f
MD5 99ccbcdd6a910ae3ff1693154b1b6390
BLAKE2b-256 d1942877cabaae2c6505c9b778fff801e499ad7e19f18b271619e6f6a1c0d7a3

See more details on using hashes here.

File details

Details for the file lunaris-0.6.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lunaris-0.6.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3a1611f2add4f57876dbff2a65fb8f688d07dfc1f6de8e65e8c406f77477518e
MD5 9220ffd95a64ded81dd586efb8ba472e
BLAKE2b-256 b11ce8b28d5befd7c6ff0f805aaf2d89258fadb3bff0c2217413ba6729704eb0

See more details on using hashes here.

File details

Details for the file lunaris-0.6.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lunaris-0.6.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ef271cbd41f425a99db5b52f2992718235920716a4f5cc8ce527e08100be1a40
MD5 1ef52bb956ddb85574869d53182f8e46
BLAKE2b-256 209c56f97d0e5405a5d5c11db1447af22b0c1188a966e1ddddb51b6a4519de22

See more details on using hashes here.

File details

Details for the file lunaris-0.6.0rc1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lunaris-0.6.0rc1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21e366377334af18c85b84cdc57cf10a01db71678c8832dabc3c55fd3d854a20
MD5 63b371283901f3a3f677b5877273f9c5
BLAKE2b-256 2dc02efc502201bcb0593d5f68ac7ef0eb801a379daa6bf423d888b2291b8c91

See more details on using hashes here.

File details

Details for the file lunaris-0.6.0rc1-cp311-abi3-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lunaris-0.6.0rc1-cp311-abi3-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 62836c64bd51fdbe791816bad8b3761c4f4797ad8a904b66c41d4994eec0f4de
MD5 115ace9a9bdb169ec654e75a5738ae20
BLAKE2b-256 5de497ace71f11d5b904b5f8560a07bf29a22b05b125b7d60e26719f9f548156

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