Agent Playground
Tutorial 6: Run a flow on its own
Make the website check from Tutorial 1 run every morning by itself, start a flow from another app with a webhook, and start one when code changes on GitHub.
A flow you have to remember to run is a flow that doesn't get run. In this tutorial you'll add triggers: a schedule that runs your website check every morning, and a webhook that lets another app, like a contact form or Zapier, start a flow. Then you'll see how to start a flow when something happens on GitHub.
Time: about 10 minutes. Plan: Free. You need: the Check my website flow from Tutorial 1. Any saved flow works too.
A triggered run is a normal run: it has the flow's limits and policy, it counts toward your plan's runs, and it shows under Past runs like any other.
1. Run it every morning
- Open your
Check my websiteflow. - Choose Triggers in the toolbar. (On a phone or narrow screen, it's under More.) You can also choose the small Triggers tag above the flow's first step.
- Under Add a trigger, choose Schedule.
- Pick Daily, and a time under At, UTC. Times are in UTC, so for 8:00 in the morning in New York pick 13:00 (12:00 in summer).
- Choose Add trigger.
That's it. Every morning, the flow runs by itself. Each trigger in the list has an On/Off switch, and says when it last started a run. To pause it for a while, switch it off. Delete removes it.
You can schedule a flow every 15 or 30 minutes, every hour, daily or weekly. If a scheduled start is missed by more than five minutes, it's skipped rather than made up later, so a flow never runs twice in a row to catch up.
Tip
Want to hear about it only when something's wrong? End the Needs a look path with a step that tells you, such as an Approval (which emails your team) or a command that posts to your team chat.
2. Start a flow from another app
A webhook gives a flow its own web address. Anything that can send a web request can start it: a form on your website, a monitoring alert, a Zapier or Make step, or your own code.
- In Triggers, under Add a trigger, choose Webhook.
- The builder shows the address, a token, and a ready-made Try it command.
- Copy the token now. It's shown only once. If you lose it, delete the trigger and add a new one.
Paste the address and token into the other app. If it lets you send data, send it as JSON, like this test from a terminal:
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": "Sam", "order": 4821}'Whatever the other app sends reaches the run:
- in the sandbox, as the file
.qr/trigger.json, so a step can read it (cat .qr/trigger.json); - in an AI step's prompt, as
{{trigger}}. Choose Insert… and then What started the run.
That's how the customer-email flow from Tutorial 5 can answer real emails: point your contact form at its webhook, and have the first step read the message from .qr/trigger.json instead of using a sample.
Careful
Anyone with the address and token can start the flow, and what they send reaches the run. Keep the token secret like a password, and keep an Approval before any step that does something real with what was sent.
3. Start a flow when code changes on GitHub
If your team keeps code on GitHub, a GitHub trigger starts a flow when someone pushes commits, opens or updates a pull request, or publishes a release.
- In Triggers, under Add a trigger, choose GitHub event. Pick the events, and optionally the one repository it's for (
owner/name). - The builder shows a payload URL and a secret. Copy the secret now: it's shown only once.
- In GitHub, open your repository's Settings, then Webhooks, then Add webhook. Paste the payload URL, set the content type to
application/json, paste the secret, pick the same events, and save.
Only GitHub can start the flow this way: every delivery is checked against the secret. The run gets a short summary of what happened: the repository, the branch, the commit or pull request, and who did it. The PR reviewer recipe is a good flow to try this with.
Who a triggered run belongs to
A triggered run starts as the person who added the trigger, with their limits. If that person leaves your organization, the trigger stops starting runs and says why in its list. Adding, deleting and every start are written to your audit log.
What you learned
- A schedule runs a flow every 15 minutes up to weekly, in UTC.
- A webhook lets any app start a flow and pass it data, which the run reads from
.qr/trigger.jsonor{{trigger}}. - A GitHub trigger starts a flow on pushes, pull requests or releases.
Next
In Tutorial 7, you'll see your flow as text: handy for copying a flow, sharing it with a teammate, or making many small changes at once.