Skip to main content

Deterministic Python runtime for relational execution lineage DAGs.

Project description

Musubito

CI PyPI License: AGPL v3 Python 3.10+

Musubito is a Python runtime for recording execution lineage in a relational DAG. It is designed for agentic and LLM-heavy workflows where repeated non-deterministic loops create avoidable token cost and latency.

The runtime records execution nodes, artifacts, and dependencies in SQLite. It uses deterministic node identity, replay semantics, downstream invalidation, and explicit multi-parent merge contexts to decide when a previous result can be reused safely.

Install

pip install musubito

Quickstart

import asyncio

from musubito import MusubitoResult, musubito_merge, musubito_step


@musubito_step()
async def fetch_context(topic: str) -> dict[str, str]:
    return {"topic": topic, "source": "local"}


@musubito_step()
async def fetch_policy(topic: str) -> dict[str, str]:
    return {"topic": topic, "policy": "strict-replay"}


@musubito_step()
def summarize(
    context: MusubitoResult[dict[str, str]],
    policy: MusubitoResult[dict[str, str]],
) -> dict[str, str]:
    return {
        "topic": context.value["topic"],
        "policy": policy.value["policy"],
    }


async def main() -> None:
    context, policy = await asyncio.gather(
        fetch_context("lineage"),
        fetch_policy("lineage"),
    )

    with musubito_merge(context, policy):
        result = summarize(context, policy)

    print(result.value)


asyncio.run(main())

Decorated functions return MusubitoResult[T]. The wrapper does not unwrap .value; the result carries lineage meta

  • value: the typed user value.
  • artifact_id: the persisted output artifact identifier.
  • producer_node_id: the historical node that originally produced the value.
  • node_id: the node identity in the current DAG run.

Replay Model

Musubito computes deterministic node identity from the operation name, canonical input hash, and sorted upstream node identifiers. Replay is allowed only when the stored node is successful, has an available output artifact, is not stale, does not force re-execution, and any configured TTL has not expired.

Time-dependent replay checks use an explicit now value inside the semantics layer; the replay decision itself does not read the system clock.

Local Storage

SQLite is used as local relational storage. The storage layer enables WAL mode and uses short BEGIN IMMEDIATE write transactions. Downstream invalidation is performed with a recursive CTE. By default, local state is stored under:

.musubito/musubito.db

License

Musubito is dual-licensed:

Project details


Download files

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

Source Distribution

musubito-0.1.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

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

musubito-0.1.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file musubito-0.1.0.tar.gz.

File metadata

  • Download URL: musubito-0.1.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for musubito-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48f7dfedacefa01a6785d914dd60efd833d86c7d371840345d9ff3265a486911
MD5 d9f9c92ccd13e937fb65795f530cdf5c
BLAKE2b-256 ffa0d7e6e54c9e6756a781e211bbbd932199d15b76f783de356a83fc86eac0a9

See more details on using hashes here.

File details

Details for the file musubito-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: musubito-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for musubito-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85e9e97ad05df0e49700cf6f1d450731a549b846ca20431ac0ae20dc332de71d
MD5 64050c4e2da3879829c5eddfa930ef32
BLAKE2b-256 6a7bc14519fb9f451119c32f89f0c4545f7dd758e754361a3905403493313e66

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