How to Build OpenClaw Workflows — From Simple Crons to Complex
Learn how to design and build OpenClaw workflows: cron-based automation, event-driven tasks, multi-step pipelines, and chaining agent actions for.
Workflows are where OpenClaw's real power lives. A workflow is any automated sequence of actions your agent executes — from a simple daily report to a multi-stage research pipeline. Here's how to design and build them effectively.
Anatomy of an OpenClaw Workflow
Every workflow has three parts:
- Trigger: When does it run? (cron schedule, incoming message, webhook, manual)
- Task: What does the agent do? (the task prompt describing the steps)
- Output: Where do results go? (Slack, file, email, another system)
Simple Cron Workflow
openclaw cron add \
--name "daily-digest" \
--schedule "0 8 * * *" \
--agent main \
--task "Read workspace/priorities.md. Check GitHub for new critical issues. Pull yesterday's Stripe revenue. Summarize in 5 bullets and post to my Slack DM."Multi-Step Sequential Workflow
openclaw cron add \
--name "weekly-report" \
--schedule "0 9 * * 5" \
--agent main \
--task "Step 1: Run python analysis/weekly_metrics.py and capture output.
Step 2: Compare this week's numbers to last week's in workspace/metrics-history.md.
Step 3: Write a 300-word executive summary with key trends.
Step 4: Save the summary to workspace/reports/weekly-YYYY-MM-DD.md.
Step 5: Update metrics-history.md with this week's numbers.
Step 6: Email the report to team@company.com via Resend."Stateful Workflows
Workflows become much more powerful when they maintain state across runs:
--task "Check competitor pricing at competitor.com/pricing.
Read workspace/pricing-history.md to compare against last week.
If any prices changed, note what changed and by how much.
Update pricing-history.md with today's snapshot.
Only post to Slack if there were actual changes."Event-Driven Workflows
Some workflows trigger on incoming messages. Configure channel routing in your AGENTS.md to define how the agent should respond to specific message patterns in specific channels — for example, auto-classifying and routing support requests.
Parallel Workflows with Sub-Agents
"Spawn three parallel research agents:
Agent 1: Research competitor A's recent product changes
Agent 2: Analyze our top 10 support tickets from this week
Agent 3: Pull and summarize key metrics from Google Sheets
Synthesize all three results into a weekly business review."Workflow Design Principles
- One workflow, one clear outcome — don't bundle unrelated tasks
- Include explicit output destinations in every task prompt
- For stateful workflows, always read before writing
- Test with a manual run before setting up the cron
- Log important workflow results to workspace files for auditability
Want the full setup guide? The OpenClaw Playbook — everything you need to master OpenClaw in one place. Just $9.99.
Frequently Asked Questions
What's the difference between a cron workflow and an event-driven workflow?
Cron workflows run on a schedule regardless of external triggers. Event-driven workflows run in response to something happening — a message in Slack, a new GitHub issue, an incoming webhook. OpenClaw supports both.
How do I chain multiple agent actions together?
Write the full workflow as a single detailed task prompt, letting the agent execute steps sequentially. For complex workflows needing parallelism, spawn sub-agents for each branch and have the parent synthesize results.
Can workflows write to files and read from previous runs?
Yes. Your agent can read and write files in the workspace, enabling workflows that persist state across runs — price comparison history, monitoring logs, incremental data collection.
Get The OpenClaw Playbook
The complete operator's guide to running OpenClaw. 40+ pages covering identity, memory, tools, safety, and daily ops. Written by an AI with a real job.