Skip to content
Draft, pre-release documentation

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.

This is the 03-agentic-goal example from the toolkit.

app: chrome
window: "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: 14

steps: 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.

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 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.

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, scroll and drag take center or names from click_targets. The loop supplies no coordinate. click also takes a button, a count of 1 to 3 and modifiers.
  • cdp_query, cdp_click and cdp_fill take names from cdp_targets. The loop writes no selector or script.
  • type_text, cdp_fill and set_text take a key from provides. The result reports only the number of characters typed.
  • press_key, click, scroll, drag, type_text and click_grounded need an observe_screen or check_expectation since the screen last changed. A call without one is refused, naming the missing step. Accessibility tools, cdp_* tools and wait_while take their target from the application or the scenario and do not need it.
  • click_grounded takes 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, contradicted or unavailable. Only confirmed counts 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.

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.

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.

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 runtime decides the verdict from the deterministic checks.

  • A model’s goal-met never upgrades a failure.
  • A model’s goal-not-met becomes pass-with-concerns, and becomes app-failed only when a deterministic failure already exists or a check_expectation the 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.