Skip to content

Approval Gates ​

Add approval to an executable step to pause the run after the step succeeds. A person reviews the step's output, then approves it, pushes it back to run again, or rejects the run.

To pause without running a command first, or to collect typed values, use a human task. Human-in-the-Loop compares the two and covers the waiting and resume behavior they share.

Quick Start ​

yaml
steps:
  - id: deploy_staging
    run: ./deploy.sh staging
    approval:
      prompt: Verify the staging deployment before production

  - id: deploy_prod
    depends: [deploy_staging]
    run: ./deploy.sh production

deploy_staging runs. When its command succeeds, the step and the run enter Waiting, and deploy_prod stays Not Started. Open the run, select Open actions, review the output on the Actions tab, and select Approve. The run resumes and deploy_prod runs.

The Actions tab shows the prompt, the step output, and the Reject, Retry, and Approve buttonsThe Actions tab shows the prompt, the step output, and the Reject, Retry, and Approve buttons

A step that fails does not wait for approval. It fails like any other step.

Fields ​

FieldTypeDescription
promptstringMessage shown to the reviewer.
inputstring[]Names of values the reviewer can provide.
requiredstring[]Values that must be non-empty when approving. Each must also be in input.
rewind_tostringStep ID or name that a push-back restarts from: this step or one of its upstream dependencies. Defaults to this step.

All fields are optional. approval: {} pauses with no prompt and no inputs.

Reviewing a Step ​

ActionWeb UI buttonResult
ApproveApproveThe step succeeds and its dependents can run.
Push backRetryThe restart point and its dependents run again with feedback, then the step waits again.
RejectReject, on the step card or the run's action barThe step becomes Rejected and the run ends Rejected.

The run records who acted on each step. Acting requires permission to run DAGs.

Approve ​

Approving marks the step Succeeded. Values provided for input become environment variables in downstream steps:

yaml
steps:
  - id: generate_plan
    run: ./generate-migration-plan.sh
    approval:
      prompt: Review the migration plan
      input: [APPROVED_BY, MAINTENANCE_WINDOW]
      required: [APPROVED_BY]

  - id: execute_migration
    depends: [generate_plan]
    run: ./migrate.sh --approver "${env.APPROVED_BY}" --window "${env.MAINTENANCE_WINDOW}"

The reviewer must provide APPROVED_BY. MAINTENANCE_WINDOW is optional. In the Web UI, Approve asks for the input values when at least one is required; otherwise it approves without inputs.

Push Back ​

Push-back resets the waiting step to Not Started and runs it again with the reviewer's feedback. With rewind_to, the earlier step and every step that depends on it run again instead. The step then waits again for another decision, and its iteration count goes up by one.

yaml
steps:
  - id: prepare_report
    run: ./prepare-report.sh

  - id: draft_report
    depends: [prepare_report]
    run: ./draft-report.sh
    approval:
      prompt: Review the draft report
      input: [FEEDBACK]
      rewind_to: prepare_report

  - id: publish_report
    depends: [draft_report]
    run: ./publish-report.sh

Pushing back draft_report resets prepare_report, draft_report, and publish_report. prepare_report and draft_report run again, draft_report waits, and publish_report runs after approval.

The rerun steps receive the push-back context: one environment variable per feedback key, plus DAG_PUSHBACK, DAG_PUSHBACK_ITERATION, and DAG_PUSHBACK_PREVIOUS_STDOUT_FILE. chat.completion and harness.run steps receive the feedback automatically.

  • Feedback keys: Retry in the Web UI asks for the keys in approval.input. The REST API and MCP accept any keys.
  • Visible keys: a step that declares approval.input sees only those keys from an approval push-back. A step without it sees every key.

Reject ​

Reject asks for an optional reason. The step becomes Rejected, the run ends Rejected, and steps that depend on it never run. The step records rejectedAt, rejectedBy, rejectedById, and rejectionReason; the user fields are set when authentication is on.

Resuming After Approval ​

The run resumes once an approval lets a step run. It starts directly, or through the queue when the DAG belongs to an enabled global queue. A sub-DAG run resumes only after every waiting step inside it is resolved.

Parallel Approvals ​

In a root run, approving one step resumes the run while other approvals keep waiting. The resumed attempt runs the ready branch and returns to Waiting for the rest.

yaml
type: graph
steps:
  - id: build_web
    run: ./build-web.sh
    approval:
      prompt: Release the web build?

  - id: deploy_web
    depends: [build_web]
    run: ./deploy-web.sh

  - id: build_api
    run: ./build-api.sh
    approval:
      prompt: Release the API build?

  - id: deploy_api
    depends: [build_api]
    run: ./deploy-api.sh

Approving build_web runs deploy_web while build_api keeps waiting. Resuming lists the cases in which the run waits until every approval is resolved.

Recovering a Failed Resume ​

The approval is stored before the run resumes. If the resume fails, the run shows Approval saved; resume failed. with a Retry resume button, and the REST API returns 503 with approvalStored: true and resumePending: true in details. Do not approve again. Select Retry resume, or call:

bash
curl -X POST "http://localhost:8080/api/v1/dag-runs/{name}/{dagRunId}/resume"

A retry while the run is already queued or running does not start another execution.

Examples ​

Gating a Sub-DAG ​

Attach approval to a dag.run step to review a whole child workflow at one point. The child runs to completion, then the step waits:

yaml
steps:
  - id: run_integration_tests
    action: dag.run
    with:
      dag: integration-test-suite
    approval:
      prompt: Review the test results before deploying

  - id: deploy
    depends: [run_integration_tests]
    run: ./deploy.sh production

Approving Before a Sub-DAG ​

To approve before a child workflow starts, gate the step before it and pass the reviewer's input on:

yaml
steps:
  - id: review_config
    run: ./validate-deploy-config.sh production
    approval:
      prompt: Config validated. Approve the production deployment?
      input: [DEPLOY_VERSION]
      required: [DEPLOY_VERSION]

  - id: deploy_pipeline
    depends: [review_config]
    action: dag.run
    with:
      dag: production-deploy
      params: "deploy_version=${env.DEPLOY_VERSION}"

Adjusting a Query ​

Push-back values can be parameters instead of prose feedback. The first run uses the defaults; pushing back with SINCE=30d reruns the query with that window.

yaml
steps:
  - id: query_metrics
    run: ./query-error-rates.sh --since "${SINCE:-7d}" --group "${GROUPING:-daily}"
    approval:
      prompt: Review the error rate summary. Push back to adjust the query.
      input: [SINCE, GROUPING]

  - id: send_report
    depends: [query_metrics]
    run: ./send-report.sh

REST API ​

ActionEndpoint
ApprovePOST /api/v1/dag-runs/{name}/{dagRunId}/steps/{stepName}/approve
Push backPOST /api/v1/dag-runs/{name}/{dagRunId}/steps/{stepName}/push-back
RejectPOST /api/v1/dag-runs/{name}/{dagRunId}/steps/{stepName}/reject
Retry a failed resumePOST /api/v1/dag-runs/{name}/{dagRunId}/resume

For a step inside a sub-DAG run, insert /sub-dag-runs/{subDAGRunId} before /steps.

bash
# Approve with inputs
curl -X POST "http://localhost:8080/api/v1/dag-runs/{name}/{dagRunId}/steps/{stepName}/approve" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"APPROVED_BY": "jane@example.com"}}'

# Push back with feedback
curl -X POST "http://localhost:8080/api/v1/dag-runs/{name}/{dagRunId}/steps/{stepName}/push-back" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"SINCE": "30d"}}'

# Reject with a reason
curl -X POST "http://localhost:8080/api/v1/dag-runs/{name}/{dagRunId}/steps/{stepName}/reject" \
  -H "Content-Type: application/json" \
  -d '{"reason": "Blocked by a pending security review"}'

Run responses record who acted in approvedBy/approvedById, rejectedBy/rejectedById, and each pushBackHistory entry's by/byId. See Approval Endpoints. MCP clients use dagu_execute approve, push_back, or reject.

Limitations ​

  • A DAG with approval steps cannot set worker_selector, and a dag.run step with a worker selector cannot run it as a child.
  • There is no CLI command for approvals. Request it if you need one.

Dagu is open source under the GNU General Public License v3.0.