Skip to main content

mira-eval — Python SDK

Author a Mira eval study in Python and run it with the mira host CLI.

This is not a binding to the Rust core — it's a native, pure-stdlib library that speaks the Mira eval protocol (newline-delimited JSON over stdio). The host owns selection, the model matrix, concurrency, saved runs, and reporting; the study owns subjects and scoring. Any language that speaks the protocol is a first-class study — this SDK just makes the Python side ergonomic.

The protocol layer is generated from the canonical artifacts under schema/v1/ — the same language-neutral contract the Rust host is generated from — so it never drifts from the wire format: mira/_wire.py (wire types, from schema.json) and mira/_meta.py (protocol version, methods, capability tokens, from meta.json).

Use

import mira

study = mira.Study("my-evals", version="0.1.0")

@study.eval(
    samples=[mira.Sample("hi", prompt="Say hi and the answer to life.", tags=["smoke"])],
    targets=[mira.target("sim")],
    scorers=[mira.succeeded(), mira.contains("42")],
)
def greet(sample, cx):
    # A real subject calls a model; route on cx.target / cx.provider.
    return mira.transcript(
        f"Hi! The answer is 42. ({sample.text})",
        usage=mira.Usage(input_tokens=40, output_tokens=8),
    )

if __name__ == "__main__":
    study.serve()

Drive it with the host:

mira list --study-python study.py
mira run --study-python study.py
# run-now, score-later (split execute/score path):
mira run --study-python study.py --execute-only --artifacts art/
mira score --study-python study.py --artifacts art/

--study-python is a convenience launcher (python3 …); --study study.py and --study-uv run via uv run … (PEP 723 inline metadata), and --study-cmd "python3 study.py" still works for an arbitrary command line.

A complete, runnable example lives in examples/greet-python.

API

  • Study(name, version=None, page_size=500) — the registry; @study.eval(...) registers a subject fn(sample, cx) -> Transcript; study.serve() runs the stdio loop (handling initialize/list/list_samples/run/execute/score). page_size paginates large datasets across list + list_samples (0 disables).
  • Sample(id, prompt=…|input=[…], tags=…, expected=…, files=…, metadata=…)sample.text joins the input turns for the subject.
  • target(label, provider="", available=True) — a matrix case (the model or harness under evaluation). An unavailable target is reported as N/A (infra), not a failure.
  • RunCxcx.target, cx.provider, cx.max_turns, cx.param(name).
  • transcript(final_response, usage=…, timing=…, iterations=…, …) and the Usage/Timing types.
  • Scorers: succeeded(), contains(text), equals(text), regex(pattern), and scorer(name, fn) for an arbitrary predicate (return a bool or a fully-formed Score, including na=True).
  • axis(name, values) — an extra matrix axis (crossed with the model matrix).

Develop

python3 codegen.py            # regenerate mira/_wire.py + mira/_meta.py from schema/v1/
python3 codegen.py --check    # fail if either is stale (CI drift guard)
pip install -e .[dev]
python3 -m pytest             # conformance + metadata-coverage + serve-loop tests

The runtime has zero dependencies; jsonschema and pytest are dev-only.

Download files

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

Source Distribution

mira_eval-0.4.0.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

mira_eval-0.4.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file mira_eval-0.4.0.tar.gz.

File metadata

  • Download URL: mira_eval-0.4.0.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mira_eval-0.4.0.tar.gz
Algorithm Hash digest
SHA256 43c4e83f301b6bdd87e8f0a8f8b2bd84ddb04bf521044abde9567592d32f82fa
MD5 5734a27c89b4409171be6ac1fa8df155
BLAKE2b-256 93b5207fc20b9dd605d9a5006c4514e934b3692886682b250edf698b348445f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mira_eval-0.4.0.tar.gz:

Publisher: publish.yml on everruns/mira

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mira_eval-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: mira_eval-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mira_eval-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9821ee2d93d64483e82c9c20a7fd9c81aa4e1cc5e905b3519e3333f380d4c68c
MD5 6f8cc234ff384a36b99fd72a1c5c82b9
BLAKE2b-256 93e287969f520f4ae943b2a6c01529c665d786143765e6116524ba8a13a3ff66

See more details on using hashes here.

Provenance

The following attestation bundles were made for mira_eval-0.4.0-py3-none-any.whl:

Publisher: publish.yml on everruns/mira

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 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