Level 8: Workflows — Briefing
Workflows orchestrate multiple LLM calls into complex pipelines. Instead of one large prompt: many small, specialized steps. You’ll learn how to build sequential workflows, stream progress to the frontend, implement custom agent loops, and deliberately break loops before they spin out of control.
Skill Tree
Section titled “Skill Tree”What You’ll Learn
Section titled “What You’ll Learn”- Workflows — chain multiple
generateTextcalls sequentially, where the output of Step N becomes the input of Step N+1 - Streaming to Frontend — stream workflow progress to the frontend in real time with
createDataStreamand Custom Data Parts - Custom Loop — build your own agent loops with full control over termination conditions, state tracking, and the messages array
- Breaking the Loop — prevent infinite loops with max iterations, timeout, cost guard, and quality checks
Why This Matters
Section titled “Why This Matters”In Level 3 you learned about agents that use tools autonomously. But what if a task doesn’t just need one tool, but an entire pipeline — first research, then summarize, then format? A single massive prompt quickly becomes unreliable. Workflows break complex tasks into specialized steps that you can test, debug, and optimize individually.
The concrete problem: You want to build a research pipeline that searches for sources, summarizes results, and produces a finished report. A single LLM call produces inconsistent results. With workflows you control each step separately — and when something goes wrong, you know exactly where.
Prerequisites
Section titled “Prerequisites”- Level 3: Agents & MCP — Tool Calling, Multi-Step Agents,
stopWhen(Challenge 3.1-3.3) - Level 7: Streaming — Custom Data Parts,
createDataStream,writeData,mergeIntoDataStream(Challenge 7.1) - TypeScript — async/await, while loops, AbortController
Project directory: Create a new folder
level-8-workflows/for the files in this level. You don’t need any new packages —ai,@ai-sdk/anthropicandzodfrom previous levels are sufficient.
Skip hint: You’re already building custom agent loops with your own termination conditions, streaming progress to the frontend, and have implemented timeout guards? Jump straight to the Boss Fight and build a multi-step research pipeline.
Challenges
Section titled “Challenges”Boss Fight
Section titled “Boss Fight”Build a Multi-Step Research Pipeline — a system that researches a topic (custom loop with tools), streams progress in real time, summarizes the results (workflow), and is protected with safeguards (max iterations, timeout, cost limit). You’ll combine all four building blocks of this level in one project.