Skip to main content

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 backend reachable from the process. moon:// is the only supported URL scheme — postgres:// and sqlite:// were removed in 0.7.0 and now return UnsupportedScheme. See docs/migration/0.6-to-0.7.md.

Example

import asyncio
import lunaris

async def main():
    handle = await lunaris.open("moon://127.0.0.1:6380")
    lsn = await handle.ingest({
        "id": "01JABCDEFGHJKMNPQRSTVWXYZ0",
        "scope": "_dev_",
        "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().query("bi-temporal hello").top(5).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.

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.7.1-cp311-abi3-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.11+Windows x86-64

lunaris-0.7.1-cp311-abi3-manylinux_2_28_x86_64.whl (5.2 MB view details)

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

lunaris-0.7.1-cp311-abi3-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

lunaris-0.7.1-cp311-abi3-macosx_11_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

lunaris-0.7.1-cp311-abi3-macosx_10_15_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11+macOS 10.15+ x86-64

File details

Details for the file lunaris-0.7.1-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: lunaris-0.7.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.1 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for lunaris-0.7.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c38c28e002d61823901b21b74d160b46ea7d365e380c1b59633020a3d0e7ec40
MD5 e60ddf8552e3bb1010a4594892f5bfa0
BLAKE2b-256 a39e5869dbb8253ce1335bbb180250778b72bb96ec7ad18fbe0a7fe71868b08e

See more details on using hashes here.

File details

Details for the file lunaris-0.7.1-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for lunaris-0.7.1-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3f0f5de702a308e86acbba6a8f16fd7b3094a2e1011eb9d30f994870b16e14cb
MD5 7f486f58f80a28a7c1659c7f4975475c
BLAKE2b-256 ea661e617baf72028c9ae97643dae2e08bd7a553688fd6d96412f041d5a41bfb

See more details on using hashes here.

File details

Details for the file lunaris-0.7.1-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for lunaris-0.7.1-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 35a6b8bf43470d77c5b1081b4e94ebf586c069c59f3f7b0c761dedda943eb549
MD5 9045f64a1fe491baa062bb922deb6ba1
BLAKE2b-256 682b971660a1f612547c5ea0c74e55e19758e32d032291161b0c1dab615360b3

See more details on using hashes here.

File details

Details for the file lunaris-0.7.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lunaris-0.7.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e76f6c82d36f9d8fecbadf96e7d2d7859f960adb92419ae80e7011eb17c523d
MD5 ad00f6f33171bffd3ba96993b0ed1076
BLAKE2b-256 b8e4b75da9866c4e197c5259bd8a44b7ea44362940ee9fe03515d31f6834f863

See more details on using hashes here.

File details

Details for the file lunaris-0.7.1-cp311-abi3-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for lunaris-0.7.1-cp311-abi3-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 cdb460415605d1fdd25a5635c034fda41360632b106cab8314129ceb9c38a451
MD5 5b0f543f0f2e1d9243461e07d71fb2c9
BLAKE2b-256 891dedfa96bee0618478b6200ad03885a06a576bee421799435f1d86ffa749b8

See more details on using hashes here.

Release history Release notifications | RSS feed

0.8.0

5 files

This release

0.7.1 This release

5 files

0.7.0

5 files

0.6.2

5 files

0.5.0

5 files

0.3.0

5 files

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