Skip to content

Scripts ​

Last updated Nov 28, 2026 View as Markdown

A step or check can run a script instead of a member. A check can run the project's tests and send the step back when they fail, as a reviewing member does. A step can do what needs no agent, such as opening a pull request.

Run a script as a step or a check ​

A command step or check has its script in run, in place of member. A command check approves when its script exits 0. Here the change quest of writing steps gets a tests check on implement and a pull-request step at the end:

toml
# a check of the implement step
[[steps.checks]]
name = "tests"
run = """
cargo clippy --all-targets -- -D warnings
cargo test
"""

# after the release-note step
[[steps]]
name = "pull-request"
run = """
git push --quiet -u origin HEAD
gh pr create --fill
"""

Stderr shows the script's first command after $, then every line it writes, after the step or check's name. Here the tests fail once. Each ... line marks lines left out, such as most of cargo's output and the lines of the code and security checks:

text
[implement] Session:  82ceec7008f6 (implementer)
[implement] Skills not loaded:  pandra
[implement / tests] $ cargo clippy --all-targets -- -D warnings
...
[implement / tests] test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
[implement / tests] error: test failed, to rerun pass `--bin app`
[implement / tests] changes requested (exit status 101)
...
[implement] sent back (1 of 3)
[implement] Session:  82ceec7008f6 (implementer)
[implement] Skills not loaded:  pandra
[implement / tests] $ cargo clippy --all-targets -- -D warnings
...
[implement / tests] test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
[implement / tests] approved
...
[release-note] Session:  0975900bdf3a (release-notes)
[release-note] Skills not loaded:  pandra
[pull-request] $ git push --quiet -u origin HEAD
[pull-request] https://github.com/acme/app/pull/42
  • Pandra runs the script with bash, which stops at the first command that fails, also inside a pipeline. It runs in the quest's workspace, on the files the members wrote, with your permissions and the environment variables quest run started with, outside every member's sandbox, and with no standard input. A run that contains ${{ is a mistake in the quest file: a script reads the request and the outputs from the input file instead.
  • A command check that fails sends the step back with one P1 finding: the exit status, the script, and what it wrote.
  • A command step's output is what its script wrote on stdout, so gh pr create gives the quest the pull request's URL. Send a line you want to keep out of the output to stderr with >&2, or quiet it, as git push --quiet does.
  • A command step that fails ends the quest with the script's status. A command step has no checks.
  • A script has no time limit; Ctrl-C stops it.

Read the request and the outputs in a script ​

A script reads the quest's request and the steps' outputs from a JSON file whose path is in PANDRA_QUEST_INPUT_FILE. Here pull-request gives the pull request the release note as its description:

toml
[[steps]]
name = "pull-request"
run = """
git push --quiet -u origin HEAD
jq -r '.steps["release-note"].output' "$PANDRA_QUEST_INPUT_FILE" | gh pr create --fill --body-file -
"""

The file holds the values that prompts name, under the same names:

json
{
  "quest": {
    "prompt": "Add --json to app list."
  },
  "steps": {
    "previous": {
      "output": "- `app list --json` prints the items as JSON."
    },
    "implement": {
      "output": "Added --json to app list, with a test."
    },
    "release-note": {
      "output": "- `app list --json` prints the items as JSON."
    }
  }
}

Security

An output is what an agent wrote, and Pandra does not filter it. Read it as data, as jq does here, and never run it with eval or bash -c.

A step that has not run, or that a next skipped, has no entry. A step with output-schema has its JSON value as output, so jq -r '.steps.triage.output.size' reads one field. Pandra also sets PANDRA_QUEST_ID, PANDRA_QUEST_STEP, and PANDRA_QUEST_ATTEMPT for every script, such as to keep files in a directory of each quest with "$HOME/.cache/bench/$PANDRA_QUEST_ID".

Keep a background process running ​

A process that a script starts in the background is stopped 2 seconds after the script ends, unless the process sends its output elsewhere, as nohup ./server > server.log 2>&1 & does.

Released under the Apache License 2.0