Skip to the content
Gridkiln
Menu
Guide contents

Guide Guide

Workflows and the background agent

A pipeline is the saved work; a workflow is what makes it run for you. It says what starts it, which pipelines run in what order, what has to happen before delivery, who is told, and what to do when something goes wrong. Workflows are run by the background agent, which keeps running when the window is closed.

Making a workflow#

  • From a pipeline: Run options (the arrow beside Run) › Schedule…, Run › Schedule… in the menu bar, or Schedule this pipeline in a workflow in the command palette. All three do the same.
  • From scratch: Workflows on the rail (⌘5 / Ctrl+5), then New workflow: “A workflow runs pipelines for you: on a schedule, when a file arrives, or after another workflow, with review gates, delivery and file housekeeping in between.”

The workflow is a chart that reads from left to right. Select a step to edit it in the inspector on the right, which has three tabs: Step, Triggers and Settings. With the chart focused, the arrow keys follow the flow from step to step, Tab moves in flow order, Enter opens a step’s editor, A adds a step after it, Delete removes it, and Alt with an arrow key moves it. Tidy layout and Fit to window tidy the chart. The switch in the header turns the workflow on (“its triggers start it”) or off (“only a manual run starts it”).

Steps of a workflow#

Add step offers these actions:

Action What it does
Run a pipeline With parameter values; once per value, in sequence or side by side. Its outputs are delivered “At a Deliver step (after any review)” or “As soon as it finishes”
Wait for a file Continues when the file exists and has stopped growing (“Stopped growing for (seconds)”), up to a time limit, and says what to do If it does not arrive
Branch on a condition On a check result, a row count, a parameter or the calendar. “The first branch whose condition holds is taken”
Review gate Pauses until a named person approves or rejects (below)
Deliver Writes the outputs and sends the messages of the pipelines before it
File housekeeping Moves, renames, archives into a zip, or deletes files (to the recycle bin unless you say otherwise), such as moving processed inputs to exports/archive/
Call out Runs a program (its arguments “Passed as they are, one by one (never through a shell)”), a Python, R, JavaScript or shell script, or sends a web request
Run another workflow For chains: after the daily load, refresh the weekly summary
Notify Tells people on the desktop, by email or in chat
Wait Pauses for a while or until a time of day

Every step has a Retries setting for temporary problems such as a locked file (“Doubles each time”), a Time limit, and Carry on if this fails for optional housekeeping. Connections between steps can lead somewhere else If it fails or If rejected.

Triggers#

In the Triggers tab, Add a trigger:

Trigger Starts the workflow
On a schedule Every day, On chosen weekdays, Weekdays, no holidays, Monthly, on a date (−1 is the last day), Monthly, on the nth working day, Monthly, on the nth weekday, Every few minutes, A cron expression, or Once; at times on the 24-hour clock, in a Time zone “also across summer time”, with a holiday calendar and what to do On a holiday
When a file arrives When a file appears in a watched folder or matches a pattern, “New” or “Changed”, once it has stopped growing; one run per file or one run for all of them. Ignore a file already processed makes each file start one run only
When an email arrives When a message matching a rule arrives in a mailbox folder; its attachments are saved first
When another workflow finishes Successfully, with a failure, or either way
When a database table changes When a read-only probe query, such as SELECT count(*) FROM orders, gives a new value
By hand The Run button always works; this adds the tray menu and a global shortcut (such as CommandOrControl+Alt+R) that works anywhere on the computer while the agent runs
From the command line Shows the exact gridkiln run-workflow command to give any other scheduler; Copy the command
From a local web request A POST to http://127.0.0.1:<port>/hooks/… with a token kept in the keychain (set it with gridkiln secrets set); body fields become parameters

A trigger can supply parameter values. A schedule lists its Next runs, and the workflow’s header shows “Next: …”.

Review gates#

A review gate pauses the run before delivery until a named person approves or rejects. Set the Reviewer and how they hear of it, Approvals needed, the Message, and When nobody answers: After (minutes) and Or by (time of day), whichever comes first, Then approve, reject, ask someone else to review it, or remind the reviewers and keep waiting.

The reviewer gets a desktop notification, “Ready for review: Monthly sales”, with Approve and Review. The review shows the headline, what approving will do (“Nothing has been delivered yet. Approving writes 7 files and sends 7 emails.”), What changed since last time, the checks, what will be delivered and the messages. Approve and deliver (⌘↵ / Ctrl+Enter) continues to delivery; Reject… (⇧⌘⌫ / Ctrl+Shift+Backspace) asks for a reason, which is recorded in the run. A decision can also be made with Review the runs waiting for you in the command palette, from the run record (Review…), or with gridkiln approve. What is delivered after approval is exactly what was reviewed.

Settings of a workflow#

The Settings tab holds:

  • General: name, what it is for, owner, and Keep the inputs of every run (snapshots let any run be repeated exactly).
  • Queue: Priority (“Higher runs first when several workflows are waiting”) and If it is still running when it is due again. The same workflow never runs twice at once.
  • Wait before starting: folders or files that must be there, hosts that must answer (a VPN up, a database reachable), mains power, up to a limit.
  • Retries for temporary problems. “A failed check is never retried: retrying cannot fix it.”
  • Keep the computer usable: threads and memory at most, and Run at low priority.
  • Missed runs: If the computer was off or asleep when it was due: Run every missed time, in order, Skip the missed runs, or Run once, for the latest time missed, and how old a missed run may be.
  • Deadline alert: Alert if it has not succeeded by a time, on the days it is scheduled. It catches what a failure alert cannot: the computer was off, or the trigger never fired.
  • AI during runs: Row-level AI steps may ask AI during runs. Off by default: runs use stored answers only, and a value with no stored answer follows the step’s “No stored answer” setting, with nothing sent. On: “Values no stored answer covers are sent to your AI provider while this workflow runs.” What it costs counts, for each AI step the workflow’s pipelines run, the values that have no stored answer now, with the time and cost to ask them. See AI and privacy.
  • Notifications: who is told When it fails, When it finishes with warnings and When it succeeds (off by default: the tray shows it), on the desktop, by email or in Slack or Teams; After repeated failures, also tell a second person; quiet hours; and grouping of repeated failures into one notice.

When a run fails#

A failure notification says in plain words what failed and what was not written: “Daily orders stopped. Check failed: Order ID is unique, 37 duplicates. Nothing was written.” Its button is Open at the failing step.

The app opens What went wrong for that run: what failed, what was and was not written, the failing rows, the checks, and the inputs with their fingerprints. From there:

  • Open at the failing step opens that run’s own table at the failing step, filtered to the offending rows.
  • Resume from the failed step starts a new run from where it stopped, reusing the steps that did not change. It asks “What did you change? (kept with the new run)”; the new run ends Recovered, with your note. The same button is on the stopped run’s record in the Runs view, and in the menu bar (Run › Resume from the Failed Step) and on ⇧⌘R / Ctrl+Shift+R.
  • Run again from the start, and Mark as handled, which “leaves “Needs attention” and nobody else is told about it”.
  • A proposed check “So it cannot happen again unnoticed”, with Add this check.

Temporary problems, such as a locked file or a lost connection, are retried with growing pauses before anyone is told. Walkthrough 4 goes through the whole flow.

The Runs view#

Runs on the rail (⌘4 / Ctrl+4) shows past and upcoming runs on a Timeline, one row per pipeline or workflow, by hours, days or weeks, filtered by workflow and status. Click a run for its record, which “cannot be edited”: what started it, the pipeline version, the parameter values, each step with its rows and duration, the row accounting, the checks, the comparison with earlier runs, the inputs with their fingerprints, the outputs, the messages, and notes (Add note, sealed onto the record). Shift-click a second run to compare the two. Health shows success rates and durations; Needs attention lists stopped runs, reviews waiting, sources that stopped updating and checks that keep warning. Export run records for an audit… writes the sealed records to a file, and Verify every run record checks that none was changed.

The background agent#

The agent runs the workflows. In the app it lives in the system tray (the menu bar on macOS), and it keeps running when you close the last window; the first time, a notification says so. Its menu shows what is running, what needs you, what is next and the last runs, with Pause all workflows, Run a workflow now, Start at login, Open Gridkiln, Settings… and Quit the agent (which stops schedules until the agent starts again).

Only one agent schedules a project at a time. If a second one finds the project already scheduled (another computer on a shared folder, or a service and the tray), it waits.

Scheduled runs need a licence or a running trial. Without one, each run that falls due is recorded in the Runs view as Skipped: no licence (nothing is read or written), with a notification and the workflow’s failure channels told once a day; schedules continue from the next due time once a licence is added. The service never starts a trial of its own, and a headless runner is covered by the licence of the desktop that paired it. See Licence and trial.

Running as a service#

To run workflows with nobody logged in, install the agent as a service in Settings › Background agent: Run as a service. Choose When it runs (Whenever this computer is on, which needs an administrator once to install, or Only while I’m logged in) and the Account it runs as. Before you install, the page shows exactly what will happen: what it runs, the projects, where it logs, what happens if it stops, the files it writes and removes, and the commands in order, with the one that asks for an administrator’s permission marked. Install as a service installs it; Remove the service… removes it. On macOS it is a launch daemon, on Linux a systemd unit, on Windows a scheduled task; the tray then connects to the service instead of starting its own agent.

Waking the computer#

Where the operating system allows, the agent can wake the computer for a scheduled run. Tick Wake the computer to run it on the workflow’s schedule, and allow it once for the computer in Settings › Background agent (Allow waking this computer, Let the agent wake it for runs). This permission is off by default and is offered only when a workflow asks to wake, because it widens what runs as administrator. When waking is not possible, the deadline alert is the safety net. A laptop that is off cannot alert about itself: for that, use the headless runner below.

The operating system’s own scheduler#

Export schedules for the operating system’s scheduler… (Settings › Background agent) writes entries for cron, launchd, systemd or Task Scheduler that call gridkiln, for people who would rather the operating system started their runs.

The headless runner#

A computer that is always on can run the schedules for you, so your laptop does not have to be on at 6 a.m. On that computer, run gridkiln agent --serve; it prints its address. Run gridkiln agent --pair there for a one-time pairing code. Then, in Settings › Runners on your own computer, choose Add a runner…, give the Address, Look it up (check the certificate it shows), type the Pairing code, name it and choose Pair. The connection is HTTPS with the runner’s certificate pinned.

For each project, Push now (or Push automatically) sends the project’s shared documents to the runner: never the .gridkiln/ folder and never secrets. Hand schedules over makes the runner run the project’s schedules; Take them back returns them. What … needs lists the secrets to set on the runner (with gridkiln secrets set there: “Secrets never leave the computer they were entered on”), folders to map and connections it cannot reach. The runner’s runs appear in your Runs view with its name.

A shared or synced folder works too: then nothing needs pushing, and the agent that holds the project decides who schedules.

The command line#

Every pipeline and workflow runs from the command line, with parameters, an exit code and a machine-readable log, so it fits inside any other scheduler:

gridkiln run ~/sales "Monthly sales" --param month=2026-10
gridkiln run-workflow ~/sales "Monthly delivery"
gridkiln check ~/sales "Monthly sales"
gridkiln approve --list

--dry-run does everything except deliver; --log-format ndjson prints one JSON object per line, ending with the run’s status and exit code, and never row values. Exit code 0 means success, 2 a data failure (a check stopped it; nothing was written), 3 a temporary failure, 4 a configuration problem, 5 rejected at a review gate, 6 cancelled, 9 no licence (the command needs a licence or a running trial; nothing was read or written). Every command and option is in The gridkiln command.

See also#