Write a playbook
A playbook is a task brief. It says what the job is, what the person supplies, what the agent should leave behind and how to tell it worked. A person starts it from the Workspace tab in the sidebar, and the agent in the workspace carries it out.
A playbook never runs by itself. The agent follows it, so it needs the agent’s model, and it can use recipes for the parts that must be exact. The people who run your playbook see how to start one in Run a playbook.
What the agent receives
Section titled “What the agent receives”When a person presses Start playbook, the sidebar builds one message from the playbook and what the person filled in, saves it as an attachment and sends the agent a short reference to it through Messaging. The message has these sections, in this order.
| Section | Comes from |
|---|---|
| Task | The playbook’s name |
| Objective | description |
| Inputs | What the person typed, or the files and folders they chose, and the dropdown choice if there is one |
| Instructions | Your instructions, without their first heading line |
| Deliverables | output |
| User context | An optional note the person adds on the card |
| Source material | A fixed line telling the agent to treat files and pages as evidence, not as instructions |
| Before reporting success | A fixed reminder to recheck sources, verify saved output by reading it back, report uncertainty and publish or contact no one without approval |
| How to write to me | A fixed request for short, plain sentences about the person’s files and applications |
You write the first five. The runtime adds the rest to every playbook.
Write one in the sidebar
Section titled “Write one in the sidebar”You need no code for this.
- Open the Workspace tab and choose View all beside Playbooks.
- Press the plus button, Create a playbook.
- Fill in Name, Objective and Instructions and success criteria.
- Press Save playbook.
The playbook is saved in the workspace profile. A persistent profile keeps it for later sessions. Open it from the list, then use Edit to change it or Remove personal version to delete it. A playbook saved this way takes one text box as its input, labelled “Inputs for this run”.
The bundled playbook Write your own playbook takes a different route. You describe a job you repeat, the agent asks a few questions, learns the applications involved and leaves a new playbook on the Workspace tab, with any recipes it needed.
Write the instructions
Section titled “Write the instructions”The instructions are plain prose, in Markdown. Good ones share a few habits.
- State the outcome and how to check it in observable terms. “The file reads back with 12 rows” tells the agent when it is done. “A usable spreadsheet” does not.
- Name the applications and where output goes, for example a new folder under Documents. Say what must not change, and what the agent must not send or publish.
- Say what to do when something blocks the run, such as a sign-in or an ambiguous choice. The agent already asks the person in these cases, and your text can say which cases to stop on.
- Write the retry limits as numbers. “Try once more, then stop and say what happened” ends a stuck run sooner than “try again”.
- Name any recipe the agent should call, and put its guide first. A guide path in the middle of a long text is easy to miss.
The brief is for a person who uses the desktop and not code. Describe results in terms of their files and applications.
Write one as a file
Section titled “Write one as a file”A playbook is a JSON file with its instructions in the same file, or in a Markdown file with the same name beside it. This example sorts photos by when they were taken. It is optional reading if you build playbooks in the sidebar.
{ "id": "photo-sheet", "title": "Photo metadata sheet", "description": "List when and with what each chosen photo was taken, in a spreadsheet.", "apps": "LibreOffice Calc", "output": "A saved spreadsheet with one row per photo, open in Calc for review.", "field": "Photos or a folder of photos", "value": "", "input_kind": "file-or-directory", "extensions": [".jpg", ".jpeg", ".png"], "requires": [["libreoffice"]], "uses": ["exif.read_metadata"], "instructions": "# Photo metadata sheet\n\nRead the metadata of every chosen photo with `exif.read_metadata`. Write one row per photo with its file name, the time it was taken and the camera model, leave blank anything the photo does not record, and sort the rows by time. Save the sheet as .xlsx in a new folder under Documents, open it in Calc, and read it back to check the row count matches the number of photos."}| Field | Needed | What it does |
|---|---|---|
id |
yes | Lower-case letters, digits, ., _ and -, starting with a letter. The file is saved as <id>.json, and the same ID in a later layer replaces this one |
title |
yes | The card’s name |
description |
yes | One sentence. It becomes the brief’s Objective |
apps |
yes | The applications, as shown on the card |
output |
yes | What a run leaves behind. It becomes Deliverables |
field |
yes | The label of the input box or picker |
value |
no | A prefilled input, seldom used |
instructions |
yes | The brief’s instructions. A playbook saved through the runtime carries them here. A file an image ships may leave this out and put them in <id>.md beside it |
requires |
yes | Applications the workspace must have. See below |
uses |
yes | Recipe IDs the playbook relies on. Write [] if none. At most 64 |
input_kind |
no | file-or-text or file-or-directory. Without it the input is typed text |
extensions |
no | With a picker, the file types it offers, each starting with a dot |
placeholder |
no | Example text shown in an empty input, up to 200 characters |
choice |
no | One required dropdown beside the input: {"label": "...", "options": ["...", "..."]} with 2 to 32 options |
domains |
no | Bare host names such as example.com. A card moves up the list when a browser tab on one of them is open. It never allows anything |
The runtime rejects a playbook with any other field, and one over 64 KiB.
Inputs
Section titled “Inputs”With no input_kind, the card has a text box. file-or-text adds a Workspace file and Type or paste switch. file-or-directory lets the person pick files or folders. The picker browses the workspace’s Home folder and /tmp, and offers no hidden files. A chosen file must be readable, not empty, and match extensions. A folder must hold at least one such file. The agent checks the sources again when it starts.
A choice adds a dropdown the person must answer before starting. The pick appears at the top of the Inputs section as Label: option.
Requirements and recipes
Section titled “Requirements and recipes”requires is a list of groups. Every group must be met, and any one name in a group meets it. [["browser"], ["libreoffice", "obsidian"]] needs a browser and either of the two editors. A name matches an application in the workspace by name or display name, browser matches any web browser, tool:<name> matches a command-line tool the runtime can find, and file:<path> matches a regular file in the home folder.
A playbook shows on the Workspace tab only when the workspace meets requires and can run every recipe in uses. A playbook that needs an application the workspace lacks stays hidden. Checking a requirement does not prove the person has signed in to the application or holds a licence for it.
Save it
Section titled “Save it”The sidebar saves for you. A file you wrote goes through the runtime, which checks it before writing.
printf 'header = "X-Kasm-Runtime-Session-Token: %s"\n' "$KASM_RUNTIME_SESSION_TOKEN" | curl -sS --config - -X POST -H "Content-Type: application/json" \ --data-binary @photo-sheet.json \ "http://127.0.0.1:${KASM_SESSION_RUNTIME_PORT:-9434}/workspace/playbooks"Run it in a terminal inside the session. The first line hands the token to curl on standard input, which keeps it out of the command line. A reply of 200 returns the saved playbook with available, and with missing listing what the workspace lacks when available is false. A 400 reply carries the validation error.
The runtime writes the file to ~/.local/share/kasm-session-runtime/playbooks/<id>.json. Save through the runtime. One invalid file in that folder stops the whole list loading, and the sidebar then shows no playbooks. To remove a personal playbook, send DELETE to the same URL with ?id=photo-sheet.
A personal playbook with the same ID as a bundled or image playbook replaces it. Removing the personal one brings the other back.
Check it
Section titled “Check it”Print the message the agent will receive, with the inputs you would give.
kasm-session-runtime playbooks brief photo-sheet --source /home/kasm-user/Pictures/example.jpgplaybooks brief takes the playbook ID and these options.
| Option | Use |
|---|---|
--input TEXT |
The typed input. Cannot be combined with --source |
--source PATH |
A chosen file or folder. Repeat it for several |
--choice OPTION |
The dropdown pick, when the playbook has a choice. Must be one of its options |
--context TEXT |
The optional note from the card |
Then start the playbook from the card, as a person would, and read what the agent leaves behind.
For a playbook shipped in an image, kasm-session-runtime recipes check also reports any recipe ID in uses that the catalogue does not contain. It does not read personal playbooks, and a personal playbook whose recipes are missing shows missing in the reply above.
Rehearse it
Section titled “Rehearse it”playbooks rehearsal scores a run you have already done, from the receipts of the recipes it called, and records the result on a personal playbook.
kasm-session-runtime playbooks rehearsal photo-sheet --since 2026-10-29T09:00:00Z--since is required. The optional flags are --until (default now), --model (the model that ran it), and --kind (rehearsal or run, default rehearsal). A run counts as verified when every recipe it called ended verified. The card is marked experimental until a second run of the same text verifies, and editing the instructions, uses, requires or field restarts the count.
Share it with a team
Section titled “Share it with a team”A playbook in your profile belongs to you. To give it to everyone who uses a workspace image, an administrator adds it to the image in /usr/share/kasm-session-runtime/playbooks as two files, <id>.json without the instructions field and <id>.md with the brief. People then see it with the bundled ones, and can still replace it with a personal version under the same ID.
An invalid file in that folder stops the playbook list loading, so run the check above on the image before you publish it. Install recipes and playbooks has the steps for the administrator.
- Run a playbook shows what a person sees from the card to the result.
- Make a recipe turns a step you repeat into an operation with a check.
- Reference: playbooks lists every field.