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), runs in-process via candle, and auto-downloads to ~/.cache/lunaris/models/ on first use — no Ollama, no ONNX Runtime, no external service required. 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.native(),     # granite-r2, in-process, auto-downloads to ~/.cache/lunaris/models/
        reranker=RerankerConfig.native(),     # bge-reranker-v2-m3 cross-encoder
    )
    # ... ingest / recall as usual

asyncio.run(main())

See docs/sdk/embedder-config.md for the full customization guide — native in-process, quantized GGUF, 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.5.0-cp311-abi3-win_amd64.whl (9.1 MB view details)

Uploaded CPython 3.11+Windows x86-64

lunaris-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl (39.1 MB view details)

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

lunaris-0.5.0-cp311-abi3-manylinux_2_28_aarch64.whl (35.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

lunaris-0.5.0-cp311-abi3-macosx_11_0_arm64.whl (9.5 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

lunaris-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for lunaris-0.5.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4d56d063b657441c6bbbe5e02555b68a1c41484aef6b0ed0a69033d48ee611bc
MD5 6636b54fe866937ca9f09f4ee0e3f692
BLAKE2b-256 6acf0c1053d4b2f9f7835253199be30ce79c607b598f395daabeeaaf425cb086

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lunaris-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a791896f16e8e06c99f6e034b304981acb24bd6c70e9c48e7a69b59134a11bbd
MD5 3aade1c59910e936011aa2c2b1014680
BLAKE2b-256 39a554d5c3f4d8c82ffd9c3cc2d26d05c53c4efe0e502fc149d48822b1c59a03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lunaris-0.5.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2b439d25f9155d9466b9bc6508ae990e05d92c2dcc66408b5f4f7d4115be15db
MD5 48905b9f43d6684667e78e4703685dc3
BLAKE2b-256 e6369faca53bcf03ab80061b6d9bc44b8e18185c206c2549bb0ccd7ccb844982

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lunaris-0.5.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3f129993a7ee3ca95dfd9cef14904a327078909e6565f44125e438529fff569
MD5 eb1cfe555ba824f04c65eb8b4568af3e
BLAKE2b-256 253c8c6b919281342a6c0a6ff36c4e263bb5bb0b69fe72508bf33bc2e74a425e

See more details on using hashes here.

File details

Details for the file lunaris-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for lunaris-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 28bd71fd8781335d3b382472c8ee39d7b33d1de22e360764dc81f2f6ec8b1c48
MD5 ac446246f17887b142062e700b5a7d87
BLAKE2b-256 4d6278213d3516c209598910405417f9782e782d5aab2fe61625bc19656e87a4

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