← Back to Skills Marketplace
Workflow Engine
by
yuyonghao-123
· GitHub ↗
· v0.1.0
· MIT-0
187
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install yuyonghao-workflow-engine
Description
DAG-based workflow engine supporting sequential, conditional, and parallel tasks with checkpoint persistence and event-driven execution.
README (SKILL.md)
Workflow Engine - OpenClaw 工作流编排引擎
版本: 0.1.0
功能: DAG 执行器 + 条件分支 + 并行执行
功能特性
- DAG 编排: 有向无环图工作流定义
- 顺序执行: 简单的线性任务链
- 条件分支: 支持 if/else 条件判断
- 并行执行: 支持并行任务执行
- 状态持久化: 检查点机制支持断点续执行
- 事件驱动: 完整的事件系统
安装
cd skills/workflow-engine
npm install
快速开始
import { WorkflowEngine } from './src/workflow-engine.js';
// 创建工作流引擎
const engine = new WorkflowEngine({
checkpointDir: './checkpoints',
enableCheckpoint: true,
maxConcurrency: 10
});
// 创建顺序工作流
const dag = engine.createSequentialWorkflow('My Workflow', [
{
name: 'Step 1',
execute: async (context) => {
console.log('Executing step 1');
context.data = { value: 42 };
return { success: true };
}
},
{
name: 'Step 2',
execute: async (context) => {
console.log('Executing step 2');
console.log('Data from step 1:', context.data);
return { success: true };
}
}
]);
// 执行工作流
const result = await engine.execute(dag.id, {});
console.log('Workflow completed:', result.status);
API 参考
WorkflowEngine
构造函数
new WorkflowEngine(config)
参数:
config.checkpointDir- 检查点目录(默认:'./checkpoints')config.enableCheckpoint- 启用检查点(默认:true)config.maxConcurrency- 最大并发数(默认:10)
createSequentialWorkflow(name, tasks)
创建顺序工作流
const dag = engine.createSequentialWorkflow('Test', [
{ name: 'Task 1', execute: async () => {} },
{ name: 'Task 2', execute: async () => {} }
]);
execute(workflowId, context)
执行工作流
const result = await engine.execute('workflow-id', {
input: 'data'
});
// 返回: { executionId, status, context, results, duration }
WorkflowDAG
addNode(config)
添加节点
dag.addNode({
id: 'task1',
type: 'task', // 'task' | 'condition' | 'parallel' | 'start' | 'end'
name: 'Task 1',
execute: async (context) => { return { result: 'done' }; },
retry: { count: 3, delay: 1000 },
timeout: 30000
});
addEdge(fromId, toId)
添加边(依赖关系)
dag.addEdge('start', 'task1');
dag.addEdge('task1', 'task2');
topologicalSort()
拓扑排序
const order = dag.topologicalSort();
// 返回: ['start', 'task1', 'task2', 'end']
WorkflowNode
节点类型
start- 开始节点end- 结束节点task- 任务节点condition- 条件节点parallel- 并行节点
节点配置
{
id: 'unique-id',
type: 'task',
name: 'Task Name',
description: 'Task description',
execute: async (context) => { /* 执行逻辑 */ },
retry: { count: 3, delay: 1000 },
timeout: 30000,
metadata: {}
}
示例
条件分支
import WorkflowDAG, { WorkflowNode } from './src/dag.js';
const dag = new WorkflowDAG({ name: 'Conditional' });
dag.addNode({ id: 'start', type: 'start' });
dag.addNode({
id: 'check',
type: 'condition',
condition: (ctx) => ctx.value > 10,
branches: { 'true': 'high', 'false': 'low' }
});
dag.addNode({
id: 'high',
type: 'task',
execute: async () => console.log('High value')
});
dag.addNode({
id: 'low',
type: 'task',
execute: async () => console.log('Low value')
});
dag.addEdge('start', 'check');
dag.addEdge('check', 'high');
dag.addEdge('check', 'low');
并行执行
dag.addNode({ id: 'start', type: 'start' });
dag.addNode({
id: 'parallel',
type: 'parallel',
parallelTasks: ['taskA', 'taskB', 'taskC']
});
dag.addNode({ id: 'taskA', type: 'task', execute: async () => {} });
dag.addNode({ id: 'taskB', type: 'task', execute: async () => {} });
dag.addNode({ id: 'taskC', type: 'task', execute: async () => {} });
dag.addNode({ id: 'merge', type: 'task', execute: async () => {} });
dag.addEdge('start', 'parallel');
dag.addEdge('parallel', 'taskA');
dag.addEdge('parallel', 'taskB');
dag.addEdge('parallel', 'taskC');
dag.addEdge('taskA', 'merge');
dag.addEdge('taskB', 'merge');
dag.addEdge('taskC', 'merge');
事件
engine.on('execution-started', (e) => {
console.log('Started:', e.executionId);
});
engine.on('execution-completed', (e) => {
console.log('Completed:', e.executionId, e.state.status);
});
engine.on('node-started', (e) => {
console.log('Node started:', e.nodeId);
});
engine.on('node-completed', (e) => {
console.log('Node completed:', e.nodeId);
});
测试
npm test
License
MIT
Usage Guidance
This skill appears coherent with its stated purpose, but review these points before installing: (1) It will run Node code (task 'execute' functions) you register — those functions run with the same privileges as the Node process, so do not run untrusted workflows. (2) It writes checkpoint files to the configured checkpointDir (default './checkpoints'); ensure that path is acceptable and not pointed at sensitive locations. (3) Package.json has no dependencies, but you should still run npm install and inspect package files locally in an isolated environment first. (4) If you plan to import workflows from others, audit the task code for filesystem, network, or process access. (5) For increased safety, run examples/tests in a sandbox or container and avoid running on production hosts until you’re comfortable with behavior.
Capability Analysis
Type: OpenClaw Skill
Name: yuyonghao-workflow-engine
Version: 0.1.0
The skill bundle provides a legitimate Directed Acyclic Graph (DAG) workflow engine for OpenClaw. The code in src/dag.js, src/executor.js, and src/workflow-engine.js implements standard workflow orchestration features such as sequential/parallel execution, condition branching, retries, and state persistence via checkpoints. No evidence of data exfiltration, malicious command execution, or prompt injection was found; the file system access is restricted to managing workflow state in a local checkpoint directory.
Capability Assessment
Purpose & Capability
Name/description match the included source and examples. The repo provides a DAG implementation, executor, engine API, examples, tests, and checkpoint files — all expected for a workflow engine. No unrelated environment variables, binaries, or external service credentials are requested.
Instruction Scope
SKILL.md and examples instruct running npm and importing the local source; runtime behavior stays within the stated domain. Important: the engine executes task functions you provide (node.execute / parallel tasks), which run arbitrary JavaScript in the host Node process. The engine also reads/writes checkpoint files (default './checkpoints'). Users should be aware that tasks can access the filesystem and process environment at the same privilege level as the Node process.
Install Mechanism
No install spec in registry; SKILL.md suggests running 'npm install' but package.json lists no external dependencies. No downloads from untrusted URLs or extract operations are present. Running npm in this package is low-risk, but standard precautions apply (review package.json — it has no dependencies).
Credentials
The skill requests no environment variables, credentials, or config paths. Its file I/O is limited to a checkpoint directory (configurable), which aligns with its stated persistence feature.
Persistence & Privilege
always:false and no system-wide modifications are requested. The engine persists execution state to disk (checkpoint files in checkpointDir). This persistence is expected for checkpoint/resume semantics but means the skill will write files to the host filesystem where it runs.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install yuyonghao-workflow-engine - After installation, invoke the skill by name or use
/yuyonghao-workflow-engine - Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.0
Initial public release of Workflow Engine (OpenClaw 工作流编排引擎):
- Provides a DAG-based workflow execution engine with if/else branching and parallel task execution.
- Supports node types: start, end, task, condition, and parallel.
- Includes checkpointing for workflow state persistence and supports resuming execution.
- Features an event-driven system for workflow and node lifecycle events.
- Offers a simple API for defining, executing, and managing workflows, including sequential, conditional, and parallel flows.
- Includes examples and instructions for installation and testing.
Metadata
Frequently Asked Questions
What is Workflow Engine?
DAG-based workflow engine supporting sequential, conditional, and parallel tasks with checkpoint persistence and event-driven execution. It is an AI Agent Skill for Claude Code / OpenClaw, with 187 downloads so far.
How do I install Workflow Engine?
Run "/install yuyonghao-workflow-engine" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Workflow Engine free?
Yes, Workflow Engine is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Workflow Engine support?
Workflow Engine is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Workflow Engine?
It is built and maintained by yuyonghao-123 (@yuyonghao-123); the current version is v0.1.0.
More Skills