# Human-in-the-loop

*Human in the Loop* adds a mandatory human approval step to an automated workflow. Before an agent or orchestrator executes a sensitive action, a person can **approve**, **decline**, or **comment** on that action.

***

### Why Add a Human Step?

* **Security & Compliance** – stop unauthorized or risky actions.
* **Error Prevention** – catch mistakes that automated logic might miss.
* **Accountability** – every approved action has a human decision-maker.

***

### Where HITL Fits in Buildspace

| Layer             | Typical Use                                                 | How HITL Works                                                                                                                                   |
| ----------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Agents**        | Calling external APIs, sending emails, writing to databases | Enable approval on individual *tools* (nodes) inside the agent. Each time that tool is invoked, execution pauses and waits for a human decision. |
| **Orchestrators** | Coordinating multiple agents or long chains                 | Add approval to a *workflow step* so the entire branch pauses until it is reviewed.                                                              |

***

### Configuring HITL on an Agent Node

1. Open the agent in **Workflows → Editor**.
2. Select the node (e.g., *ReAct* agent, API call, DB write).
3. Select the tool which you would like the agent to use and ensure the tool is selected.
4. In the **Configuration** panel, check **Enable execution approval**.
5. (Optional) Edit the **Approval message**—this is what the reviewer will see.
6. Save and redeploy your workflow.

<figure><img src="/files/BaJ2cUhtwlcIz5lSEYcj" alt=""><figcaption></figcaption></figure>

***

### Runtime Experience

To view the functionality of HITL:

* Go to the **chat** tab in the header navigation bar.
* Open the workflow where you enabled HITL and shubmit a prompt to your agent.&#x20;

<figure><img src="/files/I9j8Wv2oysGazBoTWxpj" alt=""><figcaption></figcaption></figure>

* When the agent reaches the guarded step, the chat displays:

  ```
  Node <name>: Approve or cancel execution. Send nothing for approval; provide feedback to cancel.
  ```
* The reviewer clicks **Approve** or **Reject**.

<figure><img src="/files/92ikrvmS39FyZkQgaEbr" alt=""><figcaption></figcaption></figure>

* Execution continues (or stops) based on that choice.

***

### Common Use Cases

<table><thead><tr><th width="233.9921875">Scenario</th><th>Reason to Use HITL</th></tr></thead><tbody><tr><td>Querying internal databases</td><td>Prevent data leaks or large accidental extractions</td></tr><tr><td>Sending outbound emails</td><td>Double-check message content and recipients</td></tr><tr><td>Triggering payments</td><td>Verify amount, payee, and authorization</td></tr><tr><td>Posting public updates</td><td>Ensure brand voice and accuracy before publishing</td></tr></tbody></table>

***

### Best Practices

* **Limit scope**: Enable HITL only on actions that truly need it to avoid approval fatigue.
* **Keep messages clear**: The approval prompt should state *what* will run and *why* it needs review.
* **Audit everything**: Store timestamps, approver IDs, and decisions for compliance.

***

### Benefits Recap

* Security guardrail for critical operations.
* Human oversight without fully blocking automation benefits.
* Immediate feedback loop to improve future agent behavior.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getdynamiq.ai/low-code-builder/human-in-the-loop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
