Skip to main content
A nightly job that fails at 3am helps nobody until someone notices. In this guide a second workflow starts by itself every time the first one’s run fails, and receives which run failed and why. Neither workflow names the other in its graph: the follow-up declares a workflow_event trigger, and you turn it on. Workflow events lists every field and payload key.

Before you begin

  • The reliant CLI, v1.21 or later, signed in (Sign in and tokens).
  • A Reliant project for the repository and a connected machine that holds it (Run a machine from the terminal).
  • The workflow you want to follow up on, in .reliant/workflows/. This guide uses a stand-in called nightly-check.
1

Know when a run counts as failed

A run reports failed when it errors, or when it ends at a node that declares outcome: failure. This stand-in runs a check and routes a non-zero exit to such a node:
.reliant/workflows/nightly-check.yaml
A run whose run node exits non-zero but reaches no failure node counts as finished: the exit code is an output to route on.
2

Declare the follow-up

The trigger watches nightly-check for failed and maps fields of the event into the follow-up’s inputs:
.reliant/workflows/failure-follow-up.yaml
Add finished or blocked to outcomes to react to those too. To have an agent investigate instead, replace note with an agent node:
.reliant/workflows/failure-follow-up.yaml
3

Test the trigger with a scenario

A scenario starts the run through the trigger with a sample payload, so the input mapping is tested without a real failure:
.reliant/workflows/failure-follow-up/scenarios/failed_run_gets_a_note.yaml
terminal
Commit both files, so the machine syncs them. Test workflows with scenarios covers the format.
4

Turn the trigger on

Declaring a trigger fires nothing. Activate it for this project and machine, with the message each follow-up run starts with:
terminal
5

Verify a failure starts the follow-up

Run the watched workflow, then list the trigger’s firings:
terminal
launched with a chat ID is the follow-up run. reliant workflow status a24ea239-1817-5cb6-b403-71a262e33b85 shows Outcome: ✓ SUCCESS, and the run’s message in the app reads nightly-check run bab4c621-d14c-4244-ba39-072766995a66 failed., naming the run that failed.
6

Turn it off

terminal

What this does not do

  • No loops. A workflow-event trigger never fires on a run it started, or on that run’s descendants, and a chain of event-started runs stops after five hops.
  • It watches only your own workflows’ runs. Leave workflows empty to watch all of them.
  • Nobody answers the follow-up. Event-started runs are unattended: an agent in one decides and proceeds, and some tools are withheld from it (Unattended by design). In an organization, an agent follow-up spends only the organization’s AI accounts.
  • error is not always filled. It holds the error of a run that errored. For a run that ended at an outcome: failure node it is empty, so put what the follow-up needs in that node’s message, or have the follow-up open the failed run.

Troubleshooting

trigger activate needs the first message for each run. Pass it with --message.
Shown by reliant trigger events and reliant trigger get when the activation has no message. Check Message: in reliant trigger get <name>. If it is empty, delete the activation, remove prompt: from the declared trigger, and activate again with --message.

Next steps

Workflow events reference

Every field, payload key and the loop limits.

How automations fire

What happens between an event and the run it starts.

Run an agent on a schedule

Start the workflow you are watching every night.

Production alerts to GitHub issues

File an investigated issue when something breaks.