> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/datadesigner/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/datadesigner/_mcp/server.

# Document Review Gate

[Download the complete recipe script](https://github.com/NVIDIA-NeMo/DataDesigner/blob/main/docs/assets/recipes/workflow_chaining/document_review_gate.py)

This recipe demonstrates workflow chaining with a review boundary. It generates synthetic document pages, runs a weak detector to a named `review_candidates` stage, exports that intermediate dataset, writes a simulated reviewed artifact, and resumes the downstream stages from that reviewed artifact.

The recipe is headless and does not call a model provider. It accepts `--model-alias` for compatibility with the recipe runner, but all stages use local custom columns.

## Run the Recipe

```bash
uv run document_review_gate.py --artifact-path ./workflow-artifacts --num-records 12 --overwrite
uv run document_review_gate.py --artifact-path ./workflow-artifacts --num-records 12 --review-pages 4 --overwrite
uv run document_review_gate.py --help
```

The run writes generated images, exported stage parquet files, the simulated reviewed parquet file, and the final dataset under `--artifact-path`.

## Workflow Pattern

The important part is the boundary contract. The downstream workflow does not care whether `review_candidates` came from the original detector, a dashboard, a script, or another service. It only consumes the selected stage output. This excerpt uses the setup and path helpers defined in the complete recipe.

```python
from pathlib import Path

import data_designer.config as dd

base_dir = Path("./workflow-artifacts")
workflow = build_workflow(base_dir)
results = workflow.run(targets="review_candidates")
review_path = review_candidates_path(base_dir)
results.export_stage("review_candidates", review_path)

reviewed_path = write_simulated_review_artifact(base_dir)

workflow.run(
    resume=dd.ResumeMode.ALWAYS,
    stage_output_overrides={"review_candidates": reviewed_path},
)
```

Use this pattern when an intermediate dataset needs inspection, policy checks, cleanup, or human review before downstream stages should run.