Quick Start
1
Loop a task over a CSV
2
Same task, async entry point
How It Works
The workflow readsinput_file before the run loop begins and expands the loop task into one subtask per row.
Choose the Right Loop
Sync vs Async
Loop pre-expansion runs identically for
workflow.start() and await workflow.astart(). Prior to SDK versions from 2026-07-27 the async path ran the loop task once as an ordinary task and ignored input_file; prior to PR #5320 (2026-09-30) the async path also silently skipped a mid-workflow loop task with no input_file set — sync workflow() defaulted it to tasks.csv, async aworkflow() did not. Both start-task and mid-workflow loop-task fallbacks now match across sync and async. If you were using async workflows with task_type="loop" reached via next_tasks / condition, upgrade to pick up the fix.Common Patterns
Summarise a list of URLs
Loop then post-process each row
Best Practices
Omit input_file to default to tasks.csv
Omit input_file to default to tasks.csv
When
task_type="loop" and no input_file is set, the workflow reads tasks.csv from the working directory. This applies to both the start loop task and loop tasks reached mid-workflow via next_tasks / condition routing — in sync (workflow.start()) and async (workflow.astart()) engines equally. See the Sync vs Async note above for the version history.One row = one string — use JSON for structured fields
One row = one string — use JSON for structured fields
Each row is passed to
{input} as a single string. Put structured data in JSON inside the row and parse it in the agent instructions.Loop subtasks run sequentially by design
Loop subtasks run sequentially by design
Subtasks execute one after another. Use
AgentFlow.parallel when you want fan-out across rows.A single failing row doesn't abort the workflow
A single failing row doesn't abort the workflow
Other rows still run. Check per-subtask
TaskOutput to find which rows failed.Related
Workflow Loop
AgentFlow-level loops over a CSV as a pipeline step
Workflow Repeat
Repeat a step until a condition is met — no file needed

