Skip to main content

๐Ÿ”„ Workflow Engine

๐Ÿ‘ค Who it's for: Developers / integrators
โฑ๏ธ Read time: ~6 minutes
๐Ÿ’ก In one line: Tasks have a complete lifecycle from plan to execution โ€” every step is traceable.

YingClaw has a built-in workflow engine that ensures task execution is structured, traceable, and recoverable, preventing complex tasks from losing direction mid-way.


Task Lifecycleโ€‹

Every task progresses through four explicit phases from creation to completion:

StatusMeaningTrigger Condition
pendingAwaiting executionTask just created
in_progressExecutingAgent begins processing
completedDoneAll steps executed successfully
cancelledCancelledUser terminated or execution failed irrecoverably

Core Toolsโ€‹

todo โ€” Task Listโ€‹

Create and manage step-by-step task plans:

{
"merge": false,
"todos": [
{ "id": "step-1", "content": "Analyze project structure", "status": "pending" },
{ "id": "step-2", "content": "Identify performance bottlenecks", "status": "pending" },
{ "id": "step-3", "content": "Execute optimizations", "status": "pending" },
{ "id": "step-4", "content": "Verify results", "status": "pending" }
]
}

Use merge: true to incrementally update existing tasks without resubmitting the full list.

delegate โ€” Dispatchโ€‹

Delegate specific steps to sub-agents:

{
"prompt": "Analyze type safety issues in all TypeScript files under src/",
"agents": [
{ "name": "ts-checker", "role": "TypeScript type-checking expert" }
]
}

assess_workload โ€” Workload Assessmentโ€‹

Evaluate project scale before execution to prevent context overflow:

{}

Automatically scans file count, total size, code complexity, and other metrics.


Four Phases in Detailโ€‹

Phase 1: Requirement Clarificationโ€‹

  • Confirm task objectives, scope, and success criteria
  • Identify potential ambiguities and constraints
  • Align with the user on expected deliverables

Phase 2: Project Assessmentโ€‹

  • Call assess_workload to scan the project
  • Count files, total size, complexity
  • Determine if task splitting is needed to prevent context overflow

Phase 3: Plan Confirmationโ€‹

  • Use todo to create a step-by-step plan
  • Each step has a unique ID and clear description
  • Present the plan to the user and wait for confirmation

Phase 4: Executionโ€‹

  • Use delegate to dispatch steps sequentially
  • Auto-update todo status after each step completes
  • Support parallel execution of independent steps

Error Handlingโ€‹

SituationStrategy
Single step failureAuto-mark as cancelled, record error cause
Partial failureKeep completed steps, re-plan failed ones
Total failureSuggest narrowing scope or adjusting strategy, then retry
User interruptionMark all in-progress tasks as cancelled

Parallel Executionโ€‹

For independent subtasks, pass an agents array for parallel execution:

{
"prompt": "Simultaneously check frontend and backend code quality",
"agents": [
{ "name": "frontend-checker", "role": "Check React component code" },
{ "name": "backend-checker", "role": "Check API route code" }
]
}

Both agents execute simultaneously; results are aggregated before returning.


Cost Controlโ€‹

MechanismDescription
Independent contextEach sub-agent has its own context window, no interference
Iteration limitsmax_iterations limits tool calls per agent
Auto-terminationAuto-terminate when limit is reached, returning existing results

Next Stepsโ€‹

Learn about YingClaw's multi-channel connectivity:

๐Ÿ‘‰ Channels โ†’