Runs
Start and gate simulation runs from the terminal, read their graded calls, compare two runs and verify an agent version on held-back cases
fagi sim run starts one cloud run of an environment’s suite against an agent version, and fagi sim runs follows that run, reads its graded calls and acts on it. A run plays each selected scenario --trials times. Each play is a call, and every call is graded. For the whole path from build to fix, see the Simulate quickstart; Run a simulation describes the same run in the dashboard.
- Signed in to the CLI (see Sign in)
- A CLI with
fagi sim, which ships in a later CLI release - Credits: runs, retries, Insights and verify are charged
- An environment that finished building (see Environments)
- A suite version to run (see Save scenarios as a suite version)
Start a run
ENV_ID is the ID column of fagi sim env list. SUITE_VERSION_ID is the ID column of fagi sim suites list --env ENV_ID, and the agent and environment version IDs come from fagi sim env versions list ENV_ID.
fagi sim run --env ENV_ID --suite SUITE_VERSION_ID --dry-run
fagi sim run --env ENV_ID --suite SUITE_VERSION_ID --yes
# in a script: keep the Run ID
RUN_ID=$(fagi sim run --env ENV_ID --suite SUITE_VERSION_ID --yes --no-input --json | jq -r .job_id)
The run starts in the cloud and the command returns at once with the Run ID, the versions it pinned and the server’s warnings. Closing the terminal never cancels the run; check on it later with fagi sim runs status RUN_ID.
On these pages RUN_ID always means the Run ID: the job_id field (--json copies it to id as well, next to idempotency_key). Save it, because every fagi sim runs command except list takes it, and fagi sim runs list shows test execution IDs, which can’t be mapped back to it. The run_id, run_test_id and test_execution_id fields are not the Run ID; don’t pass them to fagi sim runs commands.
| Flag | What it does |
|---|---|
--env ENV_ID | The environment (required) |
--suite SUITE_VERSION_ID | The suite version to run (required) |
--agent-version VERSION_ID | Agent version (default: the environment’s saved default; with no default, the command exits 2 and lists the versions you can pass) |
--environment-version VERSION_ID | Environment version (default: the environment’s default) |
--scenario KEY | Run only this scenario key of the suite; repeatable. A key not in the suite exits 2 |
--trials N | Calls per scenario, 1 to 20 (default 1) |
--dry-run | Preview the run without starting it |
--idempotency-key KEY | Key for the run. After exit 6, rerun with the same key to get the run already started; a different selection needs a new key |
--wait | Wait until the run and its grading end |
--interval N | Seconds between polls with --wait (default 2, at least 1) |
--fail-under X | With --wait, exit 5 when the pass rate is below X, from 0.0 to 1.0 |
A run is charged, so it asks for confirmation; --yes, --wait-timeout and idempotency keys work as fagi sim flags describes.
A draft or discarded version, or an agent version that isn’t ready for this environment (see fagi sim env versions list ENV_ID), exits 2 with no run was started and the reason. --dry-run shows it as blocked: version_not_pickable (can’t be picked) or version_not_runnable (not runnable yet).
Preview with --dry-run
--dry-run shows the run a selection would start: the agent, environment and suite versions it would pin, each scenario, the server’s warnings and whether the selection is blocked. It creates nothing and is not charged; it is not a cost estimate. It exits 0 even when the selection is blocked, so check the blocked field instead:
fagi sim run --env ENV_ID --suite SUITE_VERSION_ID --dry-run --json | jq -e '.blocked == false'
The readiness checks in the preview show unavailable; you can ignore them. --wait, --interval, --fail-under and --idempotency-key apply only to a started run and exit 2 with --dry-run.
Wait and gate on the pass rate
fagi sim run --env ENV_ID --suite SUITE_VERSION_ID --yes --wait --fail-under 0.8 --wait-timeout 45m
--wait follows the run as fagi sim runs status --wait does: it waits for the run to end, then for its grading and every call’s scoring. The pass rate is the server’s graded pass rate, passed / measured, the number the run page shows.
| Exit | When |
|---|---|
| 0 | The run and its grading completed. Without --fail-under this holds even with failed or unmeasured calls; with it, the pass rate is at least X and every call was measured |
| 5 | The run completed, but the pass rate is below --fail-under, even when some calls were not measured |
| 6 | --wait-timeout ended the wait, you pressed Ctrl-C, or a network or server error |
| 8 | The run or its grading failed or was canceled, or with --fail-under there is no measured call or the run is partial at or above X |
The other codes follow the shared exit codes.
A partial run has a call that is inconclusive, errored or not graded, or a passed call whose grading failed or timed out. It never passes a --fail-under gate on its completed calls, even when the run page shows 100%.
To reattach to a run, or after exit 6: fagi sim runs status RUN_ID --wait --fail-under 0.8. It applies the same gate, and --wait-timeout prints this command when it ends the wait. Rerunning fagi sim run with the same --idempotency-key also returns the run already started.
Find and follow runs
| Command | What it does |
|---|---|
fagi sim runs list --env ENV_ID | One environment’s runs, newest first, with state, pinned versions and outcome counts |
fagi sim runs status RUN_ID | State and stage, pinned versions, per-scenario result counts, failure, consumption, the run’s IDs and web link; --wait and --fail-under as above |
fagi sim runs logs RUN_ID | The run’s events, oldest first: stage changes, scenario starts and retries, log lines and the terminal event |
fagi sim runs list --env ENV_ID --status failed --json
runs list flag | What it does |
|---|---|
--env ENV_ID | The environment (required) |
--status STATUS | pending, running, completed, failed, cancelled, cancelling or evaluating |
--search TEXT | Match the status or a scenario name |
--page N | Page number, from 1 |
--limit N | Runs per page, 1 to 100 (default 10) |
Warning
The ID column of fagi sim runs list is the test execution ID, not the Run ID (see Start a run); commands that take RUN_ID exit 4 if you pass it.
fagi sim runs logs sees only the latest attempt’s newest 100 events. Its flags:
| Flag | What it does |
|---|---|
-f, --follow | Print new events until the run ends |
--interval N | Seconds between polls with --follow (default 2) |
--scenario KEY | Only events with this scenario key, as the PAYLOAD.SCENARIO_KEY column shows it (not the scenario name) |
-n, --lines N | Only the last N events (with --follow, of the first read) |
--after N | Only events after sequence N (of the latest attempt unless --attempt is set) |
--attempt N | The attempt --after refers to; sequences restart at 1 on each attempt |
--follow exits 0 when the run ends, whatever its outcome, so gate with fagi sim runs status --wait instead.
Read results
fagi sim runs results RUN_ID
fagi sim runs results RUN_ID --status failed,error --limit 20 --json
Read run results shows the same results in the dashboard. fagi sim runs results prints the run’s pinned versions, scenario count and calls per scenario, the whole run’s outcome counts and consumption, then one page of calls. It is read-only and exits 0 whatever the outcome, unless you add --fail-under.
| Flag | What it does |
|---|---|
--status, --status-not | Keep or leave out calls by outcome: queued, in_progress, passed, failed, inconclusive, error. Repeatable or comma separated |
--goal-outcome | Keep calls by goal outcome: the outcomes --status takes, plus escalated |
--search TEXT | Match the goal, scenario name, end reason or error message |
--ordering FIELD | started_at, duration_seconds, latency_ms, turn_count, tokens, cost_cents, scenario, goal or outcome; a leading - sorts descending (default -started_at) |
--page N | Page number, from 1 |
--limit N, --page-size N | Calls per page, 1 to 500 (default 50); --page-size is an alias of --limit |
--fail-under X | Gate the whole run as in Wait and gate on the pass rate; exits 2 when combined with --status, --status-not, --goal-outcome or --search |
The header always counts the whole run; matched is how many calls the filters kept. Unmeasured tokens and cost show pending (or unknown after the run ends). --json prints run, results, count, page, page_size and total_pages; -o jsonl prints one call per line, so use --json when you need the run header.
Verdicts
Each call has the platform’s outcome and a result_state that separates a measured result from one that was never measured.
| result_state | Meaning |
|---|---|
pass | The call was measured and passed its checks |
fail | The call was measured and failed a check |
unmeasured | No verdict yet: queued, in progress, or inconclusive without a grading failure |
grader_error | Grading failed or timed out |
errored | The agent, simulator or environment broke before there was a result |
fagi sim runs trial show can also report infrastructure for an errored call that hit an infrastructure, connectivity or platform-sync failure; results shows that call as errored.
The pass rate counts outcomes passed and failed. A passed call whose grading failed shows grader_error; it still counts as passed but makes the run partial, so a --fail-under gate exits 8. A call’s final is true once the run ended and the call’s scoring is done.
Inspect one call
fagi sim runs trial show RUN_ID CALL_ID --include checks,transcript
fagi sim runs trial show RUN_ID CALL_ID --file trial.json
CALL_ID is the ID column of fagi sim runs results, the same call ID that fagi sim runs retry --call takes; a call of another run exits 4. The sections are input (goal, persona, scenario and sub-goals), transcript, tools (the recorded tool calls), state (what changed in the test world), artifacts (recordings) and checks (each sub-goal and evaluation with its verdict and reason).
| Flag | What it does |
|---|---|
--include SECTIONS | Print only these comma-separated sections; the header always prints |
--file PATH | Also write the whole call, every section, as JSON to PATH |
A check’s verdict is passed, failed, unmeasured or grader_error. Evidence the server does not return prints unavailable, never an empty value.
Act on a run
fagi sim runs retry RUN_ID --dry-run
fagi sim runs retry RUN_ID --yes --wait
fagi sim runs cancel RUN_ID --yes
fagi sim runs insights RUN_ID --yes --wait --json
| Command | What it does |
|---|---|
fagi sim runs retry RUN_ID | Re-run the interrupted calls (outcome error) as a new attempt of the same run, or the calls you name with --call CALL_ID (repeatable or comma separated; a call not in the run exits 4). --dry-run lists the calls it would re-run and sends nothing. With nothing to re-run it sends nothing and exits 0; while the run is still going it exits 2 |
fagi sim runs cancel RUN_ID | Stop the run; finished scenarios keep their results, and a run that already ended exits 0 |
fagi sim runs insights RUN_ID | Ask for Insights on a completed run (exit 1 otherwise); asking again keeps analysis already done and analyzes only failed calls again |
fagi sim runs insights show RUN_ID | Show the Insights state and findings; not_requested until you ask |
retry, cancel and insights ask for confirmation (retry and Insights are charged), so pass --yes in scripts. They all take --wait and --interval; insights --wait exits 0 when the analysis completed and 8 when it failed. Retry and Insights take no idempotency key: after exit 6, check fagi sim runs status RUN_ID before you repeat them. A repeated cancel is harmless.
Compare two runs
fagi sim runs compare RUN_ID --env ENV_ID --against BASE_RUN_ID
fagi sim runs compare RUN_ID --env ENV_ID --against BASE_RUN_ID --fail-on-regression --json
fagi sim runs compare lines up a run against the base run you name with --against. Each row is a scenario trial with its movement (regressed, mixed, improved, inconclusive or same), and the summary counts scenarios by movement. To compare two agent versions, pick runs that pinned the same suite. compare is in preview; its output may change.
| Flag | What it does |
|---|---|
--env ENV_ID | The environment both runs belong to (required) |
--against BASE_RUN_ID | The Run ID to compare against (required; exit 2 without it); it must differ from RUN_ID |
--fail-on-regression | Exit 5 when any scenario regressed |
Without --fail-on-regression the command exits 0 whatever the movements. compare needs platform v1.60.0 or later; an older platform exits 1 with platform_too_old.
Verify an agent version
fagi sim verify --env ENV_ID --agent-version AGENT_VERSION_ID --yes
fagi sim verify --env ENV_ID --agent-version AGENT_VERSION_ID --trials 3 --yes --wait --fail-under 0.9 --json
fagi sim verify runs an agent version on the environment’s held-back cases: scenarios hidden from coding agents, so a version can’t be tuned to them. A verify doesn’t show up in fagi sim runs list, and it reports only counts, never the cases or their checks: passed, failed, total, trials, the 95% range of the pass rate (held_back_pass_rate) and limited_validation, which warns that too few cases are held back to call a version verified.
| Flag | What it does |
|---|---|
--env ENV_ID | The environment (required) |
--agent-version VERSION_ID | The agent version to verify (required); it must be ready for this environment (see fagi sim env versions list ENV_ID) |
--trials N | Calls per held-back case, 1 to 20 (default 3) |
--wait, --interval N | Wait until the verify ends, polling every N seconds (default 2) |
--fail-under X | With --wait, exit 5 when the lower bound of the pass-rate range is below X |
A verify is a charged cloud run, so it needs --yes without a terminal. Without --wait it prints the verify_id and state and exits 0. With --wait it exits 0 when the verify completed with at least one decided call, 8 when it failed, was canceled or has no decided call, and with --fail-under 8 when there is no range to gate. A version that is not ready exits 2 (version_not_pickable), and an environment with no held-back cases exits 1 (held_back_empty).
A completed verify is final: asking again for the same version starts nothing and returns it. Asking again while it runs returns it too, so running the command again is how you reconnect. After a verify that failed or was canceled, asking again starts a new one.
Dive deeper
Questions & Discussion