Skip to content
20 min read60 min build
Prerequisites:ch10-scheduling
What You Will Build

A ReviewQueue with a state machine that gates agent outputs behind human approval, rejection, and revision workflows

Why This Matters

Your scheduler from Chapter 10 runs every ready task automatically. That is fine for low-risk work — formatting code, updating imports, writing test stubs. But some changes are too important to auto-apply. Deleting a database migration, modifying authentication logic, changing billing calculations — these need a human to look at the output before it lands.

This is the human-in-the-loop pattern. The agent produces a proposed change, parks it in a review queue, and waits. A human reviewer inspects the change and either approves it (apply the change), rejects it (discard and optionally explain why), or requests revision (send it back to the agent with feedback). The review queue is the gate between "the agent thinks this is correct" and "this actually gets applied."

What You Will Build

A ReviewQueue class that manages review items through a state machine. Items enter as pending, and transition to approved, rejected, or revised based on human decisions. Revised items loop back to pending after the agent incorporates feedback.

Story Mode for this chapter is coming soon

We are crafting a fun, code-free explanation with metaphors and interactive mini-games. In the meantime, switch to Builder Mode to start learning.

What's Next

You have a review queue that gates critical changes behind human approval. But what happens when the current agent's context window is full, or when it is time to hand work off to a different agent?

In Chapter 12, you will build a handoff system that serializes agent state into checkpoints, allowing another agent — or the same agent in a fresh session — to pick up exactly where the previous one left off.