Repeat, resume and compare

Run each scenario several times into a job directory, continue an interrupted job, grade it again, and compare it with a baseline, a budget or an earlier job.

One run of a scenario tells you little about an agent that answers differently each time. This guide shows how to repeat runs, keep every trial on disk, continue a job that was interrupted, and compare results so that a regression turns into a non-zero exit code.

Before you start

  • You can run a scenario and read its summary. See Run your first scenario.

  • ROBOTELOS_E2E_TOKEN holds a token, set without printing it. In PowerShell:

    $env:ROBOTELOS_E2E_TOKEN = (Get-Content -Raw "$HOME\.robotelos\dev\token").Trim()
    

    In bash:

    export ROBOTELOS_E2E_TOKEN="$(tr -d '\r\n' < "$HOME/.robotelos/dev/token")"
    
  • The target states effects_mode sandbox or you use --k 1. A target whose effects are real, or that does not say, allows one run per spec: --k above 1 and --sweep are refused.

Repeat a run

  1. Set a job directory that does not exist yet. In PowerShell:

    $job = Join-Path $env:TEMP "robotelos-job-$(Get-Date -Format yyyyMMdd-HHmmss)"
    

    In bash:

    job="${TMPDIR:-/tmp}/robotelos-job-$(date +%Y%m%d-%H%M%S)"
    
  2. Run each spec five times, two at a time. In PowerShell:

    .\robotelos.exe test run runtime/internal/e2e/testdata/specs `
      --url http://127.0.0.1:8787 --agent concierge --profile live `
      --inspect-url http://127.0.0.1:8787 --effects-url http://127.0.0.1:8793 `
      --k 5 --parallel 2 --job-dir $job --out "$job.report.json"
    

    In bash:

    ./robotelos test run runtime/internal/e2e/testdata/specs \
      --url http://127.0.0.1:8787 --agent concierge --profile live \
      --inspect-url http://127.0.0.1:8787 --effects-url http://127.0.0.1:8793 \
      --k 5 --parallel 2 --job-dir "$job" --out "$job.report.json"
    

    Some specs in that folder need the stack started with ROBOTELOS_ENGINE_TEST_CAPABILITIES=true. See Test against a real agent.

  3. Read the output. The first line says target states environment ..., effects .... Each spec has a line such as PASS reserve-table-en 5 of 5 runs passed, 0 criteria not checked, 0 not applicable. The last line counts specs that passed in every run and the runs by outcome. After the summary the command prints job directory with the path.

  4. Check the exit code: echo $? in bash, $LASTEXITCODE in PowerShell. 0 means every spec passed. See Test command reference for the rest.

--k is the number of runs per spec. 1 is a check, more is an evaluation. --parallel is how many runs are under way at once, on the text channel only. Each run is judged by its own conversation.

--job-dir takes the text channel only and does not go with --sweep or --channel voice. It refuses a directory that already holds a job. The directory is created if it is missing. Only one runner can hold a job directory at a time. A second runner exits with code 6.

What is in a job directory

DIR/job.json    DIR/plan.json    DIR/result.json    DIR/lock
DIR/trials/<cell-digest>-r<n>/attempt-<m>/
    intent.json  conversation.json  trajectory.json  scores.json  evidence.json  attempt.json
DIR/regrades/<n>/   result.json  meta.json  trials/<cell-digest>-r<n>/scores.json
  • job.json records what the job is: its format (robotelos.job-dir/1), the specs and their digests, k, the profile, the target address, the agent and the name of the token variable. The token itself is never stored.
  • plan.json lists the trials. A trial is one spec and one repeat.
  • result.json is the report of the job.
  • lock is an operating-system lock. The system releases it when the process ends, so a crash leaves no stale lock.
  • Each attempt writes intent.json and flushes it before the target is contacted. It writes attempt.json last. An attempt is finished only when attempt.json is there and the digests of its other files hold.

Do not edit these files by hand.

Continue an interrupted job

If the run stopped before the end (Ctrl-C, a crash, a lost network), continue it:

.\robotelos.exe test resume $job
./robotelos test resume "$job"

Resume reads the target, specs, k and profile from job.json, asks the target again, and refuses if the target now states another environment or effects mode. Finished attempts stay. The token variable named in job.json must be set.

Resume accepts only flags that do not change the job: --parallel, --out, --baseline, --baseline-latest, --store, --suite, --budgets, the --tol-* flags, and the user, persona and judge flags, each only as the job already has them. Any other flag is refused with exit code 2.

An interrupted attempt stays UNKNOWN

An attempt that has an intent.json and no attempt.json was started, and the target may have been touched. Nobody knows what happened. The runner marks it UNKNOWN. It never deletes it and never runs it again silently.

  • A trial with an UNKNOWN attempt is UNKNOWN in result.json, whatever a later attempt finds. A retry is stored in its own directory and does not clear the old attempt.
  • Resume runs the trial again only if the target states that its effects are a sandbox, the attempt’s deadline has passed, and the old conversation could be closed or its effects attributed to it. Otherwise the message says stays UNKNOWN, with the reason.
  • A job with an UNKNOWN trial never exits 0. It exits 4. It exits 1 instead when a spec failed (with a baseline: when a regression was found), or a budget ceiling was exceeded. Do not report it as passed.

Grade a job again

regrade grades the stored conversations against the current spec files. It contacts no target.

./robotelos test regrade "$job"
./robotelos test regrade "$job" --baseline baseline.json

The result goes to DIR/regrades/N. Exit codes match test run. Exit code 2 writes nothing when a trial cannot be graded again. regrade takes the job’s lock, so a running job gives exit code 6. A regrade asks no model and holds no judge result.

Compare two jobs

./robotelos test diff "$baseline_job" "$job"

diff compares the latest regrade of each job, or result.json if a job has none. --regrade N compares regrades/N on each side that has it. The first line prints baseline ... compared ....

  • Exit 0: no regression. Exit 1: a regression. Exit 2: the jobs cannot be compared or a run is missing. Exit 4: an UNKNOWN trial on either side. 4 wins over 1.
  • Jobs must measure the same thing: environment, effects mode, profile, channel, evidence, run count k, the specs that graded them and the persona of each spec. A job with a different k is refused.
  • A job whose result.json is marked cancelled is refused.

diff reads only. It takes no lock and contacts no target.

Compare with a baseline report

A baseline is an earlier report written with --out. Give it to a later run:

./robotelos test run runtime/internal/e2e/testdata/specs \
  --url http://127.0.0.1:8787 --agent concierge --profile live --k 5 \
  --inspect-url http://127.0.0.1:8787 --effects-url http://127.0.0.1:8793 \
  --job-dir "$job" --baseline baseline.json

The run prints no regression against the baseline or one REGRESSION: ... line per finding. A regression gives exit code 1. A run with an UNKNOWN trial never gives exit code 0, whatever the baseline says. It gives 4, or 1 when a regression was found or a budget ceiling was exceeded. A baseline of a cancelled run is refused.

To keep reports instead of naming files, use a store. A store keeps every report under a suite name, the profile with the environment, and the channel:

./robotelos test run ... --store reports --suite smoke --baseline-latest
  • --store and --suite go together. The suite name uses lower-case letters, digits, dot, dash and underscore.
  • --baseline-latest compares with the latest report of the same suite, profile and channel. If there is none yet, the run prints no earlier report of ... in the store; nothing to compare with.
  • After the run, the command prints kept as ID. A cancelled report is not kept, because it would become the next baseline.
  • --baseline and --baseline-latest are two ways to choose the baseline. Give one.

Tolerances

By default any extra failure against the baseline is a regression. These flags allow some:

FlagAllows
--tol-failed NN extra failing runs.
--tol-errors NN extra runs that could not be made.
--tol-unrunnable NN extra runs in which nothing could be judged.
--tol-incomplete NN extra runs in which a required criterion could not be judged.
--tol-latency-pct PP percent more P95 time to the first answer. 0 means not gated.
--tol-stage-pct PP percent more P95 in a stage of a call. 0 means not gated.

test regrade and test diff take the same --tol-* flags. Never raise a tolerance to make a run pass. Agree it once, in writing, and keep it.

Check against a budget

A budget file sets ceilings per environment, whatever the baseline was. Pass it with --budgets FILE:

{
  "environments": {
    "stg": {
      "stage_p95_ms": {"first_audio_ms": 1500},
      "reply_p95_ms": 3000,
      "min_pass_rate": 1,
      "max_mean_wer": 0.05,
      "stage_p95_pct": 20,
      "reply_p95_pct": 20
    }
  }
}
  • The environments are local, dev, stg and prod. An unknown field, environment or stage is refused. A field that is not set is not checked.
  • stage_p95_ms names stages from recognition_ms, turn_wait_ms, agent_ms, tts_first_audio_ms, speak_ms and first_audio_ms.
  • min_pass_rate and max_mean_wer are from 0 to 1.
  • stage_p95_pct and reply_p95_pct fill in the percent tolerances that you did not give as flags.
  • A complete example is voice/scripts/budgets.json.

The budget of the environment that the target states is the one that counts. --environment local|dev|stg|prod (alias --env) is the environment you expect. If the target states another, the run is refused with exit code 2. If you leave it out, the run takes what the target states. A run against prod is refused: no spec is tagged prod-safe yet.

The run prints within the budget of ENV, BUDGET (ENV): ... for each ceiling it is over, or no budget for ENV in FILE. A ceiling that is exceeded gives exit code 1.

Measure how fragile the agent is: --sweep

--sweep runs the specs as they are and again with each perturbation (typos, dropped words, no punctuation and so on). It prints the pass rate of each with its interval, and marks a fall that is larger than the luck of the runs with FALL. --sweep-out FILE writes the sweep report. A sweep does not go with --baseline, --baseline-latest, --store, --job-dir, --judge-model or --persona.

The advisory model judge

A spec can ask a model whether a reply states or implies an action that the recorded effects do not show:

{"kind": "judge", "value": "no_unsupported_success"}
  • The answer is advisory and not calibrated. It changes no verdict, exit code or metric. A judge criterion is never required, so a spec with only judge criteria is INCOMPLETE.
  • Turn it on with --judge-model NAME --judge-model-url URL on test run, or with the variables ROBOTELOS_E2E_JUDGE_MODEL and ROBOTELOS_E2E_JUDGE_MODEL_URL. It works with Ollama only. The address is never the target.
  • The judge’s server receives the text of what the user and the agent said, and the capability and input of every recorded effect of the conversation. Do not point it at a server you do not trust with that.
  • The report holds judge per run: PASS, FAIL, UNKNOWN (no valid answer, or a model error) or NOT_JUDGED. An input that is too long is never cut. It is NOT_JUDGED.
  • It needs --effects-url, because the effects come from there.
  • A job records the judge’s model and address. test resume takes them from the job and refuses others.

To measure the judge against people, label runs from stored reports in a file with the format robotelos.judge-labels/1:

{"format": "robotelos.judge-labels/1", "labels": [
  {"report": "job/result.json", "spec": "reserve-table-en", "run": 1, "rubric": "no_unsupported_success", "human": "PASS"}
]}

report is relative to the labels file, run counts from 1, and human is PASS (no unsupported claim) or FAIL. For a persona matrix, add persona. Then run:

./robotelos test judge-agreement labels.json

It prints one line: compared N labels: observed agreement ..., kappa ..., false pass ..., false fail .... Exit 0 means the labels could be compared. Exit 2 means they could not. It gates nothing.

Cancelled runs

A cancel that leaves a run unmade or cut short marks the report with "cancelled": true, also in DIR/result.json of a job. The command exits with code 5.

  • test diff and --baseline refuse a cancelled report.
  • Finish the job with robotelos test resume DIR. A resume that completes writes result.json without the mark.
  • test regrade DIR --baseline FILE refuses a cancelled job. test regrade DIR without --baseline still works.
  • Jobs written before the mark existed carry none, so a cancelled one among them is not recognised.

If something goes wrong

  • Exit code 6, the job directory is in use by another runner: another process holds DIR/lock. Wait for it, or use a new directory. Do not delete lock.
  • Exit code 4 after a resume: read the lines marked UNKNOWN. The reason says what is missing: a sandbox target, the deadline, or a conversation that could not be closed. See Checklist for agents.
  • Exit code 2 with real effects allow one run per spec: the target does not state a sandbox. Run with --k 1, or start a sandbox target.

Next steps