Skip to content

Chapter 13 — Workflow Optimization

You've done every task in the pipeline by now. This chapter is about doing them efficiently — burning less budget, hitting fewer rate limits, juggling more workflows in parallel without dropping any, and choosing what's worth iterating on vs. accepting.

Chapter at a glance

flowchart TD
    A[Workflow you've<br/>already shipped] --> B[Cost<br/>levers]
    A --> C[Speed<br/>levers]
    A --> D[Quality<br/>levers]
    A --> E[Parallel<br/>workflows]
    A --> F[Settings +<br/>API keys]

Levers for doing the same work cheaper, faster, or at higher polish.

What you'll learn

  • Automating generation with the Generation Runner agent — the headless executor that does what manual runs do, but all in one command
  • Cost awareness — per-image and per-clip generation costs, where budget goes, how to spot when you're being wasteful
  • The mode=images validation pass — cheap way to check prompts before burning Veo budget
  • B-roll density's impact on cost — and when High density isn't worth it
  • Pipeline limits — concurrency caps (3 default, 5 max), rate limits, R2 storage / bandwidth, PatchWork file size limits
  • Working with multiple workflows in parallel — juggling brands × workflows × variants without losing state
  • The master tracker as your north star for "what's where" across many workflows
  • Speed levers — concurrency tuning, reference image reuse, when to skip aggressive regen attempts
  • Quality levers — when to invest in higher iteration counts, per-scene targeting, choosing what to accept

Before this chapter

You should have done every task in chapters 2-11 at least once. Optimization makes sense after you've felt the friction of doing things the slow / expensive way.

Sections

  1. Automating with the Generation Runner — the headless executor that replaces manual workflow runs
  2. Cost awareness — where budget goes, strategies for cheaper passes
  3. Pipeline limits — concurrency, Veo clip length, file size, rate limits
  4. Working with multiple workflows in parallel — juggling brands × workflows × variants
  5. Speed levers — concurrency tuning, reference reuse, targeted reruns
  6. Quality levers — when to invest in polish, when to accept good-enough
  7. Settings & API keys — PatchWork's API panel, direct Google API path, session cost tracking

Try this

Run an A/B test on the same workflow at two different concurrency settings and observe the cost / speed trade.

Steps:

  1. Pick a workflow at V1+ that you can run twice without consequence. Confirm Session Cost is enabled in PatchWork's Settings (Settings & API Keys)
  2. Pass A: ask Claude to run via the Generation Runner at concurrency 3 (Automating with the Generation Runner). Note wall-clock time and Session Cost
  3. Pass B: re-run via the Generation Runner at concurrency 5. Note wall-clock time and Session Cost
  4. Compare. Concurrency 5 should be faster but may hit pipeline limits or rate caps (Pipeline limits)
  5. (Optional) For a budget-only pass, try mode=images to skip Veo and only validate image prompts. The cost delta is enormous (Cost awareness)

If you hit:

  • Pass B hits rate limits / fails partway through → concurrency 5 was too high for the current state. Drop to 3 or 4 (Pipeline limits)
  • Session Cost not updating → check the Settings panel for Session Cost. It's per-session, not persistent across reloads
  • You want to scale this workflow to 50+ variants → consider Chapter 3 — Driving Variants from a Sheet (covers the same Sheets integration for batch generation)
  • Juggling 3 workflows simultaneously and losing track → see Multiple workflows in parallel for the master tracker pattern
  • You're investing in polish that doesn't move the needle → re-read Quality levers. Targeted investment beats universal polish

When you're ready

Next: Chapter 14 — Troubleshooting. The final chapter — what to do when something breaks. Reference material, not necessarily linear reading.