Skip to content
Draft, pre-release documentation

Kasm Session Runtime serves 68 methods over the Model Context Protocol (MCP) when it runs as kasm-session-runtime mcp. An outside agent, such as Claude Code, Codex or any other MCP client, uses them to drive the desktop directly. No scenario runs in this mode; your agent decides whether its task succeeded, and the report’s verdict covers the runtime’s own health. The same methods are available as plain HTTP calls at POST /v1/call/<method> (see HTTP API).

Family Methods
screen 6
windows 5
input 8
clipboard 2
Processes, launch, shell, wait_while 6
Applications 3
recipes 4
dom 21
a11y 8
human 1
Files 2
Downloads 2

Most of these methods need no model in the runtime. Three of them, screen.judge, screen.ground and screen.ask, use a vision backend, and recipes that declare screen.* steps use it too. The backend is the endpoint in KASM_RUNTIME_VISION_ENDPOINT (any OpenAI-compatible server). With no endpoint set, a signed-in Claude Code agent in the workspace answers screen.judge, screen.ground and screen.ask with a small Claude model on the same account, unless KASM_RUNTIME_HARNESS_VISION=off. Codex and OpenCode do not answer them. With neither, the three return a resolution error and every other method works as normal. The “Model” column in each table below says which is which.

Every call is recorded as one row in report.json’s steps[] with "backend": "rpc", the same record a scripted run leaves.

stdio Streamable HTTP
When the default KASM_RUNTIME_SESSION_TOKEN is set
Wire JSON-RPC 2.0, one message per line MCP Streamable HTTP at /mcp, port KASM_SESSION_RUNTIME_PORT (default 9434)
Protocol version initialize must send 2024-11-05 chosen per request by the Mcp-Protocol-Version header; 2026-07-28 and later are stateless, earlier versions use initialize and Mcp-Session-Id
Credential none; the pipe is the trust boundary the session token in the X-Kasm-Runtime-Session-Token header, 401 if missing or wrong
Typical caller a client that starts kasm-session-runtime mcp as a subprocess inside the session a client outside the container, reaching the session through Kasm’s reverse proxy

The initialize reply’s instructions are the session guidance MCP clients can pass to their model: reuse running applications and start installed ones with apps.start, and for a request naming an application or service, prefer an installed desktop application found in apps.list to the website. They also carry the recipe protocol every harness needs (read the guide, recipes.index, trust only a verified receipt, answer a needs_decision with decision.resume_call plus decisions, receipt_path as an absolute path) the progress-update rules, and what the session is: a container with no systemd, the /v1/files/ and /v1/dirs/ routes as the one way files move in and out, and that only a persistent profile’s home directory or mapped storage outlives the session. stdio and HTTP send the same text. Claude Code’s launcher appends only a note about loading deferred tools.

No method has a credential of its own; the transport’s credential covers every method.

Coordinates are screen pixels unless a request asks for the agent canvas with the header X-Kasm-Runtime-Coordinates: agent (stdio: KASM_RUNTIME_COORDINATES=agent). The managed Claude Code launcher sends it. The canvas is a fixed 1280×800: the screen is fitted into it at its own aspect ratio and centred, with black bars where its shape differs from 16:10. The runtime’s sidebar keeps the desktop at 16:10, so there are normally no bars.

  • screen.capture returns the 1280×800 canvas with space: "agent" and the real screen_width and screen_height. A region is in canvas pixels; a window crop is the window’s visible rectangle on the canvas. A crop’s input point is origin_x, origin_y plus the image point.
  • Points sent to input.click, input.move, input.drag, input.scroll and input.wait_for are canvas points; one in a bar is outside the screen. screen.ground points, a11y.action click points and input.wait_for events come back as canvas points.
  • Window x, y, w and h (windows.list, windows.wait, windows.close, windows.move_resize) convert linearly, so off-screen positions keep their meaning.
  • dom.* coordinates are page CSS pixels in either space.
  • A coordinate action is refused when the screen size changed since the caller’s last observation (a capture, window list or grounding); capture again. The check is best effort: it compares sizes, so a resize there and back, or any change that is not a resize, is not caught.

The token goes in a custom header because Kasm’s port-map proxy overwrites Authorization before forwarding. Through Kasm, the address is https://<host>/desktop/<kasm_id>/runtime/mcp, where runtime is the port-map service name and mcp is the runtime’s own path.

Calls are handled one at a time on both transports, and on HTTP a second call waits for the first to finish. The session has one display, and DOM calls can address pages in several registered applications.

tools/list returns the 68 methods in sorted order, each with its JSON Schema. The HTTP server stays off unless the session is started with KASM_RUNTIME_SESSION_TOKEN; see Enable the runtime on a workspace.

Some MCP clients list dotted names with underscores, so apps.start can appear as apps_start. Over /v1/call/ the dotted name is the one to use.

A method that fails returns a normal tools/call result with isError: true. The message starts with the method name and says what went wrong. Failures fall into three classes.

Class Meaning What to do
Malformed bad or missing parameters; the call never touched the session fix the parameters and retry
Resolution a capability is unavailable, something was not found, or a wait timed out retry, try something else, or give up
Environment the runtime itself is broken: X11 unreachable, a command that cannot start, the model erroring not retryable

Over /v1/call/, the class decides the HTTP status: malformed is 400, resolution 422, environment 500. A refusal with structured detail, such as a mutation a modal dialog blocks (see a11y), also carries it: as error.data over /v1/call/, and as JSON after the message in an MCP result.

JSON-RPC protocol errors are used for unparsable input, unknown methods and shutdown. A call that arrives after the server has begun shutting down, or is still waiting its turn then, is refused with a JSON-RPC error whose message names “server shutting down” (code -32001 on stdio); that call never ran and records no step. A call already running when shutdown begins finishes and is recorded.

Method Parameters Returns Model
screen.capture optional, at most one of window (a reference from windows.list) or region ({x, y, width, height}, all required inside it) {Width, Height, JPEGBase64, origin_x, origin_y, scale_x, scale_y, screen_width, screen_height, window?, space?, artifact?}, at the size actually captured No
screen.judge expectation (string, required) {Holds, Description} Yes
screen.ground description (string, required) {Found, X, Y, Description} Yes
screen.ask question (string, required) a plain-text answer Yes
screen.mark none {frame, held} No
screen.wait until (settled or changed) and timeout_s (required); since (a frame from screen.mark, required for changed); window {matched, elapsed_ms, changed_fraction, frames_compared} No
  • screen.capture, screen.ground, screen.ask, screen.mark and screen.wait need the X11 display; without it they return a resolution error (“no X connection”).
  • With no window or region, screen.capture returns the whole screen. A window capture is the window’s visible rectangle, including anything that covers it. A region is in screen pixels. The image is never resized (scale_x and scale_y are 1), and a crop’s input point is origin_x, origin_y plus the image point. artifact names the saved file under screenshots/, which GET /artifacts/<file> serves.
  • The three vision methods use the endpoint in KASM_RUNTIME_VISION_ENDPOINT when one is set. With none, a signed-in Claude Code agent in the workspace answers them through one stateless call per question, to a small Claude model on the same account; the frame goes to that provider. Codex and OpenCode do not answer them, and KASM_RUNTIME_HARNESS_VISION=off turns the fallback off. With no backend, or when the runtime has stopped calling the endpoint after repeated failures, they return a resolution error that names the endpoint and the fallback. An error from the model during the call is an environment error, except in screen.ground, where a location the model cannot give is a resolution error.
  • screen.ground returns a location and does not click; pass its X and Y to input.click. They are screen pixels whatever answer convention the model uses. When the element is not visible it returns Found: false with no point.
  • screen.ask sends the screenshot and, when available, text from the attached browser tab (title, URL, visible text, interactive elements) and the accessibility tree’s actionable elements.
  • Grounding accuracy depends on the model, capture settings and screen size. See Vision models.
  • screen.wait is the wait for an application with nothing else to wait on. Take screen.mark before acting and pass its frame as since: changed then matches when the screen differs from that frame by more than the settle threshold, even if the repaint finished before the wait began. settled matches when two frames in a row agree. window compares only that window’s rectangle, so a video elsewhere does not keep the screen moving. A timeout is matched: false, not an error. Marks are kept within 32 MiB, newest first; an expired frame is a resolution error. While it waits, no other call runs.
  • changed says the pixels changed, not which action changed them, and settled says the screen stopped moving, not that an operation finished. Measured on LibreOffice, GIMP, VLC and a Wine application, a changed after a click, a key or a drag matched within 14 to 208 ms, and a settled took about 200 to 400 ms.
Method Parameters Returns Model
windows.list application (optional) {windows: [{window, application, scope, for_application, modal, transient_for, blocked_by, xid, title, class, instance, pid, owner, type, x, y, w, h, active}], partial, reasons, cursor, serving, blocked_by, unresolved_blockers} (serving, blocked_by and unresolved_blockers only with application, and absent when empty; a row’s blocked_by absent when nothing blocks it) No
windows.wait since (the cursor from windows.list) and timeout_s (required); exactly one of appear (application, for_application, title, class, type, all optional) or gone (a window reference) {matched, elapsed_ms, window, cursor} No
windows.activate window (required); probe {window, active, confirmed_by, reason, frame} No
windows.close window (required); timeout_s (default 2, at most 30) {window, status, method, elapsed_ms, cursor, row, reason} No
windows.move_resize window (required); at least one of x, y, w, h {window, method, x, y, w, h} No
  • These methods need the X11 display.
  • windows.list gives each window a window reference, which lasts until the window is closed (null when the window could not be watched), and its owner’s application reference, the same references apps.list and dom.targets use, so an agent can tell which application a window or a page belongs to. The owner is taken from the X server’s own record of which program created the window (owner: x-resource). A window’s own claim to a process (owner: claimed) is shown in pid but gives no reference. type tells an application’s windows (normal, dialog) from the desktop’s own (dock, desktop). Titles are redacted. scope is the window’s accessibility frame once windows.activate has mapped it, which a11y.list and a11y.tree take. for_application is the application the window serves through its transient parent, as a file chooser serves the application that opened it. With application, only that application’s windows are listed, and windows other programs show for it are listed apart under serving. partial and reasons say when part of this could not be read.
  • modal says the window is marked modal (_NET_WM_STATE_MODAL), and transient_for names the window it belongs to (its WM_TRANSIENT_FOR), as a file chooser belongs to the window that opened it. A row’s blocked_by lists the modal windows that block it. With application, blocked_by and unresolved_blockers are that application’s modal blockers as seen on X; see the modality rule under a11y.
  • windows.list also returns a cursor. Pass it to windows.wait as since: list, act, then wait, and a window that opened between the action and the wait still matches. appear matches a window that opened after the cursor and meets every field given: application is the window’s owner, for_application the application it serves through its transient parent (a file chooser serves the application that opened it), title a substring, type dialog, normal, or popup for a menu or tooltip. gone matches the window being destroyed. A timeout is matched: false. While it waits, no other call runs.
  • A toolkit can open a popup of its own before the one you want: on a right click LibreOffice opens a 10x10 popup off the screen, then its menu. Check the matched window’s position, and wait again from the returned cursor if it is off the screen.
  • Qt hides a menu it closes and keeps the window, so gone does not match a closed Qt menu. Take screen.mark before closing it and use screen.wait changed.
  • windows.activate raises and focuses the window, then reads back which window is active: active, and confirmed_by active-window, pid (another window of the same application, such as its own dialog) or none with a reason. It does not route input: keys go to whatever has the focus.
  • frame is the window’s accessibility frame. While none is known for the window, the raise also maps the window to its frame: status: exact with a scope, shown from then on by windows.list, or unknown with the reason. Measured on GTK3 applications and LibreOffice the mapping is exact; Qt applications such as VLC, and Wine applications, report no activation over the accessibility bus, so it stays unknown. A window that is already active cannot be mapped; probe: true activates another window first, which a person watching sees, and a session with a single window has no other to use.
  • windows.close asks the window to close, never kills it, and waits timeout_s for it to go. status is closed; pending when it is still there, usually because the application is asking to save: wait for the question with windows.wait from the result’s cursor; or refused when the window cannot be asked and no window manager closed it. Measured: a LibreOffice drawing and a GIMP image with changes returned pending and their question matched at once; windows with nothing to save closed in under 200 ms.
  • windows.move_resize returns the geometry read back, which is what the window manager allowed. A maximised window does not move or resize under the Kasm images’ window manager; the result says so by returning the unchanged geometry.
Method Parameters Returns Model
input.key chord (string, required), e.g. "ctrl+s" "pressed <chord>" No
input.click x, y (integers, required): root-window pixels; optional button (left, middle, right), count (1 to 3), modifiers (ctrl, shift, alt, super) "clicked (x, y)" No
input.move x, y (integers, required) {x, y} No
input.drag from, to ({x, y}, required); optional button, modifiers, steps (2 to 200, default 10), hold_ms {from, to, steps, button, modifiers} No
input.scroll x, y (integers, required); dy, dx (-50 to 50, one non-zero) {x, y, dy, dx} No
input.type exactly one of ref or text; optional keystroke_ms, key_hold_ms "typed N character(s)" No
input.cursor none {cursor} No
input.wait_for exactly one of text, key or click; optional since, timeout_ms, origin {matched, captured, events, cursor, dropped} No
  • input.key, input.click, input.move, input.drag, input.scroll and input.type need the X display (resolution error without it). An input the X server does not accept, or a point off the screen, is a resolution error. A non-integer or out-of-range number is malformed.
  • input.click presses count times, each press, release and next press click_ms after the one before (so presses are twice click_ms apart), with modifiers held around the clicks and released in reverse; its result names what is not the default ("clicked (10, 20): right, x2, ctrl+shift"). input.move adds no pause. input.drag moves steps times along the line, drag_step_ms apart, and releases at to. input.scroll turns the wheel in notches: negative dy up, positive down, negative dx left, positive right. A cancelled click, drag or scroll still releases its button and modifiers.
  • Measured on LibreOffice, GIMP, VLC and Notepad++ under Wine: a double click selected the word under the pointer, in LibreOffice and under Wine; a drag drew and then moved a shape in LibreOffice Draw by exactly the distance dragged, painted in GIMP, and selected lines under Wine; three notches of input.scroll moved GIMP’s canvas; a shift-click drew GIMP’s straight line; and input.move onto a GIMP tool showed its tooltip half a second later. A right click opened the context menu in all four.
  • input.type records only the length of what it typed. See ref or literal.
  • input.type types one key per character: each key is held key_hold_ms (default 15) and the next pressed keystroke_ms (default 30) after its release, so a character takes about 45 ms and 2,000 characters about 90 s. A call can set either: keystroke_ms from 0 to 1000, key_hold_ms from 0 to 249. A hold of 250 ms or more is malformed, because X repeats a key held past its autorepeat delay, which is 250 ms on some desktops. The operator’s defaults are timing.input.keystroke_ms and timing.input.key_hold_ms.
  • input.cursor and input.wait_for need KASM_RUNTIME_OBSERVE_INPUT=true. Without it they return a resolution error saying so.
  • input.wait_for waits for input the session receives from any source, the Kasm viewer included. click is {button, x, y, radius}: button defaults to 1, radius to 0, and leaving out both x and y matches anywhere. timeout_ms defaults to 5000, at most 60000. origin is external (the default: not the runtime’s own input), runtime (clicks only) or any.
  • On timeout input.wait_for returns matched: false with what was captured, without an error. Take input.cursor before acting and pass it as since, so input that arrives before the wait begins still matches.
Method Parameters Returns Model
clipboard.get none {text, bytes} No
clipboard.set exactly one of ref or text {bytes} No
  • Both need the X11 display. clipboard.set holds the text until another application copies something or the session ends; paste it with input.key ctrl+v. That is much faster than input.type for long text, and safer for text with line breaks, which an editor’s completion can take.
  • clipboard.get reads what an application copied, so ctrl+c then clipboard.get reads back text from an application with no accessibility tree. Measured with LibreOffice and with Notepad++ under Wine, in both directions. A Windows application copies line breaks as CR LF.
  • text is redacted like everything the runtime returns; bytes is the clipboard’s own length. Neither method records the text in the report, only its length. The runtime reads the clipboard only when clipboard.get is called.
Method Parameters Returns Model
proc.list match: substring of /proc/*/cmdline, "" for all the matching processes No
proc.spawn cmd (string, required) "spawned" No
proc.kill match (required): a case-sensitive POSIX extended regular expression "sent" No
launch cmd (required), env (object of strings, optional) "launched" No
shell cmd (string, required) combined stdout and stderr No
wait_while kind (growing or process) and timeout_s (required); path or match; poll_s (default 0.5); quiet_polls (default 3) "quiesced" No
  • Processes start detached, as the session user. launch also records the process as the session’s launched app.
  • launch and proc.spawn refuse a command whose program is an installed application’s own, once both are resolved through PATH and symlinks (a name alone never matches), and the error names the apps.start call to use, with the command’s URL when apps.start takes it. The application’s launcher supplies its desktop and runtime settings, such as a browser’s password store and debugging endpoint, which a command built from the program skips. A command through the launcher itself, and a program no entry runs, start as before. This guides an agent; it is not a boundary, since shell runs anything.
  • A command that cannot start is an environment error. A proc.kill pattern that does not compile is malformed.
  • shell runs a command line with sh -c to completion and returns stdout and stderr together. Under kasm-session-runtime mcp it has no time limit of its own unless the operator set a maximum session lifetime, so give a slow command its own timeout. The output is cut at evidence.shell_output_chars (see the operator file) and registered secrets are removed from it. A nonzero exit is a resolution error that carries the output; sh failing to start is an environment error. A call holds the session’s one-call-at-a-time lock until it returns.
  • wait_while holds until a growing file or directory stops changing size, or no process matches, for quiet_polls samples in a row. If timeout_s passes first, it is a resolution error. growing needs path; process needs match.

The first two methods let an agent find out what the session can run and start it by name, with nothing told in advance. The catalogue is the workspace’s own application menu: one row per desktop entry, settings panels included, with its description, categories and the URL schemes it handles, plus the ways it can be driven once it runs.

Method Parameters Returns Model
apps.list application (optional); include ("all", optional) {applications: [{name, source, profile, state, application, instances, display, generic, description, categories, schemes, drive, actions, registrations, pages, windows, scopes, related_surfaces, backends, blocked_by, unresolved_blockers}], unassociated, partial, reasons, hidden?} No
apps.start name (required); action, url, timeout_s (default 20) {name, outcome, state, application, registrations, windows, waited_s, reason} No
apps.handoff handoff (required): the token a mutation’s data.handoff gave; timeout_s (default 5, at most 30) {handoff, kind, status, surfaces, reason, origin_application, origin, origin_window, elapsed_ms, expires_in_s}: the handoff as it stands now No
  • name is the entry’s own identifier, such as google-chrome or slack, and is what apps.start takes. registrations are the names dom.targets lists the application under once it runs; an agent recognises the registration that appears after a start from this field, not from name.
  • drive is a set of cdp, accessibility and screen: how the application can be driven once it runs. screen is always there. On a workspace built with the launcher the set comes from what the image says about the application; elsewhere it is inferred from the entry’s categories.
  • Without application, desktop settings panels (entries in the Settings category) that are not running are left out and counted in hidden; include: "all" lists them. A desktop image can carry over fifty, and a full listing grew past what an agent’s client shows it. A row for an application that is not running leaves out the fields that describe a running instance (instances, registrations, scopes, related_surfaces, backends, blocked_by, unresolved_blockers); on a running row an empty list means none.
  • state is installed, starting or running. running needs evidence: a registration that validates, or a window owned by the application’s program. starting is a start whose evidence has not arrived yet.
  • A running application’s row also has scopes, its top-level accessibility windows, which a11y.list and a11y.tree take as scope; related_surfaces, the dialogs other programs show for it and any accessibility tree only suspected to be its; and backends, whether cdp, accessibility and x11 are available for it now, with the reason when not. blocked_by lists the modal dialogs that block it now and unresolved_blockers the ones that may, each with its evidence; see the modality rule under a11y. partial is set when the accessibility bus was asked and failed, not when the scenario sets atspi: false or the session has no session bus; the accessibility backend says that.
  • apps.start runs the entry’s own command, with url in the place the entry leaves for one and nothing else substituted; it never composes a command. A URL whose scheme the application does not handle is malformed, with http and https allowed for a browser, and a file: URL of a local path for an application whose entry lists a file type. starting is not a failure: call apps.list or dom.targets again. Starting an application that already runs hands over to the running instance.
  • A running application no entry describes, such as one started from a shell, is listed too, from its registration or its window, with source saying which. Registrations that do not validate, and windows with neither an owner nor a class, go in unassociated, with reasons; a registration there also says its protocol.
  • apps.handoff looks again at a menu or dialog an action was asked to watch for (see handoff), without repeating the action. A token lasts 60 seconds after the call that made it; after that, or for a token never given, the call fails and says to look with apps.list or windows.list instead.
  • An entry that wants a terminal says terminal: true; apps.start refuses it, since the runtime opens no terminal. Use shell for such programs.
  • display, generic and description are redacted like titles. Without the X11 display the windows are not read, and partial says so.

These methods act on the pages of the browsers and Electron applications a session runs, over the Chrome DevTools Protocol (CDP). None needs a model.

Every call names what it acts on. dom.targets lists the applications the runtime knows, each with its pages and a page reference for every page. The other methods take a page reference, or an element handle from dom.list_interactive, which carries its page. There is no current tab and no default: a call that names neither is malformed, even when only one page exists.

Method Parameters Returns
dom.targets none {registrations: [{name, protocol, available, reason, hint?, generation, browser, profile, pages: [{page, target_id, type, title, url, application, window, window_relation, dialog?, fedcm?}]}], registry_dir, note?}
dom.navigate page, url (both required), timeout_s {identity, data: {outcome, verification, url, kind, http_status?, download?}}: the URL reached, whether a new document committed or the response became a download, and the response’s HTTP status
dom.url page (required) {identity, data: {url}}
dom.query page, selector (CSS; both required) {identity, data}: the element’s tag, attributes, text, visibility and enabled state
dom.read_text page, selector (CSS; both required); max_chars (default 4096, at most 65536); offset; snapshot (required with a nonzero offset) {identity, data: {text, total_chars, offset, truncated, next_offset?, snapshot}}: the section’s text
dom.xpath page, expressions (1 to 32 XPath 1.0 strings, each at most 2048 characters; both required); root (CSS selector for one element); max_nodes (default 20, at most 100); max_chars (default 4096, at most 16384) {identity, data: {observation, xpath_version, main_document_only, results: [{index, kind, value?, truncated, nodes_truncated, text_truncated, total_nodes?, error?}]}}: one ordered entry per expression
dom.list_interactive page (required), filter (case-insensitive substring of the name) {identity, data: {elements: [{handle, role, name, disabled}], truncated, hint, total}}
dom.click element, or page with selector; button (left, middle or right); dispatch (input or script); expect; handoff {identity, data: {outcome, verification, element, method, button, at}}; with dispatch: script, method is HTMLElement.click() and there is no button or at; with handoff, also handoff
dom.click_described page, description (both required); expect the same
dom.fill element, or page with selector; exactly one of ref or value; dispatch (input or script); keystroke_ms; key_hold_ms; expect the same, with method, chars (the value’s length in characters), typing and field
dom.key key (required); element or page; expect; handoff the same
dom.type text or ref; element or page; dispatch (input or script); keystroke_ms; key_hold_ms; expect the same, with method, chars and typing
dom.hover element, or page with selector; expect the same, with method and at
dom.scroll element, or page with selector; or page with dy and dx (CSS pixels); expect the same, with method, and for a wheel at and scroll
dom.set_files element, or page with selector; paths (required); expect the same, with method and files
dom.dialog page, accept (both required); text or ref, for a prompt; expect the same, with method and dialog, the dialog answered; with an answer, chars
dom.fedcm page (required); id, the fedcm.id the answer is for; exactly one of account (an index), button (continue, got_it or more_details) or dismiss: true; expect the same, with method and fedcm, the dialog answered
dom.wait page, predicate (JavaScript boolean; both required), timeout_s {identity, data: {holds, elapsed_ms}}
dom.attach page (required), raise {identity, raise?}
dom.register name, profile (both required), pid {name, revision, replaced}
dom.unregister name (required) {name, removed}

Where the applications come from: on a nix image, every browser and Electron application of a runtime-driven session is listed under the name of its nix profile, such as chrome or slack. A browser started on a fixed debugging port, such as 9222 from APP_ARGS, is the registration named default, at KASM_RUNTIME_CDP_ENDPOINT. On a nix image that endpoint is the port APP_ARGS fixes, and absent when they fix none; elsewhere it is http://127.0.0.1:9222 unless set. An application you started yourself is added with dom.register, naming the profile directory it writes its DevToolsActivePort file in. dom.targets reads everything afresh on each call: call it first, and again after an application opens, restarts or closes.

  • dom.read_text reads the text of one section of a page, for prose too long for dom.query. It changes no focus, selection or clipboard. The selector searches the document and then open shadow roots. Form values, hidden content and regions declared sensitive are left out, block boundaries become newlines, and generated text and nested frame or shadow contents are not included. Counts are in Unicode code points. When truncated is true, call again with offset set to next_offset and the previous snapshot; if the document or the section changed in between, the call is refused. A section too large to read is refused; narrow the selector.
  • dom.xpath evaluates up to 32 XPath expressions against one sanitized, detached copy of the page’s main document, in one pass. It works on CDP pages only and does not look into frames or shadow roots. root, when given, must match exactly one element, and an absolute path cannot leave it. Node text is the document’s text, not what is rendered. A link also returns its href, whole or not at all within max_chars. Form controls, scripts, styles and hidden or sensitive regions are removed. Attributes are limited to id, class, role, the aria-label, aria-labelledby and aria-describedby attributes, alt, title, lang, dir, type, href, datetime, rel, componentkey and the test-id attributes data-testid, data-test-id, data-test, data-qa and data-cy; hrefs keep the HTTP(S) path with no credentials, query or fragment. max_chars is one budget across an expression’s nodes in document order: the node where it runs out is cut and marked text_truncated, later nodes are left out (nodes_truncated, with total_nodes counting every match), and no node comes back with empty text. A bad expression is reported in its own entry’s error; an oversized capture fails the call, so narrow root. The response is at most 64 KiB.
  • Page read and mutation results carry identity beside their data: the page the call resolved to, the application’s name, its generation, the CDP target_id, and the page’s title and url, read after the action for a mutation. A call that could not resolve its page reports no identity.
  • A reference belongs to one incarnation of its application. When the application restarts, its registration is replaced or removed, or the page closes, the reference is retired: the call fails before anything is sent, says why, and asks for a fresh dom.targets. A retired reference never becomes valid again.
  • A handle names one element in one document. It is never matched by text: after a navigation the handle is stale and the call fails, naming the cause; list the page again. dom.click_described matches the description against the listing’s names, exact first and then a unique substring. No match and more than one match are both errors that list what is on the page, with handles, and nothing is clicked.
  • An unfiltered listing of a page with more than 100 interactive elements is withheld, with a hint to pass filter. With a filter, total counts the matches.
  • outcome says whether the action was dispatched: performed, not_performed, or outcome_unknown when it was sent and the connection failed before the answer, in which case look at the page before repeating it. verification is a separate claim about the effect: held, failed, unreadable, or none when nothing was checked. dom.fill reads the field back, dom.type compares the text before and after, dom.set_files reads the input’s files back, and dom.click, dom.key, dom.hover and dom.scroll have no check of their own. expect, a JavaScript predicate with an optional timeout_s, adds a check of yours to any of them.
  • dom.key and dom.type reach the page over CDP, whether or not its window has focus on the desktop. With element, the element is focused first, and the call is refused with nothing sent if focus did not land on it. With page, the page’s focused control gets the input.
  • Typing. dom.fill and dom.type type their text one key per character over the browser’s debugging protocol, as a person types it: for each character the page sees a trusted keydown, keypress, beforeinput, input and keyup, and its own key handlers, maxlength and focus moves apply. A capital or a shifted symbol is typed with Shift held. A line break is the Enter key, which types a new line in a textarea or an editor and submits a form’s single-line input. A tab is the Tab key, which moves focus to the next control. Accented letters, other scripts and emoji are typed as keys too (measured on Chrome 154 and Firefox 156). Any other control character is malformed, with nothing sent. The pacing is input.type’s: key_hold_ms and keystroke_ms, settable per call. The call’s time limit grows with the text, so a long text is not cut short. method is Input.dispatchKeyEvent, or input.performActions on a bidi page.
  • dom.fill sets a field to exactly the value. It focuses the field, clears it with Ctrl+A and Backspace if it holds text, types the value, and reads the field back. A read-only field, or one that does not take focus, is refused with nothing sent, and so is a value with a tab (its key would move focus to the next control) or a value with a line break for a single-line field (its Enter would submit the form). A page that formats or limits what is typed may leave the field different from the value: a card number grouped in fours, a maxlength, or a one-time-code box that moves focus to the next box as each digit arrives. The fill is still performed, and field says what the field holds: matches is whether it shows exactly the value, and length is its length in characters. The value and the field’s text never appear in a result. verification is held when the field could be read back, whatever it shows; check field.matches, or pass expect, when the exact value matters. A select, and a date, time, colour or range input, are not typed: their value is set directly, with method value setter.
  • dom.type never clears. With page, or an element that has focus, the text goes where the caret is, and a selection is replaced. An element without focus is focused and End pressed first (Ctrl+End in a textarea or an editor), so the text goes at the end; typing.moved names the key.
  • typing in the result: typed and of are the characters typed as keys and the text’s length, counted as chars is (a carriage return and line feed are two), keystroke_ms and key_hold_ms the pacing used, cleared that dom.fill cleared the field first.
  • A page dialog that opens while typing (from a key handler) stops it: the call is performed, its verification unreadable and naming the dialog, and typing.typed says how many characters went in before the key that opened it. A key handler can put what was typed into its dialog, so while that dialog is up its message is reported only by its length, everywhere the dialog appears.
  • dispatch: script on dom.fill or dom.type uses the earlier way instead: dom.fill sets the value through the field’s value setter with untrusted input and change events (method value setter), and dom.type inserts the whole text at once (Input.insertText on Chrome, a burst of keys on Firefox). A page can tell either apart from typing.
  • In dom.targets, an unavailable registration of an installed application has a hint. With none of the application’s windows open, it is the apps.start call that starts it through its launcher. With a window open, it says the application runs but its endpoint does not answer: it may still be starting, or it was started without the launcher, and apps.start would not change that. Without a complete window list there is no hint.
  • In dom.targets, protocol is what an application speaks on its debugging port: cdp for Chromium-family browsers and Electron applications, or bidi (WebDriver BiDi) for Firefox. A record that says nothing is cdp. The fixed endpoint, default, is detected each time, so a Firefox started with --remote-debugging-port=9222 is default with protocol: bidi.
  • The dom.* methods work the same on both, with two differences. A bidi page has no accessibility tree, so dom.list_interactive and dom.click_described fail there as environment errors, and there are no element handles: use page and selector. And a mutation’s method names the BiDi command (input.performActions, input.setFiles, browsingContext.navigate, browsingContext.activate) where a Chromium page names the CDP one.
  • Firefox’s first page, about:home, accepts only dom.navigate: navigate somewhere first.
  • In dom.targets, a page’s application is the browser process behind it, as an application reference that windows.list and apps.list also use. It is null when the runtime cannot confirm which process serves the page, such as for a remote endpoint. Its window is null and its window_relation is unknown: which of the browser’s windows shows the page is not established. Do not infer desktop focus or window ownership from a page title.
  • dom.attach is never a prerequisite; every other method connects on its own. With raise: true it brings the page’s window to the front for a person watching, and raise says whether the browser was asked and whether the desktop’s active window then belonged to the page’s application (confirmed: process), or nothing confirmed it (none, with the reason).
  • An application must have a debugging port. On a nix image whose launcher registers what it starts, every browser and Electron application has one. Elsewhere, the browser must be started with --remote-debugging-port and a --user-data-dir (see Compatibility); a browser without one is listed as unavailable, with the reason.
  • An endpoint must be a loopback address unless KASM_RUNTIME_CDP_ALLOW_REMOTE=true.
  • Selectors and shadow roots. A selector searches the page’s own document first, then each open shadow root of a web component, depth-first in document order, and names the first match. It never names two elements, and a match in the page’s own document always wins. A selector matches within one tree: x-card #save does not reach a button inside x-card’s shadow root, so name the element by a selector that holds inside its own tree, such as #save. A closed shadow root cannot be searched by page script at all, so no selector reaches into one. A miss names the defined custom elements that show no open shadow root, as places a selector cannot search; a hyphenated tag the page never defined, such as a framework’s app-root, is a plain element and is not named; on a Chromium page dom.list_interactive lists the controls inside a closed root as handles. A predicate in dom.wait or expect is your own JavaScript and runs as written: document.querySelector there searches only the page’s own document.
  • http_status in dom.navigate’s result is the HTTP status of the response the new document was made from, after any redirects, as the browser’s own network events report it; url is then the URL the redirects ended at. It is left out when it is not known: a same-document navigation (a fragment change) loads no document, and about:blank has no response. Chrome 154 and Firefox 156 both report a data: URL as 200. Firefox 156 reports 304 for a page it revalidated and then showed from its cache. A status of 400 or more is not an error: the navigation is performed and the page that loaded is the server’s error page, so check http_status before reading the page as the one you asked for. A navigation that becomes a download (kind: download) reports the status of the response that became the file, as both browsers report it.
  • A missing parameter, or element combined with page or selector, is malformed. An element that is not found, a predicate that does not hold before timeout_s, and a navigation the browser refuses are resolution errors.
  • While a modal dialog blocks the page’s application, every method here that changes the page (dom.click, dom.click_described, dom.fill, dom.key, dom.type, dom.hover, dom.scroll, dom.set_files, dom.navigate) fails as not_performed and sends nothing, as the a11y modality rule says: the browser itself would let the click through behind a file chooser. Reads still work.
  • Page dialogs. A page’s own alert, confirm, prompt or “Leave site?” dialog is reported as dialog: {type, message, default_value?, controls?}. It appears in the page’s identity on every result and on the page’s row in dom.targets. controls are the dialog’s buttons, and a prompt’s entry, as the browser’s accessibility tree lists them: {handle, role, name}, where a11y.action takes the handle.
    • While a dialog is up: every method that changes the page is refused, with nothing sent. The refusal names the dialog and says how to answer it: dom.dialog, or as a person would, where input.key Escape dismisses it and Return accepts it, typing with input.type answers a prompt, or a11y.action presses a button.
    • Answering it with dom.dialog: accept: true presses OK (or Leave), false Cancel (or Stay). A prompt’s answer is text, or ref for a scenario-provided value; it is never echoed back, and chars is its length. The answer goes over the browser’s protocol, so nothing reaches the desktop and the modality rule does not apply. Verification is held when the browser reports the dialog closed as asked, failed when it reports it closed otherwise or it is still up, with observed saying which. With no dialog up, or text for anything but a prompt, it is refused with nothing sent; a dialog that closed some other way just before is refused by the browser and reported not_performed.
    • Reads: Chrome answers nothing on the page until the dialog closes, so reads fail at once the same way. Firefox keeps answering reads. The exception is a dialog that was already up before the runtime first connected to the page: Chrome then answers nothing on the new connection, so calls fail after 5 seconds, saying a dialog is the likely cause and naming its buttons when the accessibility tree shows it. Only the desktop answers that dialog. See the known issues.
    • A dialog that opens during a call: the call ends at once, naming the dialog. A click whose handler calls confirm() is performed, with verification: unreadable. An expect or a navigation’s wait ends the same way, and so does a navigation that a “Leave site?” dialog holds.
    • Frames: a dialog opened by a frame inside the page, cross-origin or not, is the page’s dialog on both browsers.
    • Answering: the runtime never answers a dialog on its own.
  • A navigation that becomes a download. When the URL’s response is a file to save, such as one sent as an attachment, dom.navigate returns outcome: performed with kind: download and download: {suggested_filename}, the name the browser proposed. No new document commits, and the page stays on its current URL. Take a downloads.list cursor before navigating and wait for the file with downloads.wait (see Downloads). Chrome reports it in its answer to the navigation and Firefox in an event just before; both were measured on Chrome 154 and Firefox 156.
  • Federated sign-in (FedCM). On Chrome, a page’s “Sign in with …” prompt or navigator.credentials.get({identity}) opens the browser’s own account chooser. It is drawn by the browser, so the page’s DOM does not contain it. While one is up, the page’s identity and its row in dom.targets carry fedcm: {id, type, title, subtitle?, accounts: [{index, email, name}]}. type is account_chooser, auto_reauthn (the browser signing a returning account in by itself), confirm_idp_login (sign in to the provider first), error, or other for a type the runtime does not know.
    • The page is not blocked: reads and input keep working while the chooser is up, and the page’s sign-in request waits for an answer.
    • Answering it with dom.fedcm: account signs in with that account, by its index from fedcm.accounts. button presses continue on a confirm_idp_login dialog, or got_it or more_details on an error dialog. dismiss: true closes the dialog without signing in, and the page’s request is rejected. Pass id with the fedcm.id you read the accounts from: the order of the accounts can change from one chooser to the next, and an answer whose id is not the dialog up is refused with nothing sent. The answer goes over the browser’s protocol, so nothing reaches the desktop. Verification is held when the browser reports the dialog closed. It is failed when the dialog is still up, or when the browser shows its error dialog in place of the chooser after an account was chosen (the provider refused the sign-in); observed says which. With no dialog up, an id for another dialog, an index out of range, or a button the dialog does not have, it is refused with nothing sent.
    • Firefox: Firefox does not support FedCM. The page’s request is rejected at once, so no chooser opens, and dom.fedcm is refused with nothing sent.
    • From the desktop: the chooser is also in the browser’s accessibility tree, as a scope named by its title with one button per account. Pressing an account with a11y.action works, and so does a person’s click, while the runtime is connected to the page. An account new to the site then needs a second press on “Continue as …”.
  • dom.click and dom.click_described scroll the element into view and press and release the button (left by default) at its centre over the browser’s debugging protocol, so the page receives the click as a person’s: trusted, with the pointer and mouse events before it, and with user activation. at is the point, in CSS pixels of the page’s viewport. The point is read from the element itself, so the screen’s resolution and the page’s scrolling do not move it. The click is refused, with nothing sent, when the pointer would miss the element: something covers its centre (the error names it; the element’s own label on top counts as the element, unless a link or button inside the label is at that point), it is not displayed, it is inside a closed details, it is an option of a closed select (set the select’s value with dom.fill), or it has pointer-events: none. A right click on a page that does not handle it opens the browser’s own context menu. The point is right at a browser zoom other than 100% (measured at 125% and 150% on Chrome 154, device scale factor 1): the event reached the element at the point given.
  • dispatch: script on dom.click (left button only) calls the element’s own click() in page script instead. The page can tell it apart: its isTrusted is false, and no mouse events come before it. It has no user activation, so what needs one may not open: on Chrome, neither a file chooser nor a popup does. Use it only when that is what you want.
  • A click whose own handler opens the page’s alert, confirm or prompt is performed at once, and the result’s identity carries the dialog. Neither browser answers the click’s own command while that dialog is up, so its verification is unreadable, and the reason names the dialog and how to answer it. A dialog that opens as the pointer moves onto the element (from a hover handler) stops the click before its button: it is not_performed, and the error names the dialog.
  • dom.hover moves the page’s pointer to the element’s centre over CDP; the desktop’s pointer does not move. A right or middle click and a hover are refused, with nothing sent, when the element has no size, is outside the viewport after scrolling, or has another element over its centre, since that element would get the event instead. A disabled element can be hovered and not clicked.
  • dom.scroll with an element scrolls it to the middle of the view. With dy or dx it sends one mouse wheel at the centre of the viewport, which scrolls whatever is under that point; positive dy scrolls down, and each is at most 10000. The result says what was sent, not how far the page moved.
  • dom.set_files sets the files of an <input type=file> without opening a file chooser. Upload buttons usually hide their input, so page with selector: "input[type=file]" is the common form. Each path is ~/<path> or /tmp/<path> and must be an existing file there, so upload it first with PUT /v1/files/; anything outside the home directory and /tmp is malformed and a missing file is a resolution error, and neither reaches the page. The input is read back: its file names must be the paths’ names. At least one path is required, so an input cannot be emptied this way.
  • dom.set_files checks the files when it is called, but the browser opens them later, by name, when the page reads or submits them. So the method also refuses a symbolic link anywhere on the path, and any file or directory on it that another user owns: either could be swapped for a link to another of your files, such as an SSH key, between the check and the upload.
  • The first dom.set_files call on a page also stops the page’s own file chooser from opening, for anyone, while the runtime stays connected to that page. It ended when dom.unregister closed the runtime’s connection to the page, and a reload does not end it; a retired page, a lost connection or a stopped runtime close the same connection and are expected, not measured, to end it too. While it lasts, a click on the upload control does nothing the page can see: no chooser opens and the input fires neither change nor cancel, so a page that waits for the chooser’s outcome keeps waiting. Both were measured on Chrome 154.
  • These methods return page content as read. Registered secret values are removed from titles, URLs and element names, in identities, listings, results and errors, as from everything the runtime writes; nothing else is redacted. The text and attributes a query matches, and anything personal or sensitive the page shows, reach the caller as the page presents them. Grant dom.* on an application on the assumption that the caller can read what a person signed in to it sees; see Secrets and evidence.

These methods use the application’s accessibility tree over AT-SPI. They need no model.

Method Parameters Returns
a11y.list exactly one of application, window or scope; filter (optional) {identity, data: {elements: [{handle, identity, role, name, window_title, window_active, states, description, text, text_truncated, editable, password, value, min, max, actions, blocked_by}], total, partial, unavailable, scopes, modal_scopes, dialogs, candidates, blocked_by, unresolved_blockers}}: the controls of what you named, read fresh
a11y.tree exactly one of application, window or scope {identity, data: {scopes: [{scope, kind, name, parent, ..., elements: [...]}], nodes, partial, unavailable, dialogs, candidates, modal_scopes, blocked_by, unresolved_blockers}}: the same read, grouped by the windows, dialogs and open menus it found
a11y.action element (required): a handle from a11y.list; action (one of the control’s actions); expect_state; expect_value (boolean, default true); allow_pointer (boolean, default false); handoff {identity, data: {outcome, verification, method, dispatch, element, at, verified_by, windows_opened, message, handoff}}
a11y.set_text element (required); exactly one of text or ref as a11y.action: the field’s whole text replaced and read back into verification (a password field by length only)
a11y.set_value element (required); value (required, number) as a11y.action: a slider or spin button set within its own range, read back
a11y.select element (required) as a11y.action: a list, tree, tab or combo-box item selected through its container, read back
a11y.read_text element (required): a native handle (a_...); max_chars (1 to 65536, default 16384) {identity, data}: a prefix of the element’s text, with whitespace kept and truncation reported
a11y.wait exactly one of application, window or scope with appear: {role, name} (name optional); or element with state and value (boolean, default true); timeout_s (default 5, at most 30) {identity, data: {matched, element, scope, matches, elapsed_ms, timed_out, reason, reads, events, partial, unavailable, modal_scopes, blocked_by, unresolved_blockers}}: what appeared, or the state reached
  • Name exactly one thing to read. application is an app_ reference from apps.list or windows.list; window a w_ reference from windows.list; scope an s_ reference for one window, dialog or open menu, from apps.list, windows.list or an earlier listing. There is no default application, and none is guessed from the scenario or the focused window.
  • application reads only what that application’s own process publishes. A helper process’s tree, or one whose owner cannot be confirmed, is listed under candidates with its scopes and not read; you can still read it by its scope. A dialog another program shows for the application, such as the desktop’s file chooser, is linked under dialogs and never mixed into the application’s controls.
  • window reads the window’s accessibility frame, which is known only after windows.activate (or dom.attach with raise) has mapped it. Until then the result is unavailable with the reason.
  • Every listed control has its own handle (a_...) and identity: the application, the scope it sits in, the window when that scope is mapped to one, and for_application when that window serves another application. A scope row says its kind (frame, dialog, menu, popup, window), its parent, its owner, its window with relation and evidence, and its operations.
  • A handle and a scope name one object exactly, including when two controls or two menus share a name. When the object closes, its menu closes, its application exits or restarts, or the accessibility service restarts, the reference stops working with the reason, and the session never gives it to anything else. A same-named control that appears later has its own handle. References do not carry over to a new session.
  • The mutations take element and nothing else: no name, no window title, and no application, window or scope beside it. A dom.* handle (e_...) is refused before anything is sent, and so is an a_ handle passed to a dom.* method.
  • Modality. Neither the accessibility service nor the browser stops an action behind a modal dialog, so the runtime refuses it, for a11y.* and dom.* alike. A dialog blocks an application when it is one of the application’s own modal windows, or when it is marked modal and belongs (transient_for) to one of the application’s windows, whichever program shows it: the desktop’s file chooser blocks the browser that opened it. Such a dialog blocks the window it belongs to; when the runtime does not know which window an action would land in (a page whose window_relation is unknown, a control whose window windows.activate has not mapped), any dialog blocking the application blocks the action. A modal window of the application’s own that belongs to no window, or one in a tree only suspected to be its, is listed under unresolved_blockers and blocks only where the window is not known. A dialog an application shows itself that its accessibility tree does not mark modal (Qt’s, as in VLC) blocks its pages, but its controls only when windows.activate has mapped their window, since the tree cannot say which controls are in the dialog. A modal window of no known program blocks nothing. Inside the dialog, and for reads, nothing is blocked; input.* is never blocked.
  • Controls blocked this way carry blocked_by (the dialog’s scope, or its window when no scope is known for it), and the mutations refuse them, as not_performed: blocked by a modal dialog, until it closes. modal_scopes lists the modal dialogs up now, including one with no controls. blocked_by and unresolved_blockers on the result list the application’s blockers with their evidence, as apps.list does. The refusal’s detail (blocked_by, the blockers, whether the window was known, and which check refused) is in the error’s data; the report’s step row records it too. When the modal state cannot be read with a display there (the window watcher failed), or a page’s browser listens on this machine but its process could not be established at the call, the mutation is refused as modal-state-unknown rather than sent; a page with no local browser to relate (a remote endpoint, or a listener this user cannot read) is not checked, and its step row says so (modality not checked: with the reason).
  • Everything the application publishes (names, window titles, descriptions, action names, field text) is returned with registered secrets redacted.
  • a11y.action invokes the control’s default action, or the one action names, through the application’s own accessibility support: no coordinate is involved and its window need not be in front. method is accessibility. A control with no action of its own can only be clicked at the position it reports, and that is done only with allow_pointer: true, when its window has been mapped by windows.activate, is in front, and contains the position; then method is pointer and at says where. Otherwise nothing is clicked and the call fails as not_performed: unsupported. A wxWidgets application’s default action goes through its accessible action unless the same conditions allow a real click.
  • outcome is performed, or outcome_unknown when the request was sent and the application never answered: check with a11y.list before repeating it. An error means nothing was done. verification holds the read-back (the field’s text, the value, the selection) or, with expect_state, the state read from the control acted on: held, failed, or unreadable with the reason. unchanged means the state held before the action as well as after it: the control is as you asked, but nothing shows the action did anything, so check its effect another way if the next step depends on it. The call succeeds whenever the action was performed, so do not retry on a failed check: the action happened, and a toggle would flip back.
  • A password field is read back by length only: verified_by: "length" means the length matches, not the contents.
  • a11y.read_text reads a bounded text prefix from one native element through its text interface, past the shortened text that a11y.list shows. Registered secrets are removed, and a password field’s contents are never read. Reads still work behind a modal dialog, and no input is sent.
  • a11y.set_value refuses a value outside the control’s range, and refuses when the range cannot be read.
  • a11y.wait waits for something to be there: a dialog, a menu or a control with the role you give (dialog also matches a file chooser or an alert) and a name containing name, or a control’s state reaching value. It starts listening before it looks, so something already showing is found at once; after that, it looks again each time the application announces a window or control, and every fraction of a second in between, since some applications add a menu without announcing it. It means “there now or added later”, not “new since my last action”: windows.wait with its cursor answers that. The match comes back as a11y.list lists it, with its handle or scope. Running out of time is a normal result, timed_out: true with the reason, not an error. A modal dialog never blocks a wait.
  • partial says why a read stopped short (node cap, depth cap, time budget, unreadable children, unreadable identity); a window or control missing from a partial read may still be there. unreadable identity means a role or name read did not answer: the window or control is kept as it was, and no reference is retired for it.
  • Every a11y method returns a resolution error if the loaded scenario sets atspi: false.

dom.click, dom.key and a11y.action take handoff: {kind, timeout_s} to watch for the menu (kind: menu) or dialog (kind: dialog) the action opens, such as the File menu a click opens or the file chooser a menu command opens. The runtime starts watching before it sends the action, because a dialog can appear a tenth of a second later, and goes on for timeout_s (default 5, at most 30) afterwards. The result’s data.handoff says what appeared:

  • handoff is a token (h_...) that apps.handoff takes to look again, for 60 seconds after the call.
  • status is ready when one menu or dialog appeared that is confirmed to belong to the application you acted on; ambiguous when several did, or when only ones nothing confirms appeared (they are all listed, and none is picked for you); pending when nothing appeared in time; unavailable when nothing could be watched any longer; and closed when what appeared has gone, or the application exited.
  • surfaces lists each one with its scope (for a11y.list) and its window (for windows.*), either of which can be null, its owner, for_application, relation and evidence. confirmed means the application’s own process shows it (process-incarnation), or it belongs to one of the application’s windows whichever program shows it (transient-parent: the desktop’s file chooser for the browser). For dom.click and dom.key, a page’s own alert, confirm, prompt or “Leave site?” dialog is a kind: dialog surface too, confirmed by page-event: the browser’s protocol reported it on the page. It carries page and dialog, and dom.dialog answers it. A FedCM dialog the page opens is such a surface too, with page and fedcm, and dom.fedcm answers it. candidate with evidence: handoff means only that it appeared while the runtime was watching. For a dialog, modal_on says where it is marked modal.
  • origin_application is the application the action was for. For a button inside a file chooser that is confirmed to serve a browser, that is the browser, not the chooser’s own program.

While it watches, the call holds the desktop: no other call runs until it returns, so keep timeout_s short and use apps.handoff to look again later. The status never changes the action’s own outcome, and nothing is done for you afterwards: read the surface by its scope and act on it like any other. The call is refused, with nothing sent, when the runtime cannot tie the page or control to an application on this machine, when it can watch neither the accessibility bus nor the windows (or is shutting down), or when 8 handoffs are already being watched (each ends 60 seconds after its call). A Chromium menu announces nothing, so the runtime reads the application’s tree again after the action; a handoff on a dom.* call connects the runtime to the accessibility bus to do so, which a dom.* call without one never does.

While a token lasts, a modal window that another program shows belonging to no window, and that appeared after the action, is listed under the application’s unresolved_blockers (evidence: handoff, with the token) and blocks the application’s actions where the window is not known, until it closes or the token expires.

Method Parameters Returns
human.ask question, or fields (typed: id, type of string, integer, number or boolean, required, enum, minimum, maximum, label); help; request_id; timeout_s (default 25); origin {request_id, state, closed_by, values, next, waited_s, remaining_s}
  • Asks the person supervising the session a question through the sidebar’s Messaging tab and waits for the answer. A plain question takes a free-text answer; fields ask for a choice, a number or a confirmation, such as a boolean field named done.
  • One call waits up to timeout_s. If state is still open when it returns, call again with the request_id, or with no arguments at all while one request is open, to keep waiting; the question is not asked twice. The answer comes back in values, keyed by field id, with state: closed and closed_by: reply. A request that was cancelled, that ran out of its time, or whose run ended is closed too, with closed_by saying which (cancelled, timeout, run_ended).
  • The sidebar offers Not done or Stop on every question. When the person picks one, or answers a choice you offered with “Not done” or “Stop”, closed_by is declined and next tells the agent to stop the task and wait for instructions. Use the choice ["Done", "Not done"] only for a step the person must do on the desktop first, such as a sign-in. For a go or no-go, offer the action as one string field of two to four choices with the way out last.
  • In a Kasm session a question to a person has no deadline and spends no allowance, and remaining_s is absent. Outside Kasm, the request’s time comes from the session’s human-in-the-loop allowance and remaining_s says how much is left.
  • An answer that arrives after its asker stopped waiting is delivered to the main agent as a message. A delegated agent does not ask; it reports what it needs to the agent that started it. See The sidebar.
  • origin is for recipe decisions: {kind: "recipe_decision", operation, decision, evidence}, where evidence lists attachment IDs of images you uploaded.
Method Parameters Returns Model
recipes.index none the installed catalogue’s guides, each with a guide_path, and the operations they cover No
recipes.describe operation (required, app.operation); full the operation’s contract: what it does, effects, input_schema, output schema and checks. full: true returns the whole catalogue entry No
recipes.guide path (required): a guide_path from recipes.index the application’s guide No
recipes.run operation (required); arguments; resume and decisions, only to answer a needs_decision; full a compact receipt: operation, outcome, reason, error, output, calls, duration_ms, one line for each child frame, the failed checks, receipt_path, and for needs_decision the decision essentials Optional
  • A recipe is a checked operation on an application. recipes.index and recipes.guide change nothing. Call recipes.index once before driving an application by hand, and read the guide for the application. The initialize instructions tell the client the same.
  • Only a receipt whose outcome is verified is success. unverified means the effects are unconfirmed: look before retrying. refused means nothing was done. needs_decision means the recipe stopped at a question: answer it with recipes.run again, using decision.resume_call plus decisions: {<decision.id>: answer}, and copy resume exactly, unquoted. A needs_decision whose decision.audience is human has already been asked in the sidebar; tell the person and resume with resume alone once they reply.
  • receipt_path is the absolute path of the full receipt under the run’s output directory. GET /artifacts/<file> serves the files in that directory.
  • A run holds the desktop for its whole duration, up to a few minutes, and uses the coordinate space of this call.
  • A recipe’s own steps need no model. An operation that declares screen.* steps needs a vision backend (see screen).
  • A row in the index that names unavailable says what the workspace lacks, such as an application that is not installed. Do not plan on it.

The receipt fields, the outcomes and the package format are on Recipes.

Method Parameters Returns Model
file.get path {path, bytes, sha256, content_b64} No
directory.get path {path, files, bytes, skipped, zip_bytes, sha256, zip_b64} No
  • A path is ~, ~/<path>, /tmp or /tmp/<path>. An absolute path under the home directory is read as ~/<path>. A path outside those roots, including one that leaves them through a symlink, is malformed.
  • Content comes back inline as base64, up to 5 MiB. A larger file or zip is a resolution error that names the streaming route to use instead, GET /v1/files/ or GET /v1/dirs/ (HTTP API). Files are written over HTTP only (PUT /v1/files/).
  • file.get reads regular files only; a directory, FIFO or device is refused without blocking. directory.get zips regular files and directories, and skips and counts symlinks and special files.
Method Parameters Returns Model
downloads.list none {dir, downloads: [{path, name, bytes, state, modified}], truncated, total, cursor} No
downloads.wait since (a cursor) and timeout_s (required); name (a glob on the file name) {matched, download: {path, name, bytes, sha256, sha256_skipped?, modified}, elapsed_ms, cursor, partial?, last_error?} No

These two methods let an agent wait for a file a browser downloads and then read it with file.get. The pattern is the same as windows.list and windows.wait: list, act, then wait from the cursor.

  1. downloads.list returns a cursor.
  2. Click the link with dom.click, or navigate to the file with dom.navigate.
  3. downloads.wait with since set to that cursor returns the finished file. A download that finished between the action and the wait still matches.
  4. file.get with the returned path reads it, up to 5 MiB; GET /v1/files/ streams a larger one.
  • The directory is the one the browsers save to: ~/Downloads, or the folder XDG_DOWNLOAD_DIR names in ~/.config/user-dirs.dirs. Symbolic links are followed, so a ~/Downloads that links elsewhere lists where it leads. A folder that is really outside the home directory and /tmp is refused with the reason, since file.get could not read it. A folder that does not exist yet lists as empty. On the Chrome and Firefox nix images it is ~/Downloads.
  • state is complete, or partial while a browser is still writing the file. Chrome writes Unconfirmed <number>.crdownload, or a hidden .com.google.Chrome.<letters> file, and renames it when the download finishes. Firefox writes <letters>.part beside an empty file with the final name, and renames over it. An empty file is partial while any such file is in the folder, whatever its name. downloads.list lists the folder’s regular files, newest first, and changes nothing. It returns at most 500 rows: truncated says when there were more, and total counts them; the cursor covers them all.
  • A match is a complete file that was not in the folder at the cursor, or has changed since. The wait reads the folder every 200 ms and takes a file once two reads in a row find it unchanged, so a match comes at least 200 ms after the file finished. That rule only catches a program that keeps growing a file under its final name; the browsers write under a partial name and rename. sha256 is the hash of the file as matched. It is empty, with sha256_skipped saying why, for a file over the download limit (1 GiB by default) or one the wait’s time ran out reading; GET /v1/files/ streams such a file with its digest. name narrows the match with a glob such as report*.csv: when a name is taken, Chrome saves report (1).csv and Firefox report(1).csv. since: 0 matches any complete file, including those already there.
  • Several downloads: with several matches the earliest finished is returned. The result’s cursor is the old one plus that file, so a second wait from it returns the next file.
  • A timeout is matched: false, with partial listing the files still being written, and cursor unchanged. A finished file the runtime cannot read, such as when every transfer slot is taken, ends the wait with that error instead. While it waits, no other call runs.
  • Cursors last as long as the runtime process; the newest 64 are kept. A cursor that is no longer kept is refused: take a new one from downloads.list.
  • Chrome’s “Download multiple files” prompt. Chrome asks before a page starts a second download with no navigation in between. The download does not start, and nothing is written, until someone answers. downloads.wait then times out with no partial files. The prompt is in the browser’s accessibility tree as an alert titled “ wants to: Download multiple files”, and a11y.action on its Allow button lets the download go ahead. Chrome then remembers the answer for that site. Firefox did not ask.
  • A browser set to ask where to save shows its own Save dialog instead of downloading. Answer it with the desktop methods, as for any native dialog; the file is then wherever the dialog saved it.
  • Measured on Chrome 154 and Firefox 156 on the nix images: a wait begun just after the click matched a 22-byte file in 200 to 400 ms, and a 50 MiB file, served over about 5 seconds, in 4 seconds, with its sha256 equal to what was served.

input.type, clipboard.set and dom.fill each take exactly one of:

  • ref: the name of a value in the loaded scenario’s provides: map. The runtime resolves it inside the session and never echoes it back.
  • a literal (text for input.type and clipboard.set, value for dom.fill) that your agent composes.

Giving both, or neither, is a malformed call. A ref with no scenario loaded, or a ref the scenario does not provide, is a resolution error. A scenario is loaded with KASM_RUNTIME_SCENARIO_B64; a driven session usually has none.