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.
  • RunCx — cx.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.

Metadata

Release files for mira-eval 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mira-eval 0.5.0
File Size Uploaded Provenance
mira_eval-0.5.0.tar.gz 26.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mira-eval 0.5.0
File Interpreter ABI Platform
mira_eval-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / mira_eval-0.5.0.tar.gz

Download URL mira_eval-0.5.0.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
561301b6f449c97081a93f8138043f7c77f5a1124d97e6ab0dd6e2c311d16a89
BLAKE2b-256 checksum
How to use checksums
2014c8ec76f8fdfbdbc5bca7e9721b31ba1a90e71ccdc88a791fc6a433839fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.

Transparency log

Release files / mira_eval-0.5.0-py3-none-any.whl

Download URL mira_eval-0.5.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25098174cec97d982d902e695f4d141e94e98fcad995400526643bb3d331b3d4
BLAKE2b-256 checksum
How to use checksums
a9c6861c563c85739979cb5425abfbdfe8c25dcc2b472309fa451958f2215e7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.

Transparency log

Security for mira-eval 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mira_eval-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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