Goal steps
A goal: is a sentence. When the steps are not known in advance, or one stretch is too variable to script, the scenario states the goal and the runtime’s loop works towards it: it looks at the screen, picks a tool, sees the result and repeats until it records a verdict or reaches a limit. The scenario file decides what the loop may touch.
The loop needs a model that supports tool calling, set with KASM_RUNTIME_VISION_ENDPOINT (any OpenAI-compatible server; Gemma 4 is a model that works well). The signed-in Claude Code fallback that answers screen.judge for an agent in a workspace does not drive the loop. With no endpoint, the loop is entered, marked degraded and returns at once, the report carries a concern, and the deterministic checks decide the verdict. Plans and postconditions describes what that means for a failing plan.
A scenario with a goal
Section titled “A scenario with a goal”This is the 03-agentic-goal example from the toolkit.
app: chromewindow: "Chrom"process: "chrome"cdp: true
steps: - action: cdp_navigate "http://127.0.0.1:8901/login.html"
goal: "Sign in to the application using the credentials provided, and confirm that the dashboard has loaded."
provides: username: "demo-user" password: "demo-password"
cdp_targets: username-field: "#username" password-field: "#password" login-button: "button.login"
cdp_waits: dashboard: "location.hash === '#/dashboard'" welcome-message: "document.getElementById('who').textContent === 'demo-user'"
agentic_max_iterations: 14steps: runs first as setup and must pass. The loop then starts from where the steps left the screen. In a real run the loop observed the screen, filled both fields by name, clicked the button, waited for dashboard, checked the result and recorded goal-met, in seven model calls.
What the scenario declares
Section titled “What the scenario declares”| Field | What it gives the loop |
|---|---|
goal |
The sentence to work towards |
provides |
The only values that can reach a text field. The loop names a key; it never composes the text or sees the value. Use $VAR references for secrets |
cdp_targets |
Browser elements by name, each mapped to a selector the author wrote |
cdp_waits |
Named JavaScript conditions the loop can ask about |
click_targets |
Named window positions (fractions from 0 to 1) for click, scroll and, with two or more, drag |
wait_conditions |
Named conditions (growing file or running process) for the wait_while tool |
tools |
Tools the scenario defines, built from a literal command or a wait |
rules |
A pattern in captured output that offers a declared tool to the loop |
policy |
The procedure the loop follows: the built-in skill generic-gui-test, or inline text with vars |
agentic_max_iterations |
Cap on model calls for this loop. Default 25 |
The vocabulary
Section titled “The vocabulary”The loop sees a list of tools built for the run. A tool is on the list only when the session can support it.
| Tool | Present when |
|---|---|
observe_screen, press_key, click, scroll, type_text, wait, check_expectation, record_verdict, escalate |
Always |
drag |
The scenario declares at least two click_targets |
list_elements, click_element, set_text, set_value, select_item |
AT-SPI is permitted (atspi: true, the default) |
click_grounded |
A model endpoint is configured |
cdp_url, cdp_list_interactive, cdp_click_described |
A browser tab is attached |
cdp_wait |
The scenario declares cdp_waits |
cdp_query, cdp_click, cdp_fill |
The scenario declares cdp_targets |
wait_while |
The scenario declares wait_conditions |
respond |
The operator sets runner.respond: true |
ask_human |
The run has an inbox |
| The scenario’s own tools | The scenario declares tools: |
A call naming anything else is rejected with the list of available tools. There is no tool to run page script, kill a process or write a file, and a scenario with no tools: block gives the loop no shell. An operator can remove built-ins with tools.disabled in the operator file.
Guardrails
Section titled “Guardrails”The runtime enforces each rule before the tool runs.
- Parameters are checked against each tool’s schema: required keys, types, enums and bounds. A violation is a malformed call and goes back to the loop with the exact error.
click,scrollanddragtakecenteror names fromclick_targets. The loop supplies no coordinate.clickalso takes a button, a count of 1 to 3 and modifiers.cdp_query,cdp_clickandcdp_filltake names fromcdp_targets. The loop writes no selector or script.type_text,cdp_fillandset_texttake a key fromprovides. The result reports only the number of characters typed.press_key,click,scroll,drag,type_textandclick_groundedneed anobserve_screenorcheck_expectationsince the screen last changed. A call without one is refused, naming the missing step. Accessibility tools,cdp_*tools andwait_whiletake their target from the application or the scenario and do not need it.click_groundedtakes a description and the change it expects. The runtime locates the description on a fresh capture, clicks, and judges the screen against the expectation:confirmed,contradictedorunavailable. Onlyconfirmedcounts as verified. After a contradicted click the loop is told the change was not observed, and the runtime does not click again on its own.
Two inputs carry the loop’s own words. press_key takes any key or chord the keyboard layout maps, one call per key; disable it in the operator file where stray keystrokes matter. check_expectation and click_grounded send a description to the model as a question and never to an input device. The prose in escalate, record_verdict and respond lands in the report, redacted like everything else. What the model can do lists the limits in full.
Declared tools and rules
Section titled “Declared tools and rules”A declared tool wraps a literal command, a wait or a relaunch. Every parameter is an enum, so the loop chooses which value, never what runs.
tools: apply: description: "Install a missing runtime dependency, then relaunch the application." params: name: {enum: [gdiplus]} run: shell commands: gdiplus: "echo 'gdiplus install started'" then: relaunch prerequisites: [observe_screen] side_effects: true budget: 2 on_error: nonzero_exit: resolution missing_command: environment
rules: - match: "Library gdiplus.dll .* not found" offer: {tool: apply, name: gdiplus}prerequisites names tools that must have run first. budget caps calls to the tool, and a further call fails as a resolution error. on_error classifies a failure: a resolution error goes back to the loop with the step left open, an environment error ends the run as test-error. A rules entry matches captured output, including the launch command’s log lines, and offers the tool to the loop. A tool may also carry a post: list; if the command runs and the postcondition does not hold, the loop gets an error naming the condition. The 06-declarative-remediation example in the toolkit has a complete pair of scenarios.
When the application will not start
Section titled “When the application will not start”Two launch: settings hand a startup problem to the loop. Both need a goal:, and continue cannot be combined with cdp: true.
| Setting | With continue |
|---|---|
on_missing_window |
The app-wait deadline becomes the loop’s first observation instead of the verdict |
on_error_dialog |
An error dialog on the first screen becomes the loop’s first observation. The loop may dismiss it |
The final checks still decide the verdict. A window absent at the end, or a dialog still showing, is app-failed whatever the loop recorded.
Limits and escalation
Section titled “Limits and escalation”| Bound | Default | When reached |
|---|---|---|
| Model calls in one loop | 25 (agentic_max_iterations) |
The loop ends and the report notes there was no model verdict |
| Malformed replies, whole run | 3 | The loop degrades |
| Consecutive failed model calls | 2 | The model is off for the rest of the run |
| Whole run | 600 s (KASM_RUNTIME_DEADLINE_S) |
The last 30 s are kept for the report |
The loop can call escalate to ask for a person. The run pauses, bounded by the deadline and runner.escalation_pause_s, and the report records the application’s state before and after. The verdict is test-error with outcome escalated.
The verdict
Section titled “The verdict”The runtime decides the verdict from the deterministic checks.
- A model’s
goal-metnever upgrades a failure. - A model’s
goal-not-metbecomespass-with-concerns, and becomesapp-failedonly when a deterministic failure already exists or acheck_expectationthe loop ran came back false. - A visual judgement can fail a run when the scenario asked for it with
expect:or the first look reads an error.
With no model, or after the model is switched off mid-run, report.json sets agent.deterministic_only and the deterministic checks decide alone.