| name | mira |
| description | Author and run Mira evaluations — the Rust-first, code-first eval framework for agents and tools. Use when writing eval suites, adding scorers/subjects, running evals across a model matrix, wiring evals into CI, or driving the `mira` host CLI. Covers in-process (`subject_fn`), polyglot (`CliSubject`), and everruns runtime subjects. |
Mira evals
Mira is a developer tool shaped like a test runner.
Eval = Dataset(Sample…) + Subject + [Scorer…] × model matrix
- Subject — what's under test:
subject_fn (in-process), CliSubject
(any external binary, the polyglot path), or mira_everruns::RuntimeSubject.
- Scorer — grades a
Transcript: built-ins (text, tools, budgets, files),
combinators (all_of/any_of/not), closures, or model_graded.
- Matrix —
Targets plus extra .axis(name, values); missing API keys
skip, so runs are green offline.
Install
The framework is a library (mira-eval, imported as mira); the runner is a
binary (mira-cli, installed as mira).
CLI (mira host) — install the prebuilt binary; don't build from source:
brew install everruns/tap/mira
Prebuilt binaries for macOS (arm64/x86_64) and Linux (x86_64) are also attached
to each GitHub Release: https://github.com/everruns/mira/releases. If Homebrew
enforces tap trust checks, run brew trust --tap everruns/tap once first.
Building from source (cargo install mira-cli --locked) is the fallback only.
Framework (Rust studies) — add the library to your crate:
cargo add mira-eval
cargo add mira-everruns
Cross-language studies need no Rust framework at all — see SDKs.
Authoring an eval study
A study is a program that defines evals and calls
mira::Study::registered().serve(); register factories with #[eval]. The
lightest form is a single file (study.rs) with cargo-script frontmatter for
its deps — run with mira run --study study.rs, no Cargo.toml. The same code
also works as a crate [[bin]] (--study-bin NAME) or examples/*.rs
(--study-example NAME).
#!/usr/bin/env -S cargo +nightly -Zscript
---
[package]
edition = "2024"
[dependencies]
mira-eval = "0.3"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
---
use mira::scorer::{file_contains, succeeded};
use mira::subject::subject_fn;
use mira::{eval, Eval, Sample, Target, Transcript};
#[eval]
fn coding() -> Eval {
Eval::new("coding")
.describe("Edits a file to satisfy an instruction")
.add_sample(Sample::new("add-fn", "Add a greet function to lib.rs").file("lib.rs", "// here\n"))
.subject(subject_fn(|sample, cx| async move {
let mut t = Transcript::response("done");
t.files.insert("lib.rs".into(), "fn greet() {}\n".into());
t
}))
.scorer(succeeded())
.scorer(file_contains("lib.rs", "fn greet"))
.targets([Target::sim(), Target::anthropic("claude-opus-4-8")])
.build()
}
#[tokio::main]
async fn main() -> std::io::Result<()> { mira::Study::registered().serve().await }
The host shims cargo-script onto stable (materializes a throwaway crate from
the frontmatter); MIRA_SCRIPT_NATIVE=1 uses cargo -Zscript on nightly.
Full example (tools + budget scorers + main), the polyglot CliSubject, the
everruns runtime subject, in-process Runner tests, and custom scorers:
references/cookbook.md. A non-Rust study runs via
--study-cmd "..." (or --study study.py / --study-python) — see
examples/greet-python/.
Running
mira list --study study.rs
mira run --study study.rs
mira run --study study.rs add-fn
mira run --study study.rs --tag smoke
mira run --study study.rs --targets sim
mira run --study study.rs --axis effort=low
mira run --study study.rs --preset smoke
mira run --study study.rs --format junit --out results.xml
mira run --study study.rs --format html --out report.html
mira run --study study.rs
mira run --study study.rs --resume <run_id>
mira report <run_id>
mira run --study-bin NAME
mira run --study-cmd "python3 study.py"
mira doctor --study-bin coding
Exit code is non-zero if any case failed — drops straight into CI. Run
mira help --full for an overview, every flag, examples, and links.
When a setup misbehaves (typo'd mira.toml keys, a preset that selects
nothing, duplicate sample ids, unavailable targets, torn run folders), run
mira doctor: it lints the config, the study's advertised listing, and the
saved-run store, and mira doctor --fix applies the safe repairs (removing
leftover temp files, re-rendering missing reports). Errors exit non-zero.
Scorers
A case passes only if every .scorer(...) passes. Families: text/output
(succeeded, contains, regex, json_field_equals…), tools
(tool_called, tools_used_exactly, tool_called_before…), trajectory
structure over the ATIF trajectory — tool arguments, observations, steps
(tool_called_with, tool_arg_matches, observation_contains,
steps_within; they fail if the subject reported no trajectory), budgets
(tokens_within, cost_within, latency_within…), files (file_exists,
file_contains), and combinators / custom (all_of, any_of, not,
scorer(name, closure), model_graded(rubric, judge)).
Prefer trajectory-based scoring for agent behaviour: Transcript.trajectory
(ATIF) is the primary structured contract — produce it via
TranscriptSource::AtifFile, the everruns subject, or an SDK study — and it is
the only place tool arguments and observations exist. The raw events
channel is an advanced fallback for producer-specific data the trajectory
doesn't model; don't score against events when the trajectory covers the need.
Full catalog with semantics: references/scorers.md.
Subjects
What's under test — pick one per eval:
subject_fn(...) — in-process Rust (see Authoring above).
CliSubject — evaluate any external binary (the polyglot path).
mira_everruns::RuntimeSubject — a real everruns runtime session.
Recipes for all three (+ in-process Runner tests):
references/cookbook.md.
Cross-language studies (SDKs)
Any language that speaks the protocol is a first-class study: the host owns
selection, the model matrix, concurrency, saved runs, and reporting; the study
owns subjects and scoring. The SDKs are native (not FFI bindings) and generated
from the canonical schema, so they never drift from the wire format.
Examples (runnable, offline)
All run against the sim model with no API keys, so they stay green in CI and
cost nothing. Browse: https://github.com/everruns/mira/tree/main/examples
cargo run -p mira-cli -- run --study examples/greet.rs
cargo run -p mira-cli -- run --study-bin matrix
cargo run -p mira-cli -- run --study-cmd "python3 examples/greet-python/study.py"
Learn more (read on demand)
Progressive disclosure: this skill is the overview. Bundled references ship with
the skill (offline) — read them first:
Canonical prose lives in the repo docs — open one only when the task needs that
depth:
Or run mira help --full for the self-orienting CLI guide (overview, every flag,
examples, links).