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=imagesvalidation 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¶
- Automating with the Generation Runner — the headless executor that replaces manual workflow runs
- Cost awareness — where budget goes, strategies for cheaper passes
- Pipeline limits — concurrency, Veo clip length, file size, rate limits
- Working with multiple workflows in parallel — juggling brands × workflows × variants
- Speed levers — concurrency tuning, reference reuse, targeted reruns
- Quality levers — when to invest in polish, when to accept good-enough
- 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:
- Pick a workflow at V1+ that you can run twice without consequence. Confirm Session Cost is enabled in PatchWork's Settings (Settings & API Keys)
- 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
- Pass B: re-run via the Generation Runner at concurrency 5. Note wall-clock time and Session Cost
- Compare. Concurrency 5 should be faster but may hit pipeline limits or rate caps (Pipeline limits)
- (Optional) For a budget-only pass, try
mode=imagesto 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.