Scenarios
A scenario is a YAML file that names an application, lists what to do to it and says how to check each step. Kasm Session Runtime runs it inside a Kasm session with nobody watching, decides a verdict, and writes a report with screenshots and a trace. The same file gives the same run in CI, on a schedule, or across many sessions.
A scenario fits when you know the steps in advance and want the result recorded. If a person works beside the agent, see Agent in your workspace. If you already have an agent or script, see Your agent or script.
Scripted steps, browser and accessibility control and the checks on them need no model. A model adds visual checks (observe:, expect:, a screen postcondition), clicks located on screen, and the runtime’s loop behind a goal: step. When you need a model lists each one.
A run from start to finish
Section titled “A run from start to finish”kasm-session-runtime run <file>... is one process in the session. It waits for the desktop and the application, runs the steps, checks that the application is still there, and writes the evidence.
mcp there are no stages: the caller decides what happens and when.| Stage | What happens | Needs a model |
|---|---|---|
| Boot wait | Waits until the X display accepts a connection, up to 60 seconds by default | No |
| Launch | Optional. Runs the scenario’s launch: command once, detached |
No |
| App wait | Waits for a process matching process: and a window matching window:, up to launch_timeout_s (60 by default) |
No |
| Settle | Waits settle_s (5 by default) for splash screens and first paint, and checks the application did not crash straight away |
No |
| Accessibility probe | Lists the controls the application publishes over AT-SPI. Recorded for reference, never part of the verdict. Skipped with atspi: false |
No |
| First look | Takes the post-launch screenshot, compares it with a baseline if one exists, and looks for an error-dialog window. With a model, also judges whether the application rendered | Only for the judgement |
| Steps | Runs steps: in order with each step’s checks. A failing step ends the run |
Only for visual checks and grounded clicks |
| Plan | Replays a compiled plan:. A step whose postcondition fails hands over to the loop |
No while postconditions hold |
| Goal loop | For a goal:, the runtime’s loop works towards the goal |
Yes |
| Final checks | Confirms the process is still running and the window is still present | No |
| Report | Writes the evidence to the output directory, with DONE last |
No |
When the application never appears, or a step shows it failing, the run goes to diagnosis: it re-checks the process to tell a crash from a crash loop, saves screenshots/99-failure.png, collects log tails and, with a model, asks for a description of the failure screen. Then it writes the verdict and the report.
A scenario with desktop: true has no single application. The run settles on the desktop, and its steps spawn, observe and kill each tool in turn. The final process and window checks are skipped. It cannot be combined with launch:.
Verdicts and exit codes
Section titled “Verdicts and exit codes”Each scenario gets one of four verdicts. The window, process and log checks decide it, together with the checks the scenario asked for. A model that cannot be reached never fails a run by itself, and nothing a model says turns a failure into a pass.
| Verdict | Meaning | Exit code |
|---|---|---|
pass |
The checks are clean and nothing is flagged | 0 |
pass-with-concerns |
It worked, and something needs a person’s attention, such as a first-run prompt, baseline drift or a goal the runtime’s loop could not verify | 0 |
app-failed |
The application is broken: it never launched, crashed, showed an error dialog, or an expected element or condition was absent | 1 |
test-error |
The runtime could not perform the test: no display, an unwritable output directory, the deadline passed, an escalation, or an interruption | 2 |
app-failed points at the application and test-error at the setup around it. Several files on one command line share the session and the deadline, and the worst verdict decides the exit code.
A second run aimed at an output directory that another live run is using exits 2 and writes nothing.
Deadline and interruption
Section titled “Deadline and interruption”KASM_RUNTIME_DEADLINE_S (600 by default) bounds the whole invocation. The last 30 seconds are kept for diagnosis and the report. SIGTERM or SIGINT ends the run early: the wait in progress is cancelled, the report is still written, and the verdict is test-error with outcome interrupted.
The report
Section titled “The report”Each scenario writes to $KASM_RUNTIME_OUT/<name>/, where <name> comes from the file name.
| File | What it holds |
|---|---|
report.md |
The verdict and reasons first, then the probes, the steps table and the visual section |
report.json |
The same record for programs, schema nix-testbench-report/1 |
trace.jsonl |
One event per line, in order, with timestamps |
screenshots/ |
One after launch and one per step, plus 99-failure.png on failure |
logs/ |
Log tails |
baseline-candidate/ |
A screenshot to promote to a baseline, written when none existed |
DONE |
Written last. Holds the verdict, so an orchestrator can wait for it and then read the rest |
A run of several files also writes summary.json at the top, with the worst-of verdict and one entry per file. The report reference lists every field. Secrets never appear in it; see Secrets and evidence.