Build & Deploy AI Agents

Lesson 3

Module 3: Workflows

A durable, crash-proof pipeline: specialists, risk tiers, coordinator.

Module 3 is where REVIEWBOT becomes more than a single model call. A workflow turns review into a durable, multi-step pipeline.

Why a Workflow

ReviewWorkflow extends WorkflowEntrypoint. Every step.do() is checkpointed. If the workflow crashes after step 2, it resumes at step 3 without re-running the earlier model calls, and each step retries automatically. That durability matters when steps cost time and tokens.

Risk tiers

Not every PR deserves the same scrutiny. assessRisk looks at the diff (how many lines, how many files, whether it touches security-sensitive paths like auth, token, or secret) and returns a tier:

  • trivial: quality only
  • lite: quality + docs
  • full: security + quality + docs

Do not send the dream team to review a typo fix.

Specialists in parallel

The chosen specialists run concurrently with Promise.all, each as its own checkpointed step.do(). Each specialist is a focused prompt that returns structured findings for its domain.

Coordinator and write-back

A coordinator pass dedupes the combined findings and decides the verdict. The workflow writes the result back to the ReviewAgent state, which broadcasts to the UI. One easy mistake: you must re-export ReviewWorkflow from server.ts, or Cloudflare silently never runs it.

When you are ready, open the Workflows exercise to build it.