> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dagraph.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Approve gates and respond to user_input nodes via CLI

> Unblock paused dagraph runs by approving or rejecting approval_gate nodes, and supply answers to user_input nodes, directly from the CLI.

When a dagraph run reaches an `approval_gate` or `user_input` node, it pauses and waits for a human decision. The `approve` and `respond` commands let you record that decision from the terminal. After either command, re-run the DAG with `--run-id` to resume execution from where it stopped.

<Tabs>
  <Tab title="approve">
    ## agentgraph approve

    Use `approve` to record a human decision on a paused `approval_gate` node — either approving it so the run continues, or rejecting it to mark the run as failed.

    ```
    agentgraph approve <run_id> <node_id> [OPTIONS]
    ```

    ### Arguments and flags

    <ParamField path="run_id" type="string" required>
      The run ID that contains the pending approval gate. Find it with `agentgraph list --status paused`.
    </ParamField>

    <ParamField path="node_id" type="string" required>
      The ID of the `approval_gate` node to act on. The node must be in `awaiting_approval` status.
    </ParamField>

    <ParamField path="--runs-dir" type="string" default="runs">
      Runs directory. Must match the `--runs-dir` used when the DAG was originally run.
    </ParamField>

    <ParamField path="--reject" type="boolean">
      Reject the gate instead of approving it. The node is marked `failed` and the run does not continue past this point.
    </ParamField>

    <ParamField path="--comment" type="string">
      Optional reviewer comment stored alongside the decision. Visible in the artifact and in audit logs.
    </ParamField>

    <ParamField path="--approver" type="string">
      Override the approver identity written to the artifact. Defaults to the value of the `$USER` environment variable.
    </ParamField>

    ### Examples

    <CodeGroup>
      ```bash Approve a gate theme={null}
      agentgraph approve a1b2c3d4e5f6 review_gate
      ```

      ```bash Approve with a comment theme={null}
      agentgraph approve a1b2c3d4e5f6 review_gate \
        --comment "Looks good — ship it"
      ```

      ```bash Reject with a reason theme={null}
      agentgraph approve a1b2c3d4e5f6 review_gate \
        --reject \
        --comment "Output quality is too low; regenerate with a stricter prompt"
      ```

      ```bash Specify the approver theme={null}
      agentgraph approve a1b2c3d4e5f6 review_gate \
        --approver alice \
        --comment "Approved in weekly review"
      ```
    </CodeGroup>

    ### Approve/reject flow

    <Steps>
      <Step title="Run the DAG">
        ```bash theme={null}
        agentgraph run examples/approval_flow.yaml --input feature="dark mode"
        ```

        The run pauses at the `approval_gate` node and prints a summary showing which gates are waiting.
      </Step>

      <Step title="Find the paused run">
        ```bash theme={null}
        agentgraph list --status paused
        ```
      </Step>

      <Step title="Record your decision">
        ```bash theme={null}
        # Approve
        agentgraph approve a1b2c3d4e5f6 review_gate --comment "Approved"

        # Or reject
        agentgraph approve a1b2c3d4e5f6 review_gate --reject --comment "Try again"
        ```
      </Step>

      <Step title="Resume the run">
        ```bash theme={null}
        agentgraph run examples/approval_flow.yaml --run-id a1b2c3d4e5f6
        ```

        Nodes that already completed are skipped. Execution continues from after the gate (if approved) or stops (if rejected).
      </Step>
    </Steps>
  </Tab>

  <Tab title="respond">
    ## agentgraph respond

    Use `respond` to supply a value to a paused `user_input` node. The node supports three input types: `text` (free-form string), `select` (one of a fixed list of options), and `confirm` (yes/no).

    ```
    agentgraph respond <run_id> <node_id> <value> [OPTIONS]
    ```

    ### Arguments and flags

    <ParamField path="run_id" type="string" required>
      The run ID that contains the pending `user_input` node.
    </ParamField>

    <ParamField path="node_id" type="string" required>
      The ID of the `user_input` node to respond to. The node must be in `awaiting_user_input` status.
    </ParamField>

    <ParamField path="value" type="string" required>
      The response value. For `select` nodes, must be one of the declared options. For `confirm` nodes, must be `yes`, `no`, `y`, `n`, `true`, or `false`.
    </ParamField>

    <ParamField path="--runs-dir" type="string" default="runs">
      Runs directory.
    </ParamField>

    <ParamField path="--dag" type="string">
      Path to the DAG YAML file. When provided, agentgraph validates `value` against the node's declared `input_type` and `options` before writing the response.
    </ParamField>

    ### Examples

    <CodeGroup>
      ```bash Text input theme={null}
      agentgraph respond a1b2c3d4e5f6 audience_input \
        "senior software engineers with distributed systems experience"
      ```

      ```bash Select input theme={null}
      agentgraph respond a1b2c3d4e5f6 tone_select "professional" \
        --dag examples/blog_writer.yaml
      ```

      ```bash Confirm input theme={null}
      agentgraph respond a1b2c3d4e5f6 publish_confirm yes \
        --dag examples/publish_flow.yaml
      ```
    </CodeGroup>

    ### Resume after responding

    After recording the response, resume the run with:

    ```bash theme={null}
    agentgraph run examples/my_dag.yaml --run-id a1b2c3d4e5f6
    ```
  </Tab>
</Tabs>

<Warning>
  Both `approve` and `respond` only update the local run state. They do not trigger execution — you must run the DAG again with `--run-id` to continue.
</Warning>
