Zing Forum

Reading

ClawFlow: A Declarative Workflow Format Designed for AI Agents, Enabling Agents to Write and Execute Flows Themselves

ClawFlow is an AI-native workflow format that allows LLMs to directly generate, read, and execute workflows. It resolves the contradiction of traditional workflow tools: either too complex for AI to generate, or too simple to express real business logic.

AI工作流ClawFlowOpenClaw代理编排声明式工作流Cloudflare WorkflowsAI原生工具LLM生成
Published 2026-04-01 04:45Recent activity 2026-04-01 04:50Estimated read 5 min
ClawFlow: A Declarative Workflow Format Designed for AI Agents, Enabling Agents to Write and Execute Flows Themselves
1

Section 01

Introduction: ClawFlow - A Declarative Workflow Format Designed for AI Agents

ClawFlow is an AI-native declarative workflow format designed to enable LLMs to directly generate, read, and execute workflows. It resolves the contradiction of traditional tools: either too complex for AI to generate, or too simple to express real business logic. This article will cover its background, design philosophy, node types, persistence mechanism, application scenarios, and more.

2

Section 02

Background: Dilemmas of Existing Workflow Tools

Current workflow tools are polarized: Visual tools (e.g., n8n) require manual configuration, so AI cannot participate in creation; pure code frameworks (e.g., Temporal/Airflow) are powerful but highly complex, making it difficult for LLMs to reliably generate correct definitions. This gives rise to a need: AI agents need a workflow format that is both concise and powerful—one that LLMs can generate in a single pass, is human-readable, and can be executed across multiple environments.

3

Section 03

Core Design Philosophy of ClawFlow

ClawFlow is designed based on three principles: 1. LLMs can write valid workflows in one go (constraining node types to 11 to balance expressiveness and reliability); 2. The format is an asset rather than a runtime (write once, run in multiple environments); 3. AI nodes are first-class citizens (do: ai and do: agent are core primitives, supporting structured output, etc.).

4

Section 04

Detailed Explanation of ClawFlow Node Types

There are 11 node types, divided into three categories:

  • AI and Agent Nodes: do: ai (single LLM call, structured output), do: agent (delegate to OpenClaw agent for multi-step tasks);
  • Control Flow Nodes: do: branch (multi-way routing), do: condition (if/else), do: loop (array traversal), do: parallel (concurrency);
  • Integration and State Nodes: do: http (HTTP request), do: memory (persistent key-value storage), do: wait (approval/event waiting), do: sleep (delay), do: code (JS expression).
5

Section 05

Persistence Mechanism and Runtime Portability

Persistence: Each run has a unique instanceId; after a node is completed, its state is persisted to a local file, supporting interruption recovery, memoized output, and long-term suspension. Portability: The format is decoupled from the runtime, supporting OpenClaw plugins, Cloudflare translators (converting to TypeScript), and the upcoming standalone runner (self-hosted Node.js).

6

Section 06

Practical Application Scenarios and Tool Comparison

Application Scenario Example: When a new GitHub PR is opened, AI reviews the diff → checks CI status → handles branching → posts comments; the agent can generate the flow in one pass. Comparison Table:

Feature Visual Tools Code-First Frameworks ClawFlow
AI Nodes as First-Class Citizens Partial
Agent Delegation Partial
LLM-Writable
Human-Readable
Persistent Execution
Runtime Portable
Self-Hostable
7

Section 07

Conclusion: Paradigm Shift in AI-Native Workflows

ClawFlow represents a paradigm shift in workflows towards AI-native formats. Instead of making AI adapt to existing tools, it designs a format that AI can understand and generate. Its "constraints as features" (limiting node types to ensure generation reliability) may become a reference paradigm for future AI-native tool design.