Use stable IDs
Keep task/agent IDs predictable and lowercase snake_case for maintainability.
This guide focuses on authoring Agent/Task workflows (kind: agent_workflow) from YAML or JSON.
Use this format when you want a higher-level authoring model and let PetalFlow compile it into Graph IR.
The authoritative schema contracts are published in the PetalFlow repository:
Raw URLs for editor tooling:
Agent/Task workflows require these fields:
| Field | Type | Notes |
|---|---|---|
version | string | Your workflow/business version |
schema_version | string | SemVer schema contract (MAJOR.MINOR.PATCH) |
kind | string | agent_workflow (canonical), agent-workflow accepted for compatibility |
id | string | Workflow identifier |
name | string | Human-readable name |
agents | object | Map of agent IDs to agent definitions |
tasks | object | Map of task IDs to task definitions |
execution | object | Strategy and execution wiring |
version: "1.0"schema_version: "1.0.0"kind: agent_workflowid: release_notes_flowname: Release Notes Flow
agents: researcher: role: Research Analyst goal: Gather release context provider: anthropic model: claude-sonnet-4-20250514
writer: role: Technical Writer goal: Draft concise release notes provider: anthropic model: claude-sonnet-4-20250514
tasks: gather_changes: description: Summarize major changes for {{input.version}} from provided changelog text. agent: researcher expected_output: Structured bullet summary
draft_notes: description: Write final release notes using {{tasks.gather_changes.output}}. agent: writer expected_output: Final release notes markdown
execution: strategy: sequential task_order: - gather_changes - draft_notes{ "version": "1.0", "schema_version": "1.0.0", "kind": "agent_workflow", "id": "release_notes_flow", "name": "Release Notes Flow", "agents": { "researcher": { "role": "Research Analyst", "goal": "Gather release context", "provider": "anthropic", "model": "claude-sonnet-4-20250514" }, "writer": { "role": "Technical Writer", "goal": "Draft concise release notes", "provider": "anthropic", "model": "claude-sonnet-4-20250514" } }, "tasks": { "gather_changes": { "description": "Summarize major changes for {{input.version}} from provided changelog text.", "agent": "researcher", "expected_output": "Structured bullet summary" }, "draft_notes": { "description": "Write final release notes using {{tasks.gather_changes.output}}.", "agent": "writer", "expected_output": "Final release notes markdown" } }, "execution": { "strategy": "sequential", "task_order": ["gather_changes", "draft_notes"] }}Each agent requires:
rolegoalprovidermodelOptional agent fields:
backstorytools (array of tool references)tool_config (per-tool config overrides)config (provider/model settings, such as temperature/max tokens)Each task requires:
descriptionagent (must reference an existing agent ID)expected_outputOptional task fields:
output_keyinputsreview (human enables human gate in compiled flow)context (task IDs providing additional context)description / inputs)Use these references in task templates:
{{input.field}} for runtime input vars{{tasks.other_task.output}} for prior task outputsExample:
tasks: summarize: description: Summarize {{input.topic}} with context {{tasks.research.output}}. agent: writer expected_output: Concise summarySupported values for execution.strategy:
sequentialparallelhierarchicalcustomRequires execution.task_order including all task IDs.
execution: strategy: sequential task_order: [research, write, review]Tasks execute as parallel branches and are merged by compiler/runtime behavior.
execution: strategy: parallel merge_strategy: concatRequires manager_agent.
execution: strategy: hierarchical manager_agent: coordinatorDeclare dependencies with execution.tasks.<task>.depends_on.
execution: strategy: custom tasks: draft: depends_on: [research] qa: depends_on: [draft] condition: tasks.draft.output.confidence > 0.8# 1) Validatepetalflow validate workflow.agent.yaml
# 2) Compilepetalflow compile workflow.agent.yaml --output workflow.graph.json
# 3) Runpetalflow run workflow.graph.json --input '{"topic":"workflow automation"}'Frequent errors include:
AT-010)AT-001)AT-005)task_order in sequential mode (AT-006)AT-007)AT-008)AT-014)Use stable IDs
Keep task/agent IDs predictable and lowercase snake_case for maintainability.
Pin schema_version
Set schema_version explicitly in all workflows and update intentionally.
Compile in CI
Run validate and compile in CI before deployment to catch schema drift early.
Prefer YAML for editing
Use YAML for authoring comfort, JSON for generated/serialized artifacts.