Flows and schedules

A finished task can be saved as a flow. Replaying it makes no model calls, so a repeat costs no tokens, and approvals still wait for you.

Updated

What a flow is

A flow is a named list of steps. Each step stores the action, several ways to find its element again (role and name, label, nearby text, CSS, XPath), %var% parameters, and a postcondition: what the page should look like afterwards. Flows are stored locally in SQLite, in Druzhe's data dir.

Because every step checks its postcondition, a click that went wrong is caught instead of counted as a success.

Save a flow

Each finished task shows a recap: what was done, the steps, the time and cost, and the flow it was saved as. From an agent, the flow_save tool saves the actions recorded in the session. Typed values named in vars become %name% placeholders. Saving over an existing name needs overwrite: true and that flow's version.

In standalone mode, --flow NAME does both jobs: Druzhe replays that flow when it fits, and otherwise runs the task and saves the run under that name.

druzhe run "fill the contact form at https://example.com/form" --flow contact --var name=Ada

Replay with zero model calls

Run a flow from the dashboard (druzhe ui), the side panel, an agent (flow_list, flow_run) or the CLI:

druzhe flow list
druzhe flow run contact --var name=Ada --allow example.com

Replay calls no AI provider. The guard still runs: a step that would send data is held for your approval exactly as in a live run.

When a site changes. If a step's postcondition fails, only that step is healed. From an agent, flow_run returns needs_heal with a fresh snapshot, and flow_heal replaces the broken step; it is checked against the flow version and saved as a new version.

Variables

Variables are %name% placeholders in a flow's steps, filled with --var name=value (repeat it for each variable). Use them for anything that changes between runs: a search term, a date, a name. For personal details, prefer profile placeholders like {{profile.email}}, which the model never sees: see Approvals and safety.

Schedules

Schedule a flow from the dashboard or the side panel's Flows library. Schedules are kept in flows.toml next to the flow database:

[apply]
schedule = "daily 09:00"

["check prices"]
schedule = "hourly"
  • hourly runs at the top of every hour; daily HH:MM runs every day at that local time.
  • The Druzhe daemon replays a due flow with zero model calls. Each slot runs at most once, and slots missed while no daemon ran are skipped.
  • Scheduled runs still wait for your approval before anything is sent.

Export and import

Flows export to JSON, so you can keep them in a repository or move them to another computer:

druzhe flow export contact -o contact.json
druzhe flow import contact.json
druzhe flow show contact
druzhe flow delete contact

The dashboard and side panel export and import flows too.