Skip to content

Start a run

A run starts from a report, which is a title and some details. A person can start one in the app. Other systems can start one through the pipeline’s webhook or a labeled issue, and a pipeline can start one on a schedule. Any pipeline with a working version starts from the app or its webhook. Only the forge and cron triggers in its file make it start by itself, so check The built-in pipelines or the file for those.

  1. Choose Pipelines in the places bar, then the pipeline’s row.
  2. Write the run’s title on the first line of the box labeled What the run works on. To add details, press Shift+Enter for a new line and write them below.
  3. If the repo chip is wrong, choose it, or type # in the box, and pick the repo. The chip starts on the repo of this pipeline’s newest run. When the pipeline has no run, it starts on the first of the team’s repos by name that is not the pipelines repo.
  4. Choose Start the run, or press Enter. The run’s page opens.

A run works in one repo of the team. Every team repo is offered, the pipelines repo included, because a run there is how improve changes a pipeline.

The box stays disabled and says <name> has no approved version, so it can't start a run until a team admin or its shepherd approves one on its page. when no version of the pipeline is approved. See Change a pipeline. It says The team has no repos yet, and a run works in one. when the team has no repo.

At phone width, the Pipelines place sits under More in the bottom bar.

  1. Choose New, then Run.
  2. Choose the Pipeline chip and pick a pipeline. The list offers only pipelines with a working version.
  3. Write the title and details as above, check the Repo chip, and choose Start the run. Here the chip starts on the repo of the chosen pipeline’s newest run, then the repo of your own newest run, then the first repo by name that is not the pipelines repo.

A project’s page has the same box, limited to the project’s repos and to pipelines with a working version.

A pipeline with a webhook trigger takes a signed request. You need the server’s AGENTS_HOOK_SECRET. Without that setting, the server refuses every delivery with a bad signature.

  1. Open the pipeline’s page and copy its id from the address, which ends in #/p/<pipeline id>.

  2. Derive the pipeline’s own secret. It is the HMAC-SHA256 of the pipeline id, keyed with AGENTS_HOOK_SECRET, as hex.

    Terminal window
    secret=$(node -e "process.stdout.write(require('node:crypto').createHmac('sha256', process.env.AGENTS_HOOK_SECRET).update('<pipeline id>').digest('hex'))")
  3. Sign the request body with that secret and send it to the API’s machine port. The port is AGENTS_API_PORT, 7700 unless set, on an address in AGENTS_MACHINE_HOST.

    Terminal window
    body='{"title":"Checkout total goes negative","body":"A $5 order with a $10 code comes to -$5.","repo":"<team>/shop","id":"report-1"}'
    signature=$(printf '%s' "$body" | openssl dgst -sha256 -hmac "$secret" | sed 's/^.* //')
    curl -X POST "http://<server address>:7700/v1/hooks/pipelines/<pipeline id>" \
    -H "content-type: application/json" -H "x-agents-signature: $signature" -d "$body"

The body takes these fields.

  • title is required.
  • repo is the forge path of one of the team’s repos, such as <team>/shop. An unknown repo returns 404.
  • body and url are optional text.
  • id is optional. A second delivery with the same id starts no second run.

The answer is {"runs":["<run id>"]}, or {"runs":[]} for a repeated id. A wrong signature returns 401, and a missing title returns 400.

A pipeline with a forge trigger starts a run for each matching issue, once per issue and pipeline. bug-fix listens for issues labeled bug.

  1. File an issue on one of the team’s forge repos. Give it the label the pipeline’s trigger names, either when you open it or afterward. A trigger with no label fires only when an issue is newly opened.
  2. Open Runs to find the run. The report in the run’s page is the issue’s title and body, with a link to the issue.

The forge sends its events to the API’s /v1/hooks/forge, signed with the forge’s webhook secret, and ops/forge-setup.ts registers that hook.

On a repo hosted on GitHub, GitHub cannot reach the server, so the server asks GitHub once a minute instead. A run starts only from a label that begins with agent:, put on an open issue by someone with write, maintain or admin access, and the pipeline’s trigger must name that exact label. Opening an issue starts nothing.

A pipeline with a cron trigger starts its own runs. Write the trigger in the pipeline’s file, as The pipeline file describes. Each run carries the trigger’s title and body and works in the repo it names.