---
url: /reference/quest-toml.md
---
# quest.toml

The guild file names each quest's file with `path`. [Agent workflows](/quests.md) shows how to write one.

A quest file: one quest of a guild, an ordered list of steps, each a turn of one member or a script.

## Top-level keys

| Key | Type | Description |
| --- | --- | --- |
| `description` | string | The text `guild list` shows. |
| `steps` | array of table | The steps in order, at least one. Required. |

## `[[steps]]`

The steps in order, at least one.

| Key | Type | Description |
| --- | --- | --- |
| `ask-user` | array of table | When the quest stops to ask the user, chosen by the output of each turn of the step before its checks, on a member's step with `output-schema` only: the first case that matches stops it. |
| `checks` | array of table | The checks of the step's output, which send the step back until they approve. |
| `max-retries` | integer | How many times the step can be sent back, with `checks` only; 3 by default. |
| `member` | string | The member that carries out the step, a name in the guild file's `[members]`; a step has `member` or `run`. |
| `name` | string | The step's name, with the grammar of a member name, unique among the quest's steps and checks, and not `previous`, `end`, or `fail`. Required. |
| `next` | array of table | Where the quest goes after the step, chosen by its output, with `output-schema` or `run` only: the first case that matches decides. |
| `output-schema` | string | A JSON Schema the step's output must match: a relative path inside the quest's directory, without `..` segments. |
| `prompt` | string | What is sent to the member, in which `${{ quest.prompt }}`, `${{ steps.previous.output }}`, `${{ steps.<name>.output }}`, and `${{ steps.<name>.output.<field> }}` are replaced, and nothing else is sent; without it, the previous output is sent, which in the first step is the request. |
| `run` | string | A script that Pandra runs with bash instead of a member, one command per line; its output is what it writes on stdout. It is not a template, so it never contains `${{`. |

One of `member` or `run` is required.

## `[[steps.ask-user]]`

When the quest stops to ask the user, chosen by the output of each turn of the step before its checks, on a member's step with `output-schema` only: the first case that matches stops it.

| Key | Type | Description |
| --- | --- | --- |
| `when` | table | What to compare: `output`, the step's output. Required. |

## `[steps.ask-user.when]`

What to compare: `output`, the step's output.

| Key | Type | Description |
| --- | --- | --- |
| `output` | object | The fields of the output to compare, each a string, integer, float, boolean, or table of further fields. Required. |

## `[[steps.checks]]`

The checks of the step's output, which send the step back until they approve.

| Key | Type | Description |
| --- | --- | --- |
| `member` | string | The member that carries out the check, a name in the guild file's `[members]`; a check has `member` or `run`. |
| `name` | string | The check's name, with the grammar of a member name, unique among the quest's steps and checks, and not `previous`, `end`, or `fail`. Required. |
| `needs` | array of string | The checks of the same step that must approve before this one starts: names of checks written before it, each once. |
| `output-schema` | string | A JSON Schema the check's output must match in place of the built-in one, with `member` only: a relative path inside the quest's directory, without `..` segments. It keeps a boolean `approved` and `findings` whose items have an integer `priority` from 0 to 3 and a string `message`. |
| `prompt` | string | What is sent to the member, a template as a step's prompt is; without it, the step's output is sent. |
| `rerun` | `"changes-requested"` or `"always"` | When the check runs again after the step is sent back: `changes-requested`, the default, when it asked for changes, or `always`, after every send-back. |
| `run` | string | A script that Pandra runs with bash instead of a member, which approves when it exits 0. It is not a template, so it never contains `${{`. |

One of `member` or `run` is required.

## `[[steps.next]]`

Where the quest goes after the step, chosen by its output, with `output-schema` or `run` only: the first case that matches decides.

| Key | Type | Description |
| --- | --- | --- |
| `to` | string | Where the quest goes when every field matches: `end`, `fail`, or a later step's name. Required. |
| `when` | table | What to compare: `output`, the step's output. Required. |

## `[steps.next.when]`

What to compare: `output`, the step's output.

| Key | Type | Description |
| --- | --- | --- |
| `output` | string or table | On a step with `output-schema`, the fields of the output to compare, each a string, integer, float, boolean, or table of further fields; on a command step without it, the string the whole output must equal. Required. |
