Skip to content
Draft, pre-release documentation

A recipe is a checked operation on an application. An agent passes it a few arguments; the recipe drives the application, the runtime checks the result, and the runtime returns a receipt. Recipes says why an agent prefers one and how to find one. This page lists what a call takes, what a receipt holds and how a package is laid out.

A recipe’s own steps need no model. An instructional recipe is Markdown that an agent follows, so it needs one. An operation that declares screen.* steps needs a vision backend (see MCP methods).

Interface Calls
MCP and POST /v1/call/<method> recipes.index, recipes.describe, recipes.guide, recipes.run
POST /v1/recipes {"command": "index" | "list" | "describe" | "guide" | "run", ...} (see HTTP API)
Command line, inside the session kasm-session-runtime recipes index, list, describe ID, guide PATH, run ID
Method Parameters Returns
recipes.index none the guides to read first, each with a guide_path, and the operations they cover
recipes.describe operation (required); full the operation’s contract: what it does, its effects, its input_schema, its output schema and the checks it verifies. full: true returns the complete catalogue entry
recipes.guide path (required): a guide_path from the index, such as apps/<application> the application’s guide
recipes.run operation (required); arguments; resume and decisions, to answer a question; full a compact receipt, with receipt_path. full: true returns the whole receipt

The index marks each row with level (1 to 3), layer (bundled, image or user) and experimental (an operation with no recorded headed run). A row that names unavailable says what this workspace lacks, such as an application that is not installed. A run holds the desktop until it ends, up to a few minutes, and uses the coordinate space of the call that started it.

On the command line, recipes run reads its arguments as one JSON object on standard input, and prints the receipt on standard output. The session token comes from the environment, never from an argument. The optional --trace flag records a trace for authoring, and --resume FILE takes a file that holds {"resume": "<token>", "decisions": {...}}.

recipes run exits with a code that follows the outcome.

Code Meaning
0 verified
1 unverified
2 bad usage, a transport failure, or no outcome
3 refused
4 needs_decision

The runtime computes the outcome. A recipe cannot set it. Only verified is success.

Outcome Meaning What the caller does
verified the operation finished, its output matches its schema and every check after it held relies on it
refused nothing changed, and the operation did not reach verified reads reason, corrects the cause and retries
unverified something may have changed and the result is not confirmed looks at the application’s state, and does not repeat the call blindly
needs_decision the operation stopped at a question it will not guess answers it and calls again (see below)

A receipt is a tree with one frame for each recipe that ran. The root frame also carries the fields that describe the whole call. receipt_path in a compact result is the absolute path of the full receipt file under the run’s output directory.

Field Meaning
invocation the ID of this call (root frame)
catalogue_digest a digest of the installed catalogue (root frame)
path, depth the frame’s place in the tree
operation the operation ID
revision, digest the catalogue revision and the operation’s digest
layer where the operation was installed: bundled, image or user
level 2 for an executable operation, 3 for a composite
outcome one of the four outcomes
reason why a frame did not reach verified (below)
error the error text, when there is one
mutated true once the frame or a child has dispatched a call that changes the desktop
tainted, tainted_by a child ended unverified or needs_decision, so the parent may change nothing more
already_satisfied the state already held, so the operation did nothing
budget, time the limits and the clock: timeout_s, max_calls, entry, deadline
calls, last_call how many host calls the frame made, and the last one
host_calls one row for each call: seq, method, outcome, duration_ms, mutating, and for a helper its name, package, digest, input signatures and isolation
pre_checks, post_checks each check with its kind, held, detail and time
output the operation’s result
frames the child frames
decision the open question, when the outcome is needs_decision
decisions_used, decisions_unused, decisions_answered_by which answers were applied, which were not, and whether the agent or the person gave each (root frame)
automation_started installed applications’ programs the frame started, each marked declared or not
duration_ms the frame’s run time

A host call’s outcome is performed, not_performed, failed or unknown. A helper call also records isolation_tier (full, partial or none) and isolation_gaps.

Group Values
Input and setup invalid_input, worker_unavailable, package_invalid, application_unbound, tool_unresolved
Before the body precondition_unmet, precondition_unknown
Time and budget insufficient_time, deadline, budget_exhausted
Declarations method_undeclared, target_guard, uses_undeclared, uses_exceeded, depth_exceeded, helper_undeclared
The body body_error, output_invalid, tainted
After the body postcondition_unmet, postcondition_unknown, child_unverified, child_needs_decision
Decisions decision_after_mutation, duplicate_decision, answer_invalid, resume_mismatch, unasked_answer, decision_invalid, unanswered, stale
Helpers helper_input_invalid, helper_failed, helper_output_invalid, helper_timeout, helper_output_truncated, isolation_unavailable

recipes.run over MCP or /v1/call/ returns a shorter form: operation, outcome, reason, error, output, calls, duration_ms, one line for each child frame, the checks that failed, receipt_path, and for needs_decision the essentials of decision.

A needs_decision receipt carries a decision:

Field Meaning
id the full decision ID
question what the recipe will not guess
answer_schema the shape an answer must have
audience agent or human
evidence what the recipe observed, with references to captures
resume {operation, arguments, token, expires_at}: the call to repeat, and a signed token
resume_call in the compact receipt, the call to make, with the fields filled in
stale {reason, evidence}, when the token no longer applies
inbox_request, request for audience: human, the question the runtime opened in the person’s Messaging tab
message a note about what to do next

To answer, call recipes.run again with the same operation and arguments, plus resume set to the token (copied exactly) and decisions set to {"<decision.id>": <answer>}. A second question carries the first answer in its token, so send all answers with the newest token. A stale receipt applied nothing; answer the fresh question under its new token. stale.reason is one of expired, window_closed, window_replaced, window_resized, scope_changed, evidence_changed or token_invalid.

When audience is human, the runtime has already asked the person. The agent does not answer. It tells the person, then calls again with resume alone, once they have replied. An answer sent for a human decision is ignored.

A package describes one application. It lives in a folder under apps/:

apps/<application>/
README.md the application's guide (level 0)
operations.py the operations, helpers and instructional entries, as typed Python
recipe_types.py the types they name
recipe.json the manifest, built from the source

The catalogue root also holds catalogue.json, which carries a revision. kasm-session-runtime recipes build [DIR] builds recipe.json from operations.py; recipes build --from-json DIR converts a hand-written manifest. recipes check [DIR] validates a package and reports a stale manifest, unknown methods and overrides. recipes draft --from-trace RECEIPT drafts a package from a trace that recipes run --trace recorded.

A recipe body runs in a separate worker process, installed in the image at build time. A guide is Markdown, and its path is apps/<application>, optionally with a site below it.

Level Form
0 a guide: routes, traps and how to verify
1 an instructional recipe: Markdown steps that a model follows
2 an operation: typed inputs and outputs, checks and budgets
3 a composite: an operation that calls other operations with run() and asks questions with decide()

recipe.json has contract (recipes/1) and these lists:

Field Contents
operations up to 256 operations
instructional up to 256 instructional recipes
helpers up to 32 helpers, by name
automation up to 8 installed applications the package’s recipes start, each with application, mode (headless or interactive) and reason. Metadata for the guide and the receipt

An operation has:

Field Meaning
id the stable ID, such as exif.read_metadata
description what it does
input_schema, output_schema closed JSON schemas
pre, post labels for the state before and after, for people
pre_check, post_check 1 to 16 checks each. A check has one kind, url, dom, state, window, no_window, process, no_process, file or screen, and an optional timeout_s of at most 60. {argument} in a value is replaced by the call’s argument
function the Python function that runs it
methods the runtime methods it may call, up to 64
uses for a composite, the operations it may call and how often (max, 1 to 16)
effects what it changes, in a sentence
application the application it binds to
timeout_s, max_calls at most 60 seconds and 64 calls
skip_if_satisfied when true and its post check already holds, the operation returns verified with already_satisfied and does nothing
provenance app_version, runtime_version, tested_on, headed_runs and optionally fixture. An operation with headed_runs of 0 shows as experimental

An instructional entry has id, description, pre, post, steps (a Markdown file in the package), optional application, decisions (each with an id and a question), and provenance.

A helper is a small native program that reads something the recipe body cannot, such as a file’s metadata. It has command, inputs, output_schema, timeout_s (at most 60), max_output_bytes, optional exit_codes, isolation (fs, net, seccomp, process), writes and paths. A helper runs in a sandbox: seccomp always, and Landlock filesystem rules where the kernel supports them. The receipt records the tier it got.

The runtime reads recipes and playbooks from three places. A later layer replaces an earlier one’s operation with the same ID, and its guide with the same path.

Layer Where Who puts it there
Bundled inside the runtime the release
Image /usr/share/kasm-session-runtime/recipes and /usr/share/kasm-session-runtime/playbooks the image’s builder, read-only to the person
User ~/.local/share/kasm-session-runtime/recipes and .../playbooks the person, or an agent saving for them. KASM_RUNTIME_RECIPES_DIR selects the recipes folder

A package is trusted by the layer it is installed in. Nothing asks for approval. The image layer takes the same layout as the user layer. Removing a personal file restores the image’s or the bundled one. recipes check names each bundled operation that a user package replaces. A persistent Kasm profile keeps the user layer between sessions.

The bundled catalogue holds packages for a small set of desktop applications and tools. recipes index lists what a session has.

Setting Meaning
KASM_RUNTIME_RECIPES_DIR the user recipe layer’s folder
KASM_RUNTIME_RECIPE_WORKER an absolute path to the recipe worker, when it is not in /usr/local/libexec/kasm-session-runtime

kasm-session-runtime recipe-worker install puts the worker in an image at build time, and recipe-worker --check confirms it. Exit code 3 means the image lacks the system loader the worker needs.