Course 2 — Module 3
Chaining Workflows — Multi-Step Agents
Estimated read time: 8 minutes
🎧 Listen to this module:
Module 2 covered how to schedule a single Claude task. This module covers how to chain multiple steps together — where the output of one step becomes the input of the next. That is the jump from Level 3 to Level 4.
What Chaining Means
A chained workflow is a series of tasks that run in sequence, with each step building on the output of the previous one. Like a relay race: one agent runs its leg, passes the baton to the next, and so on.
Individually, each step is simple. Together, they produce something much more valuable than any single step could.
A Full Example: Weekly Business Digest Pipeline
Here is a real four-step chained workflow for an Amazon seller:
Step 1: Data Fetch
Query the Amazon MCP for: last 7 days of orders, current inventory levels, last 7 days of ad spend and ACoS by campaign.
Output: raw data saved to /analysis/weekly-raw-[date].json
Step 2: Analysis
Read the raw data file. Calculate week-over-week revenue change. Identify top 3 and bottom 3 SKUs by revenue. Flag any ASIN with ACoS over 35%. Flag any ASIN with less than 30 days of inventory cover.
Output: analysis saved to /analysis/weekly-analysis-[date].md
Step 3: Narrative
Read the analysis file. Write a 200-word plain-English summary: overall performance, what improved, what needs attention, top 3 actions for the week.
Output: narrative saved to /analysis/weekly-digest-[date].md
Step 4: Delivery
Post the narrative to Slack #amazon-business. Include a note that the full analysis is saved in /analysis.
Output: Slack message delivered
Each step is a separate Claude task. Step 2 depends on Step 1’s output. Step 3 depends on Step 2’s output. Step 4 depends on Step 3’s output.
This is a Level 4 pipeline. The whole thing runs on a schedule — every Sunday night — without any manual input.
When to Chain vs. When to Keep It Simple
Not every workflow needs to be chained. Use a single task (Level 3) when:
- The job can be done in one step: “fetch and summarize”
- The output is simple enough that one agent can handle the full task
- You are just starting out and want to get something working before adding complexity
Use a chained workflow (Level 4) when:
- The task is complex enough that different steps require different approaches
- You want a detailed intermediate file (the full analysis) AND a summary (the digest)
- You need the raw data preserved for later reference, separate from the analysis
- The pipeline has a clear handoff structure where each step has a distinct role
A good rule: start with a single-step workflow. If you find you always want more detail than the summary provides, split it into fetch + analyze + summarize.
How to Define a Chained Workflow
In Claude Code, you define a chained workflow as a sequence of scheduled tasks where each step is explicitly told to read from the previous step’s output file.
The key is making each step’s output deterministic and predictable — save to a file with a clear, consistent name, and the next step reads from that exact file.
Example of how to write the Step 2 prompt (referencing Step 1’s output):
"Read the file at analysis/weekly-raw-[today's date].json.
This is raw data from my Amazon account covering the past 7 days.
Perform the following analysis: [analysis instructions].
Save the results to analysis/weekly-analysis-[today's date].md."
Claude Code supports dynamic date insertion — so you do not have to manually update the filename every week. Use [today's date] or [YYYY-MM-DD] in your prompt and Claude will substitute the actual date at runtime.
The Two Most Useful Amazon Pipelines to Build
You do not need to build complex chains on day one. Start with one of these two:
Pipeline 1: Fetch + Summarize (2 steps)
Step 1 queries live Amazon data and saves it. Step 2 reads that file and writes a clean summary. Schedule to run weekly.
Pipeline 2: Fetch + Analyze + Deliver (3 steps)
Step 1 queries data. Step 2 runs the analysis and flags issues. Step 3 formats the findings and posts to Slack. Schedule to run weekly.
Module 6 covers the full use cases you can build these into. The capstone puts one into production.