Building workflows
Your first workflow
A complete build: from an empty canvas to a published, scheduled workflow with a human approval gate. About twenty minutes, and you will break it on purpose at the end.
Build the graph#
- 1
Create the workflow
Workflows → New workflow → Start blank. Name it
renewals-daily. You get a canvas with a single trigger node. - 2
Configure the trigger
Select the trigger and set its type to Schedule. Leave the cron empty for now — you will set it after the graph works. Declare one input field,
lookaheadDays, a number with a default of 30. - 3
Add the query
Add a Tool node and bind it to
postgres.query. Its SQL template takes the lookahead from the trigger:n1002 · postgres.querySELECT account_id, renewal_date, mrr_gbpFROM contractsWHERE renewal_date < NOW() + ({{lookaheadDays}} || ' days')::intervalORDER BY mrr_gbp DESCIn the Inputs tab, bind
lookaheadDaysto the trigger’s field of the same name. - 4
Add the agent
Add an Agent node and pick your model connection. Give it the instruction: “Score each account’s renewal risk from 0 to 1 and explain the score in one sentence.” Bind its
accountsinput ton1002.rows. - 5
Branch on risk
Add a Branch node. Condition:
n1003.maxRisk > 0.7. The true path goes to an approval gate; the false path goes straight to the send. - 6
Add the gate
On the true path, add a Human approval node. In its message, reference the resolved values so the reviewer sees facts rather than placeholders:
n1005 · approval{{n1003.topAccount.name}} scores {{n1003.maxRisk}} renewal risk.MRR {{n1002.rows[0].mrr_gbp}} GBP, renews {{n1002.rows[0].renewal_date}}.Approve to send tailored outreach. - 7
Send
Both paths converge on a Merge, then a tool node bound to
slack.postMessage. End with an Output node.
Simulate before you publish#
Open the Simulate panel. It dry-runs the graph with mocked tool responses, so no email is sent and no row is written, and gives you a cost estimate per node. Fix anything the validator flags — unbound required inputs appear here rather than at 3am.
Publish and schedule#
- 1
Publish version 1
Publish shows a change summary before it commits. Publishing does not start anything; it makes the version available to triggers.
- 2
Set the schedule
Triggers → your workflow → set the cron to
0 7 * * 1-5. The input shows you the prose translation and the next five fire times in your timezone. Confirm they are what you meant before saving — this is the field most likely to be wrong by a factor of sixty. - 3
Run it once by hand
Run now. Watch the ribbon fill in the run header as each node commits.
Break it on purpose#
This is the part worth doing. While the run is executing, revoke the database connection’s password, or stop the database.
The run fails at the query and stops. The trigger and any nodes before it stay committed. Fix the credential, then press Resume from checkpoint on the run page — execution re-enters at the failed node. Nothing before it runs again, and no message is sent twice.
Was this page helpful?