AI Agent Workflows: How to Chain Agents Into Multi-Step Business Automations
📢
← Back to Blog

AI Agent Workflows: How to Chain Agents Into Multi-Step Business Automations

John Aspinall · · 14 min read

Most operators who get serious about AI hit the same wall. You've built a handful of useful agents — one that writes listing copy, one that pulls data from your API, one that generates images. They each do their job. But your actual business processes aren't single steps. They're chains: pull the data, analyse it, draft content based on the analysis, quality-check the draft, then deploy. And right now you're the middleware. You copy output from one agent, paste it into the next, babysit the handoff, and repeat. That's not automation. That's you doing data entry with extra steps.

AI agent workflows fix this. Instead of building isolated agents, you chain them into multi-step pipelines where each agent's output feeds the next agent's input — automatically, with error handling, with no human copying and pasting in between.

I run about 30 automations across four ventures now, and the ones that actually save me time aren't single-agent tools. They're workflows — three, four, five agents chained together, handling a complete business process from trigger to deliverable. Here's how I build them, the patterns that work, and the mistakes that cost me weeks before I figured them out.

What Are AI Agent Workflows?

An AI agent workflow is a multi-step automation where two or more AI agents execute in sequence (or in parallel), with structured data flowing between them. Each agent handles one well-defined task. The output of one step becomes the input context for the next. The whole chain runs with a single trigger — a cron job, a webhook, a manual kick — and produces a finished deliverable without human intervention between steps.

Think of it like an assembly line. One station doesn't build the whole car. Each station does its job, passes the work down the line, and the final product rolls off the end. AI agent workflows work the same way, except the "stations" are language model calls with specific instructions, tools, and context for their piece of the process.

Why Single-Agent Automations Hit a Wall

When I started building AI automations, every one was monolithic. One giant prompt, one agent, one pass. "Here's a product, write the full listing: title, bullets, description, A+ content, backend keywords." It sort of worked. But the output quality was mediocre across the board because the agent was trying to do too many things in one context window.

Three problems kept showing up.

Context window dilution. The more tasks you pack into a single prompt, the worse each individual output gets. An agent asked to research, analyse, draft, and format in one pass spreads its attention too thin. Each of those tasks deserves focused context.

No intermediate validation. With a single-agent approach, you get the final output and either accept it or reject it. There's no checkpoint after the research step to verify the data before the agent starts drafting. Bad data at step one poisons everything downstream, and you don't catch it until the end.

Debugging is a nightmare. When a monolithic agent produces garbage, you can't tell which part of the process failed. Was the research wrong? Was the analysis sound but the draft bad? Was the formatting step what mangled it? With a multi-step workflow, each step has its own input and output. You can inspect the handoff at every stage and find exactly where things went sideways.

The Anatomy of a Multi-Step Agent Workflow

Every AI agent workflow I build has four components:

1. Trigger — what kicks the workflow off. A cron schedule (every morning at 7am), a webhook (new order received), a file appearing in a directory, or a manual command. The trigger passes initial context to step one.

2. Steps — the individual agent calls, each with its own system prompt, tools, and expected output format. Each step is a focused task: "extract key metrics from this API data" or "draft five bullet points from this competitive analysis." Steps can run sequentially or in parallel.

3. Handoff contracts — the structured format each step outputs so the next step can parse it reliably. This is the most important piece people skip. If step one returns free-form prose and step two expects structured JSON, the handoff breaks. Every step needs an explicit output schema.

4. Error handling — what happens when a step fails, times out, or produces output that doesn't match the contract. Retry? Skip? Alert? Default to a safe fallback? This is what separates a demo from production.

Five AI Agent Workflow Patterns That Actually Work

After building dozens of these, I've settled on five patterns that cover almost every business use case.

Pattern 1: Sequential Pipeline

Step A → Step B → Step C → Output.

The most common pattern. Each step depends on the previous step's output. My daily briefing automation uses this: fetch news (step 1) → filter and rank by relevance (step 2) → write summaries (step 3) → format into email HTML (step 4) → send. Total cost: about 15 cents per run.

Use this when the process is linear and each step needs the previous step's full output.

Pattern 2: Fan-Out / Fan-In

Step A produces a list → Steps B1, B2, B3 run in parallel (one per item) → Step C aggregates results.

This is how I handle bulk content generation. Step A pulls 20 ASINs that need updated bullets. Steps B1-B20 each draft bullets for one ASIN, running in parallel. Step C collects all 20 drafts, runs a consistency check, and outputs the batch. What would take 40 minutes sequentially finishes in under 3 minutes.

Use this when you need to process a list of items independently, then combine the results.

Pattern 3: Conditional Branching

Step A classifies the input → routes to Step B (path 1) OR Step C (path 2) based on the classification.

My client inquiry workflow uses this. Step A reads an incoming email and classifies it: new lead, existing client request, or support issue. New leads go to the onboarding pipeline. Client requests go to the task extraction pipeline. Support issues go to the troubleshooting pipeline. Each branch is its own workflow with different agents and different tools.

Use this when the next step depends on the nature of the input, not just its content.

Pattern 4: Validation Loop

Step A produces output → Step B evaluates it against criteria → if it passes, output; if it fails, feed the evaluation back to Step A with specific feedback → repeat up to N times.

This is the pattern that improved my output quality the most. My listing copy workflow doesn't just generate bullets and move on. It generates, then sends the draft to a separate "editor" agent that checks against style guidelines, keyword density, character limits, and compliance rules. If the draft fails any check, it goes back to the writer with specific feedback: "bullet 3 exceeds 200 characters, bullet 5 is missing the primary keyword." The writer revises and resubmits. I cap it at three rounds — if it hasn't passed by then, it gets flagged for human review.

Use this when output quality matters and you can define clear pass/fail criteria.

Pattern 5: Enrichment Pipeline

Step A produces a base artifact → Steps B, C, D each add a different layer of enrichment → Step E merges everything into the final output.

My product research workflow works this way. Step A creates a basic product profile from the ASIN. Step B enriches it with competitor pricing data. Step C adds review sentiment analysis. Step D pulls search volume and keyword data. Step E synthesises everything into a strategic brief. Each enrichment step is independent — they can run in parallel and they each add their own data layer to the base artifact.

Use this when the final output needs data from multiple sources that can be gathered independently.

How I Build AI Agent Workflows in Practice

My stack for agent workflows is straightforward: Claude Code with skill files, shell scripts for orchestration, and JSON for handoff contracts between steps. No framework, no LangChain, no custom infrastructure. Here's what a real workflow looks like.

My meeting-to-action workflow chains four agents:

# Step 1: Extract transcript from Fathom
transcript=$(claude -p "Extract the full transcript for the most recent
meeting with $CLIENT_NAME. Return only the transcript text." \
  --allowedTools mcp__fathom__list_meetings,mcp__fathom__get_meeting_transcript)

# Step 2: Extract structured action items
actions=$(echo "$transcript" | claude -p "Extract every action item from
this transcript. For each, return: {task, owner, deadline, priority}.
Output as a JSON array. No commentary." --output-format json)

# Step 3: Create tasks in Todoist
echo "$actions" | claude -p "Create a Todoist task for each action item
in this JSON array. Use the owner as the assignee label. Set due dates
from the deadline field. Add to the $CLIENT_NAME project." \
  --allowedTools mcp__todoist__create_task

# Step 4: Draft follow-up email
echo "$actions" | claude -p "Draft a follow-up email to $CLIENT_EMAIL
summarising these action items. Professional but warm tone. Include
deadlines. Subject line: Action items from our call."

Four agents, each focused on one task, structured data flowing between them. The whole thing runs in under 90 seconds and replaces 20 minutes of manual post-meeting work. I trigger it right after every client call.

The key detail: step 2 forces JSON output. That gives step 3 structured data it can parse, not prose it has to interpret. Every handoff has a defined format. That's what makes the chain reliable.

Handoff Contracts: The Part Everyone Skips

The number one reason AI agent workflows break is sloppy handoffs. Agent A returns prose when Agent B expects JSON. Agent B returns a flat list when Agent C expects nested objects. The chain fails silently — no error, just bad output.

Every step in my workflows has an explicit output contract. I enforce this in the prompt:

Output format — strict, no exceptions:
{
  "items": [
    {
      "asin": "string (10 chars)",
      "title": "string (max 200 chars)",
      "bullets": ["string (max 200 chars each, exactly 5)"],
      "status": "draft | review | approved"
    }
  ],
  "metadata": {
    "total_count": "integer",
    "generated_at": "ISO 8601 timestamp"
  }
}
Return ONLY this JSON. No markdown fencing, no commentary, no explanation.

I also validate between steps. Before step 3 consumes step 2's output, a simple jq command or a lightweight validation script checks that the JSON parses, the required fields exist, and the values make sense. If validation fails, the workflow halts and alerts me instead of feeding garbage downstream.

This takes five minutes to add per workflow and prevents the most common failure mode I see: agents producing structurally correct but semantically wrong output that the next agent happily processes into polished nonsense.

Error Handling That Keeps AI Agent Workflows Running

Production workflows fail. APIs time out, rate limits kick in, models hallucinate formats. The question isn't whether it'll fail — it's whether the failure is graceful.

My error handling stack has three layers:

Retry with backoff. API calls and model requests get three attempts with exponential backoff (2s, 4s, 8s). This handles transient failures — rate limits, network blips, temporary outages. About 80% of my workflow failures self-heal with retries.

Fallback defaults. If a step fails after retries, some workflows can continue with a safe default. My enrichment pipeline can skip the pricing data step and still produce a useful brief with the other enrichments. The output notes that pricing data is missing, but it doesn't block the whole workflow.

Alert and halt. For critical steps where there's no safe fallback, the workflow stops and sends me a notification with the step name, the error, and the input that caused it. I'd rather get alerted and fix it manually than have an agent push garbage to a client.

The ratio matters. About 80% of failures retry successfully, 15% fall back to defaults, and 5% halt and alert. If you're getting more than a few alerts per week, your workflow needs redesigning, not more error handling.

Common Mistakes in Multi-Step AI Agent Workflows

Over-engineering the chain. Your first instinct will be to build a 10-step workflow. Don't. Start with 2-3 steps. Add steps only when you've proven the handoffs work. I've refactored several 7-step workflows back down to 4 steps after realising I was splitting tasks that one focused agent could handle fine.

No intermediate logging. When a 5-step workflow produces bad output, you need to see what each step returned. Log every handoff to a file. It takes five seconds to add and saves hours of debugging. I write every intermediate output to ~/.agent-logs/[workflow]/[step]-[timestamp].json.

Treating the chain as a single prompt. Each step should be independently testable. If you can't run step 3 by itself with sample input and verify its output, your step is too coupled to the chain. I test each step in isolation before I wire them together.

Skipping the validation loop. Straight pipelines without quality gates produce inconsistent output. Adding one additional model call to check the output catches 90% of quality issues before they reach a client or a public listing. Pattern 4 is worth the extra few cents per run.

Hardcoding model names. When I built my first workflows, I hardcoded model names everywhere. Then a new model dropped and I had to update 30 scripts. Now every workflow reads the model from an environment variable. One change, all workflows update.

FAQ

How many steps should an AI agent workflow have? Start with 2-3 steps and add complexity only when the output demands it. Most of my production workflows run 3-5 steps. If you're past 7 steps, look for steps you can combine or run in parallel.

What's the cost difference between single-agent and multi-step workflows? Multi-step AI agent workflows typically cost 2-4x more in API tokens than a single-agent approach because you're making multiple model calls. But the output quality improvement usually justifies it. My listing copy workflow costs about $0.08 per listing with the validation loop vs. $0.03 without — and the validated version needs human editing about 70% less often.

Can I use different AI models for different steps in a workflow? Yes, and you should. I use larger models for steps that require judgment — analysis, strategy, quality evaluation. I use faster models for mechanical steps — data extraction, formatting, classification. This keeps costs down without sacrificing quality where it matters.

How do I handle workflows that need human approval mid-chain? Add a gate step that pauses the workflow and sends a notification with the current output. My client deliverable pipeline generates the content, then sends me a message with a preview and waits for approval before deploying. The workflow resumes when I give the thumbs-up.

What tools do I need to build AI agent workflows? You don't need a framework. A shell script, a CLI tool like Claude Code, and structured JSON for handoffs will get you further than any orchestration platform. I've tried LangChain, CrewAI, and custom frameworks — I always come back to shell scripts because they're transparent, debuggable, and I can read every line of what's happening.

Build Your First AI Agent Workflow This Week

Here are the three things to do right now:

1. Pick your highest-friction multi-step process. Look at your week. Where are you copying output from one tool and pasting it into another? Where are you the middleware between steps? That's your first AI agent workflow candidate.

2. Decompose it into 3 focused steps with explicit handoff contracts. Write down what each step takes as input, what it produces as output, and the exact format. If you can't define the handoff, you're not ready to chain the agents.

3. Build it as a shell script with intermediate logging. Wire the steps together, log every handoff, and run it 10 times. Check the logs at each stage. Fix the handoffs until the output is consistent. Then add error handling and put it on a schedule.

AI agent workflows are where the real operational leverage lives. Single agents save you minutes. Multi-step workflows save you hours — and they compound, because every workflow you build frees up time to build the next one. Stop being the middleware in your own business.

Put AI to work inside the business you already run.

The Aspi OS Bootcamp is a 4-week live build: second brain, Claude Code workflows, Codex execution — on your real business. Starts Mon, Aug 3 · $1,500 · 12 seats.

Explore the bootcamp →

Not ready? Get the free newsletter — the AI workflows I actually ship, when they're worth your inbox.