Execute multi-agent workflows defined in Markdown with Mermaid flowcharts
This skill provides detailed guidance for executing Mermaid-based multi-agent workflows.
Use this skill when you need to:
A workflow file contains three sections:
---
id: "workflow-id"
name: "Workflow Name"
entrypoint: "start_node"
state:
input: ""
result: null
config:
timeout: 300000
maxIterations: 50
---
flowchart TD
start[Start] --> process[Process]
process -->|success| end_node[End]
process -->|retry| start
### node_id
---
description: "What this node does"
mode: subagent
model: anthropic/claude-sonnet-4-20250514
tools:
read: true
input:
data: "{{state.input}}"
output:
key: "result_key"
---
Agent prompt content here...
Use {{state.variable}} for template variables.
### node_id sectionFrom the Mermaid flowchart, understand:
[] vs Human {{}})state = {
// Copy from frontmatter.state
...initialState,
// Internal tracking
_workflow_id: id,
_current_node: entrypoint,
_completed_nodes: [],
_pending_parallel: [],
_iteration_count: 0
}
For each node:
Agent Node ([name]):
state[output.key] = result_completed_nodesHuman Node ({{name}}):
state[output.key] = user_choice_completed_nodes| Scenario | Detection | Action |
|---|---|---|
| Sequential | One unlabeled outgoing edge | Execute target |
| Parallel | Multiple unlabeled outgoing edges | Execute ALL targets together |
| Conditional | Labeled outgoing edges | Match output to label |
| Merge | Multiple incoming edges | Wait for all upstream |
| Loop | Edge to earlier node | Check iteration count |
| End | No outgoing edges | Complete workflow |
When parallel:
_pending_parallel_completed_nodesdefault label if exists_iteration_countmaxIterations| Syntax | Meaning |
|---|---|
{{state.key}} |
Value from state |
{{state.a.b}} |
Nested state value |
{{output}} |
Previous node output |
{{nodes.id.output}} |
Specific node output |
onError handlermaxIterations