---
url: /quests/running.md
---
# Running quests

`pandra quest run NAME` carries out a quest of the repository's guild, with the work it is for as its request:

```sh
pandra quest run change --prompt "Add --json to app list."
```

It shows each turn on stderr (the samples on this page shorten the digests):

```text
change: 2 steps, 2 checks (pandra-guild.toml, no profile)
  implementer        claude-code  agents/implementer
  reviewer           claude-code  ghcr.io/acme/reviewer:1.2.0@sha256:f4fa007adf9e...
  security-reviewer  claude-code  agents/security-reviewer
  release-notes      claude-code  github.com/acme/agents//release-notes@2361c0c3c457...

[implement] Session:  66bfe7b06510 (implementer)
[implement] Skills not loaded:  pandra
[implement / code] Session:  03eca668b2ba (reviewer)
[implement / security] Session:  03361a535fac (security-reviewer)
[implement / code] Skills not loaded:  pandra
[implement / code] approved
  P3 Name the new helper after what it formats.
[implement / security] Skills not loaded:  pandra
[implement / security] changes requested
  P1 src/list.rs:42 prints the table even with --json
[implement] sent back (1 of 3)
[implement] Session:  66bfe7b06510 (implementer)
[implement] Skills not loaded:  pandra
[implement / security] Session:  03361a535fac (security-reviewer)
[implement / security] Skills not loaded:  pandra
[implement / security] approved
[release-note] Session:  ce65ba0ab9cb (release-notes)
[release-note] Skills not loaded:  pandra
```

Stdout gets only the quest's output, the release note here, so `> note.md` saves it. Stderr shows:

* the quest's name and guild file, then its members with the harness each runs on;
* the `Session:` field of each member's run, which names the member, after its step or check in brackets;
* the skills fields that end each run ([see which skills the agent loaded](/run/workspaces.md#see-which-skills-the-agent-loaded));
* each verdict, with a check's findings indented under it and their priorities `P0` to `P3`;
* each send-back.

On a terminal, each run also shows its progress lines after its brackets, with its fields indented under them.

## Choose the request and the workspace

To read the request from a file, pass `--prompt -` and give the file on standard input:

```sh
pandra quest run change --prompt - < request.md
```

Every step and check works in one directory: the current one, or the one that `--workspace DIR`, `--workspace new`, or `--worktree` gives, as for [`pandra run`](/run/workspaces.md). `--rm` removes the quest's sessions, and a workspace it created, when it ends, except while the quest [waits for you](/quests/resuming.md#ask-the-user).

A quest takes no `--harness` or `--model`: each member runs with the target, model, and permission mode your configuration sets for its agent ([a member runs as its agent](/guilds/running.md#a-member-runs-as-its-agent)), or with a [profile](#run-some-members-on-another-harness).

## Give the quest its own workspace

With `--workspace new` or `--worktree`, the quest creates one workspace, and every step, check, and script works in it:

```sh
pandra quest run change --worktree --prompt "Add --json to app list."
```

`--workspace new` creates an empty directory. `--worktree` creates a Git worktree at your current `HEAD`, on the new branch `pandra/<short quest ID>`, as [`pandra run --worktree`](/run/workspaces.md) does. When the quest completes, the `Workspace:` field, last on stderr, names the workspace:

```text
Workspace:  /home/me/.local/share/pandra/workspaces/2f5234a1d441
```

The workspace stays until the quest and its sessions are gone, such as after [`pandra quest remove`](#remove-a-quest). A worktree that holds work, such as uncommitted changes or commits on no other branch, stays until you remove it with `pandra quest remove --force`.

## Run some members on another harness

To run some members on another harness, model, or effort, apply a [profile](/guilds/running.md#run-members-with-a-profile) with `--profile NAME` or `PANDRA_GUILD_PROFILE`. It applies to every turn of those members, send-backs included:

```sh
pandra quest run change --profile cross-review --prompt "Add --json to app list."
```

The first lines name the profile and the harness each member runs on:

```text
change: 2 steps, 2 checks (pandra-guild.toml, profile cross-review)
  implementer        claude-code  agents/implementer
  reviewer           codex        ghcr.io/acme/reviewer:1.2.0@sha256:f4fa007adf9e...
  security-reviewer  claude-code  agents/security-reviewer
  release-notes      claude-code  github.com/acme/agents//release-notes@2361c0c3c457...
```

## What a quest checks before it starts

A quest checks every member and script it uses before anything starts, and lists every problem at once: each blocker that [`pandra guild list`](/guilds/pinning.md#listing-the-members) shows, a harness that is not installed, a missing or invalid schema file, and `bash` missing for a script. A quest does not run members in a microVM yet, so a member whose backend is `vm` is a problem too (`vm_quest_unsupported`), whose step sets that agent's backend to `host` ([Running in a microVM](/run/vm.md)). With several harnesses installed, a member whose harness neither a profile nor your configuration selects is a problem:

```text
change: 2 steps, 2 checks (pandra-guild.toml, no profile)
error: quest change cannot start: 4 problems
  implementer: several harnesses are installed (claude-code, codex) and no target chooses one for /home/me/app/agents/implementer, and a quest takes no --harness: give the agent a target, which `pandra config target set TARGET --harness HARNESS` creates, or make a target the default of every agent
  ...
  To give implementer a target you choose:
    pandra config target use TARGET --agent /home/me/app/agents/implementer
  ...
```

Then Pandra shows the remote members that need approval and asks one question, as [`pandra guild trust`](/guilds/pinning.md#fetching-and-approving) does; `--yes` answers it. Once the quest starts, it asks nothing.

## Run a quest in the background

`--detach` checks the members and asks for approvals as without it, then prints the quest's full ID and returns, while the quest goes on. `pandra quest wait` waits for it to end and prints its output:

```sh
quest=$(pandra quest run change --detach --prompt "Add --json to app list.")
pandra quest wait --timeout 100m "$quest" > note.md
```

* `pandra quest logs ID` prints each turn, verdict, send-back, and error of the quest, and its output; `-f` follows it while it runs, and `--full` adds every line its scripts wrote.
* `pandra quest wait ID` also returns when the quest [waits for you](/quests/resuming.md#ask-the-user). When its `--timeout` passes first, it returns and the quest goes on.
* `pandra quest stop ID` interrupts the quest, as Ctrl-C interrupts `quest run`.
* `pandra quest inspect ID` shows the quest's name, guild file, profile, start time, workspace, status, and step, without waiting. Given the name of a quest that the nearest `pandra-guild.toml` declares, such as `change`, it says that the name is no quest ID, and `pandra guild list --json` shows the quest's definition.

These commands take the quest's ID or a unique prefix of at least four characters, such as the short ID that `pandra quest list` shows, and work from any directory.

## List the quests

`pandra quest list` lists the repository's running quests and those that wait for you, newest first; `-a` also lists those that ended:

```text
$ pandra quest list -a
QUEST         NAME    STEP          STATUS     STARTED        GUILD
32f83ffd28ea  change  implement     failed     5 seconds ago  .
c7a4dd02c8e7  change  release-note  completed  5 minutes ago  .
```

`STATUS` is `running`, `input_required` for a quest that waits for you, `completed`, `failed`, or `interrupted`. `-q` prints only the IDs, and `--all-guilds` lists the quests of every guild on the machine.

## Remove a quest

`pandra quest remove` removes a quest with its sessions, its record and output, and the workspace it created:

```text
$ pandra quest remove 32f83ffd28ea
Removed quest 32f83ffd28ea49dda9ca46204274d692 (change)
```

It refuses a running quest and a quest whose worktree holds work; `--force` stops the quest and removes the worktree. A directory the quest did not create, such as the current one, is never removed.

## For scripts and AI agents

`pandra quest run NAME --json` prints one event stream, as `pandra run --json` does: the events of each run carry `step`, the step or check they belong to, and the quest adds its own, such as `quest` with its ID, `step` at the start of each turn, `next`, and a final `result` with `quest_id`. With `--detach`, it prints one document with the quest's ID. `quest wait`, `quest inspect`, `quest list`, and `quest logs` take `--json` too, and `pandra guild list --json` lists each quest's steps and checks. [The event stream](/automate/output.md#the-event-stream) describes the events they share with a run.

The documents of `quest wait --json` and `quest inspect --json` hold `history`, which is `null` unless you give `--history`; without `--json`, `--history` is an error. With it, `history` lists every turn of each step and check, of every attempt, in the order the turns started, so it holds the answers that no single output shows, such as a step's answer before it was sent back and the findings of a check that approved. Each entry has:

* `attempt`, `step`, `check_of`, and `turn`: the attempt, the step or check, the step a check checks (`null` for a step), and the turn, which counts from 1 in each attempt and goes up each time the step runs again, after a send-back or after you answer [its question](/quests/resuming.md#ask-the-user), and each time the check runs again. It is not what a harness's `--max-turns` counts.
* `started_at` and `ended_at`: when the turn started and ended, in UTC.
* `answer`: the turn's `text` and `data`, as the turn's `answer` event gives them.
* `result`: the fields of the turn's `step_result` event other than `step`, such as `outcome` and `exit_code`.

A field is `null` where the turn has none, such as `ended_at` and `result` of a turn that still runs, so `quest inspect` of a running quest, or a `quest wait` whose `--timeout` passed, gives the turns so far. [Checks](/quests/checks.md) shows a filter over `history`.

`pandra quest run`, `pandra quest resume`, and `pandra quest wait` exit with the quest's exit code:

* 0 when the quest completed or waits for you;
* the failing run's exit code when a step or check failed;
* the script's status when a command step failed;
* 130 when you interrupted the quest;
* 1 for the quest's own errors, such as checks that still ask for changes after the last send-back.

`pandra quest wait --timeout` exits 124 when the time passes first. `pandra quest inspect` exits 0 for a quest it shows, whatever the quest's outcome.
