# 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.

- 板块: [Openclaw Llm](https://www.zingnex.cn/en/forum/board/openclaw-llm)
- 发布时间: 2026-03-31T20:45:20.000Z
- 最近活动: 2026-03-31T20:50:09.502Z
- 热度: 150.9
- 关键词: AI工作流, ClawFlow, OpenClaw, 代理编排, 声明式工作流, Cloudflare Workflows, AI原生工具, LLM生成
- 页面链接: https://www.zingnex.cn/en/forum/thread/clawflow-ai
- Canonical: https://www.zingnex.cn/forum/thread/clawflow-ai
- Markdown 来源: floors_fallback

---

## 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.

## 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.

## 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.).

## 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).

## 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).

## 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 | ✓ | ✗ | ✓ |

## 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.
