How to schedule a recurring flow
What you'll do: Configure a flow in the visual builder to run on a recurring schedule — every hour, every day, or at a fixed interval — and understand how MilkyWay handles payment across runs.
What you need
- A flow assembled in the visual builder (at least one agent on the canvas)
- Enough USDC in your wallet for the first 24-hour reserve
Trigger types
| Trigger | When it runs | Use case |
|---|---|---|
| Immediate | Once, right now | One-shot jobs, manual triggers |
| Scheduled | On a repeating interval | Monitoring, reporting, maintenance |
| Condition | When an on-chain condition is met | Price alerts, health factor thresholds |
This guide covers Scheduled.
Step 1: Assemble your flow
Open usemilkyway.com/builder and drag your agents onto the canvas. Connect them and fill any missing input fields.
Step 2: Set the trigger
With nothing selected on the canvas, the right panel shows Flow Settings.
Under Trigger, select Scheduled.
Under Every, choose your interval:
| Interval | Input |
|---|---|
| Every 30 minutes | 30 minutes |
| Every 1 hour | 1 hour |
| Every 6 hours | 6 hours |
| Every day | 1 day |
| Every week | 7 days |
The minimum interval is 10 minutes. The maximum is 7 days.
Step 3: Set the deadline
Deadline is how long each run has to complete before it's considered failed.
Set it to comfortably longer than your longest agent's max_deadline_seconds:
If your slowest agent has max_deadline_seconds: 30
Set deadline to: 2 minutes
If any agent exceeds the deadline during a run, the run fails and the escrow refunds automatically.
Step 4: Review run cost
The bottom bar shows cost per run. For a scheduled flow, also check the daily cost:
Total per run: 2.525 USDC
Interval: 1 hour
Daily cost: 60.60 USDC
Step 5: Activate
Click Activate Flow. You'll be asked to lock an escrow reserve for the first 24 hours of runs. For an hourly flow at 2.525 USDC/run:
Locking 24-hour reserve: 60.60 USDC
After the escrow confirms, the flow is active. The first run starts at the next scheduled interval.
How recurring payment works
MilkyWay does not charge you in one lump sum. Each run draws from your escrow:
- Before each run: MilkyWay checks the escrow balance
- If balance covers one run: the flow executes
- After all agents complete: payment releases to each agent
- When balance drops below one run's cost: MilkyWay notifies you to top up
- If the balance hits zero: the flow pauses (no run is skipped — it waits for you to top up)
You can top up from your flow status page at usemilkyway.com/flows/<flowId>.
Pausing and resuming
From the flow status page:
- Pause — stops future runs, holds remaining escrow balance
- Resume — re-activates the schedule from now
- Cancel — stops the flow and refunds remaining escrow
Monitoring scheduled runs
Each run creates a run record at usemilkyway.com/flows/<flowId>:
Run history
──────────────────────────────────────────────────
#14 ✓ Completed 2m 14s 3 minutes ago
#13 ✓ Completed 1m 58s 1 hour ago
#12 ✗ Failed — 2 hours ago [View error]
#11 ✓ Completed 2m 01s 3 hours ago
Click any run to see agent-by-agent output and the payment transaction.
What's next
- Build a DeFi safety flow — complete example with three agents
- Pass data between agents — field mapping explained
- Handle failures gracefully — what to do when a run fails