---
title: Triggers · Agent Playground docs
description: Start an Agent Playground flow without pressing Run, on a schedule, from a webhook or when something happens in a GitHub repository.
url: https://www.quietrobot.ai/docs/playground/triggers
---

# Triggers

Start an Agent Playground flow without pressing Run, on a schedule, from a webhook or when something happens in a GitHub repository.

A trigger starts a saved flow by itself. Each start is a normal run, with the flow's [limits](https://www.quietrobot.ai/docs/playground/safety#limits), its [policy](https://www.quietrobot.ai/docs/playground/safety#policy) and your plan's run limits, and it shows in **Recent runs** like any other.

| Trigger | Starts the flow |
|---|---|
| [Schedule](#schedule) | Every 15 or 30 minutes, hourly, daily or weekly. |
| [Webhook](#webhook) | When another app sends a POST to the flow's own address. |
| [GitHub](#github) | On a push, a pull request or a release in a repository. |

A flow can have up to 10 triggers, of any mix.

```flow
{"title": "A nightly check: a schedule starts the flow, an agent fixes what fails, and a person approves the fix.", "nodes": [["test", "run", "Run tests", "Daily at 02:00 UTC"], ["fix", "agent", "Fix the code"], ["ok", "approval", "Open a pull request?"], ["pr", "run", "Open the pull request"], ["green", "end", "All green"]], "edges": [["test", "fix", "Failed"], ["fix", "ok", "Done"], ["ok", "pr", "Approved"], ["test", "green", "Passed"]]}
```

## Add a trigger

Open **Triggers** in the builder's toolbar (on smaller screens, it's under **More**). You can also choose the **Triggers** chip above the flow's first step, or the **Trigger** block in the Blocks panel. Then choose **Add trigger** and pick a kind.

Each trigger in the list has an **On/Off** switch, says when it last started a run, and shows why if its last start didn't happen. **Delete trigger** removes it, and its address stops working at once.

## Schedule

Pick how often: **Every 15 minutes**, **Every 30 minutes**, **Every hour**, **Daily** or **Weekly**. For daily and weekly, also pick the time and, for weekly, the day. Times are in UTC.

A schedule that was due while the service was busy for a few minutes still starts. A start that was missed by more than five minutes is skipped, not made up later, so a flow never starts twice in a row to catch up.

## Webhook

A webhook gives the flow its own address. Anything that can send an HTTP POST can start it: a form, a monitoring alert, a Zapier or Make step, or your own code.

When you add one, the builder shows the address and a token, with a ready-made **Try it** command. **The token is shown only once.** Copy it then: we can't show it again. If you lose it, delete the trigger and add a new one.

```bash
curl -X POST https://api.quietrobot.ai/api/v1/hooks/flows/trg_123 \
  -H "X-QR-Token: qrt_..." \
  -H "Content-Type: application/json" \
  -d '{"customer": "Acme", "ticket": 4821}'
```

The JSON body, up to 64 KB, is passed to the run (see [What the run gets](#what-the-run-gets)). The answer is `202` with the new run's `runId`. A wrong token or an unknown address gets `401`, and a trigger that's turned off, or a run your limits don't allow right now, gets `409`.

> [!WARNING]
> Anyone with the address and token can start the flow, and what they send reaches the run. Treat the token like a password, and keep an [Approval](https://www.quietrobot.ai/docs/playground/blocks#approval) before any step that does something real with what was sent.

## GitHub

A GitHub trigger starts the flow on events in a repository:

| Event | When |
|---|---|
| **push** | Commits are pushed. |
| **pull_request** | A pull request is opened, reopened, updated with new commits, or marked ready for review. |
| **release** | A release is published. |

Pick the events, and optionally **Only this repository** (`owner/name`), then add the trigger. The builder shows a payload URL and a secret, **shown only once**. Then, in GitHub:

1. In your repository, open **Settings**, then **Webhooks**, then **Add webhook**.
2. Paste the payload URL, set the content type to `application/json` and paste the secret.
3. Choose the same events, and save.

Every delivery is checked against the secret, so only GitHub can start the flow. Each delivery starts at most one run: a delivery sent again, including with GitHub's **Redeliver**, is ignored.

The run gets a short summary of the event (the repository, the branch or tag, the commit, pull request or release, and who did it), not the whole delivery.

## What the run gets

Whatever started the run is passed to it:

* In the sandbox, as the file `.qr/trigger.json`. A **Run command** or **Run code** step can read it, like `jq .ticket .qr/trigger.json`.
* In AI steps, as `{{trigger}}`. In a prompt or an agent's goal, choose **Insert…** → **What started the run**.

A run started by hand or from the API has no trigger, so `{{trigger}}` is empty and the file isn't there.

```flow
{"title": "A support form posts to a webhook: Claude sorts the message, and a person approves anything that moves money.", "nodes": [["read", "code", "Read the message", ".qr/trigger.json"], ["sort", "choice", "What kind?", "refund · bug · question"], ["refund", "approval", "Refund this order?"], ["bug", "run", "File the bug"], ["answer", "model", "Draft an answer"]], "edges": [["read", "sort"], ["sort", "refund", "refund"], ["sort", "bug", "bug"], ["sort", "answer", "question"]]}
```

## Who a run belongs to

A triggered run starts as the person, or the API key, that added the trigger, with the same limits. If that key is revoked, has expired or has reached its spend cap, or that person has left your organization, the trigger starts nothing and says why in its list. Adding, deleting and every start are written to your [audit log](https://www.quietrobot.ai/docs/sandboxes/audit).

## From code

Triggers have their own routes in the [Flows API](https://www.quietrobot.ai/docs/playground/api):

| Call | What it does |
|---|---|
| `GET /flows/{id}/triggers` | A flow's triggers, with when each last started a run and when a schedule next will. |
| `POST /flows/{id}/triggers` | Add one: `{"kind": "schedule", "schedule": {...}}`, `{"kind": "webhook"}` or `{"kind": "github", "events": ["push"], "repo": "you/app"}`. The answer has the `secret`, only this once. |
| `PATCH /flows/{id}/triggers/{triggerId}` | Turn it on or off (`enabled`), or change its schedule, events or repository. |
| `DELETE /flows/{id}/triggers/{triggerId}` | Delete it. |
| `POST /hooks/flows/{triggerId}` | Start the flow. No API key: a webhook sends its token, GitHub signs its deliveries. |

A schedule is one of these, all UTC, with `weekday` 0 for Sunday:

```json
{ "every": "minutes", "minutes": 15 }
{ "every": "hour", "minute": 5 }
{ "every": "day", "hour": 9, "minute": 0 }
{ "every": "week", "weekday": 1, "hour": 9, "minute": 0 }
```

## Limits

| Limit | Value |
|---|---|
| Triggers a flow | 10 |
| Shortest schedule | every 15 minutes |
| Webhook body | 64 KB |
| Calls to one trigger | 30 a minute |

A start still has to fit your [run limits](https://www.quietrobot.ai/docs/playground/safety#run-limits): if too many runs are going already, it doesn't start, and the trigger's list says so.
