⚡
Stage 5 · Lesson 3 of 5

Building Your First Workflow

End-to-end: folder structure, subagent prompts, orchestrator, route command, first run.

~30 min read9 walkthrough steps

Time to build a complete production workflow from scratch. We'll build a lead finder — a multi-agent pipeline that researches potential clients, qualifies them, and generates outreach drafts. This is a real workflow that generates real business value, and it uses everything you've learned.

The folder structure first: projects/lead-finder/ with orchestrator.md and subagents/ containing three files: researcher.md, qualifier.md, and outreach-writer.md. Three specialists, one coordinator.

Researcher (Tier 1 - Haiku): searches the web for potential leads based on criteria you define. Industry, company size, technology stack, geographic region. Returns structured data: company name, website, key contacts, relevant signals. Boundaries: research only, no qualification judgments, no outreach writing.

Qualifier (Tier 2 - Sonnet): takes the researcher's output and evaluates each lead against your ideal customer profile. Scores on fit (1-10), identifies specific pain points your service addresses, and flags any red flags. Boundaries: qualification only, no outreach writing, no modification of research data.

Outreach Writer (Tier 2 - Sonnet): takes qualified leads (score 7+) and generates personalized outreach messages. References specific pain points from the qualifier's analysis. Uses your defined voice and messaging framework. Boundaries: writing only, no new research, no qualification changes.

Orchestrator: "Step 1: Send search criteria to researcher. Step 2: Send research to qualifier. Step 3: Filter to leads scoring 7+. Step 4: Send qualified leads to outreach writer. Step 5: Compile final report: all leads, qualification scores, and outreach drafts for approved leads."

Route command: "When I say 'route leads', trigger the lead-finder orchestrator." You say "route leads: find SaaS companies in Vancouver with 10-50 employees" and the pipeline runs autonomously.

Walkthrough

  1. 1
    Create the project folder: mkdir -p projects/lead-finder/subagents
  2. 2
    Create subagents/researcher.md with: Role (web research specialist), Boundaries (research only), Output Format (structured lead data), Tools (web search), Model (haiku)
  3. 3
    Create subagents/qualifier.md with: Role (lead qualification analyst), Boundaries (scoring only), Output Format (scored leads with analysis), Tools (file read), Model (sonnet)
  4. 4
    Create subagents/outreach-writer.md with: Role (personalized outreach writer), Boundaries (writing only), Output Format (ready-to-send messages), Tools (file write), Model (sonnet)
  5. 5
    Create orchestrator.md with: the 5-step workflow, error handling (flag incomplete research for retry), compilation rules (final report structure)
  6. 6
    Add to agents.md: 'When I say route leads, hand off to projects/lead-finder/orchestrator.md'
  7. 7
    Run the workflow: 'route leads: find [your target criteria]'
  8. 8
    Review the output: check research quality, qualification accuracy, and outreach personalization
  9. 9
    Iterate: adjust subagent prompts based on what you observe in the first run

Checkpoint

You have a complete, working lead-finder pipeline with three subagents and an orchestrator. The route command triggers the full workflow. You've run it at least once and reviewed the output quality.