> For the complete documentation index, see [llms.txt](https://docs.warp.dev/llms.txt).
> Markdown versions of each page are available by appending .md to any URL.

# Adding human gates to a Blueprint

Require human involvement at stage completion or when a condition holds in a Warp Factories Blueprint.

A gate requires a worker to involve a person when a condition holds or a stage’s work ends. Use it to request approval for an action or change, such as reviewing a plan before implementation or approving a migration discovered during the work.

## Require plan approval

In `factory.yaml`, add a named gate under the planning stage’s `gates`. The question belongs beside the work that produces the plan, not only in a general foreman prompt.

```yaml title="Stage under blueprint.stages"
plan:
  worker: foreman
  inputs: The request and repository context.
  prompt: Propose a short plan with scope and checks. Do not edit code.
  outputs: The plan and the plan-review answer.
  gates:
    plan-review:
      prompt: Review the plan. Approve it or describe the changes you want.
      outputs: Approval of this plan, or requested changes to it.
  to:
    - stage: plan
      when: The plan-review answer requests changes.
    - stage: implement
      when: The plan-review answer approves the current plan.
```

Choose a stable gate name, such as `plan-review`, so the transitions can refer to its answer. `prompt` states what to ask; `outputs` describes the answers needed to continue. Without `when`, the gate opens after the stage’s work is done.

The stage stays open while the question is unanswered. “Changes requested” satisfies the gate but selects the revision transition. An unrelated reply or a question back does not approve the plan. A revised plan is a new review matter and needs its own answer.

## Ask when a condition arises

For questions that depend on the work, add `when`. This gate can open during implementation when the worker discovers a migration:

```yaml title="Gate under an implementation stage's gates"
migration-review:
  when: The proposed change adds or alters a database migration.
  prompt: Ask the service owner to review the migration and its rollout plan.
  outputs: Approval, requested changes, or a decision not to proceed.
```

Write a condition the worker can assess from the task and its results. Include the material and context a person needs to answer. If several gates open together, the worker asks them together; every open question must be answered before the stage finishes.

For a leaf stage, the worker doing the work checks its gates and relays questions through the foreman. A gate on a delegated group is checked by the worker that dispatched the group, after the group’s result returns.

After [validating and applying](https://docs.warp.dev/factories/factory-as-code/#validate-a-definition) the definition, answer gate questions in the original conversation with the foreman. See [workflow decisions and repository permissions](https://docs.warp.dev/factories/blueprints/#gates-ask-for-answers-not-automatic-approval) for the boundary between gates and access controls.

## Related pages

-   [Configuring Blueprint transitions](https://docs.warp.dev/factories/blueprints/routes/) - Choose what each answer does next
-   [Defining Blueprint stages](https://docs.warp.dev/factories/blueprints/stages/) - Put a question beside the work it pauses
-   [About Blueprints](https://docs.warp.dev/factories/blueprints/) - Separate workflow decisions from permissions
