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

# Human-in-the-Loop

> Add human approval steps to Duvo agents. Pause workflows for review, approval, or input before the agent continues.

Human-in-the-Loop lets your agents pause at specific points and wait for your input before continuing. Use it to keep a human decision in the loop wherever your workflow requires review — approving a risky action, answering a follow-up question, or checking a draft before it goes out.

> [!NOTE]
>
> Human-in-the-Loop is a built-in connection. No setup is required — it is available for every agent automatically.

## How it works

```mermaid theme={"dark"}
flowchart TD
    A[Agent reaches a checkpoint in the AOP] --> B{Request type}
    B -->|Approval| C[Proposes an action]
    B -->|Question| D[Asks you to choose an option]
    B -->|Login| E[Requests a login]
    C --> F[Delivered to Requests, live run, Slack, or Teams]
    D --> F
    E --> F
    F --> G{Your response}
    G -->|Approve / Answer| H[Agent continues]
    G -->|Decline| I[Agent follows the fallback in your AOP]
```

## When to Use It

Human-in-the-Loop is the right tool when:

* **The action is irreversible** — sending an email, deleting records, submitting a form, making a payment
* **The decision requires judgment** — exception handling, ambiguous requests, policy edge cases
* **Compliance requires sign-off** — expenses over a threshold, contract changes, PII-related actions
* **You want to review a draft first** — see what the agent will send or publish before it does

> [!TIP]
>
> If a step is routine and low-risk, let the agent handle it on its own. Reserve Human-in-the-Loop for steps where a wrong decision would be costly or embarrassing.

## Request Types

Agents can send three types of requests:

> [accordion] Approval
>
> The agent presents a proposed action and waits for you to approve or decline before proceeding.
>
> **What you see:** A request with a title summarizing the action and a description providing the context you need to decide.
>
> * **Approve** — the agent continues with the proposed action.
> * **Decline** — the agent receives your decision and follows whatever fallback you defined in the AOP (for example: skip this step, try an alternative, or stop).
> * **Add a note** — ask a question or give guidance without deciding. The request stays open: the agent replies, then waits for you to approve or decline. If your note changes what needs approving, the agent sends a new request that replaces the old one.
>
> In **Auto mode**, when the agent asks before running an action, typed text works differently: it declines the action and gives the agent your words as guidance.
>
> **Example AOP instruction:**
>
> ```
> Before sending any email to a customer, request approval. In the title, include the recipient
> and subject line. In the description, include the full email body. Only send after receiving approval.
> ```

> [accordion] Question
>
> The agent asks you to choose from a set of options before it decides how to proceed. Use this when the right next step depends on context only you have.
>
> **What you see:** A question with selectable options. Pick one and submit — the agent receives your answer and continues down the correct path.
>
> **Example AOP instruction:**
>
> ```
> If the customer's request cannot be resolved automatically, ask the user:
> (a) Reply asking for clarification, (b) Escalate to the account manager, or (c) Close the ticket.
> ```

> [accordion] Login Request
>
> The agent needs a login to access a system it has not been authorized for. It pauses and directs you to add the login in **Resources > Logins and Secrets**. Once the login is saved, the agent continues.

## Adding Approval Gates to Your AOP

You control exactly where approvals happen by writing them into your AOP. You do not configure Human-in-the-Loop separately — just describe the checkpoint in plain language and the agent will pause there.

**Review before sending:**

```
Draft the reply but do not send it. In the approval title, include the recipient and subject.
In the description, include the full draft body. Only send after I approve.
```

**Threshold-based gate:**

```
Auto-approve refunds under $200. For refunds between $200 and $1,000, request approval with
the customer name, order ID, and reason. For anything over $1,000, ask whether to approve,
deny, or escalate to the finance team.
```

**Content review before publishing:**

```
Generate the post and request approval before publishing. If I decline, ask what to change
and regenerate the content.
```

**Exception routing:**

```
If the issue cannot be categorized automatically, ask whether to route it to tier-1 support,
tier-2 support, or the customer success team.
```

**Batch summary gate:**

```
After processing all line items, show me a summary of the changes and request approval
before committing any updates to the system.
```

### Writing good approval request titles

The title is the first thing you see when a request arrives. Write your AOP so the title includes the specific details, not just "Requesting approval." For example:

* "Send invoice to Acme Corp — \$4,200 due 2026-06-01"
* "Delete 47 archived records from the leads table"
* "Publish blog post: 5 Ways to Cut Procurement Costs"

You can instruct the agent explicitly:

```
When requesting approval, set the title to "[action] — [key detail]".
```

## Responding to Requests

You can respond wherever you work. The agent waits and resumes the moment you reply.

> [tab] Requests
>
> [Requests](https://docs.duvo.ai/user-guide/assignment-features/requests.md) is your central queue for all pending requests. A badge in the left sidebar shows the count of pending items. Requests appear the moment an agent pauses.
>
> To respond:
>
> 1. Open Requests from the left sidebar.
> 2. Click the request to open the detail panel.
> 3. For approvals: click **Approve** or **Decline**.
> 4. For questions: select your answer and submit.
>
> The agent resumes immediately after you respond.

> [tab] During a live run
>
> When you are watching an agent run in real time, approval requests appear directly in the session window. You can approve or answer without leaving the run view — the agent is waiting and will continue as soon as you respond.

> [tab] Slack
>
> If you have connected Slack and enabled notifications, pending requests are delivered as direct messages from the Duvo app. Each message includes the request title, description, and interactive buttons.
>
> * Tap **Approve** or **Decline** directly in Slack — no need to open Duvo.
> * Reply in the thread to add a note. The agent replies, and the approval stays open until you tap **Approve** or **Decline**. In Auto mode, a reply on an action the agent asks to run declines it instead.
> * For questions, select your answer from the options in the message.
> * Once you respond, the message updates to confirm the outcome and the agent resumes.
>
> To enable Slack notifications, the Duvo app must already be installed in your workspace — see [Slack](https://docs.duvo.ai/user-guide/connections/available-connections/slack.md) for that step. Then connect your Slack account on the [Connections page](https://app.duvo.ai/integrations) and check that **Requests in Slack** is on under **Settings > Requests**.

> [tab] Microsoft Teams
>
> Pending requests arrive as Adaptive Cards in Microsoft Teams. Select your response directly from the card. Text typed under **Other** on an approval is a note: the agent replies, and the approval stays open until you choose **Approve** or **Decline**. In Auto mode, text on an action the agent asks to run declines it instead.
>
> When the Agent explained the situation in the Run just before asking, that message also appears on the card under **Details from this Run**, so you can usually decide without opening Duvo. Treat it as a convenience rather than a guarantee: long text is shortened, and the section is left off when there is nothing recent to show. Open the Run for the full detail.
>
> To enable Teams notifications, connect Teams at the team level, link your personal Teams account, then enable **Requests in Microsoft Teams** under **Settings > Requests**.

## Managing High Volumes

When an agent generates many requests — for example, a batch job that reviews dozens of items — use the bulk actions in Requests to keep up:

* **Clear all pending** — removes pending requests from your inbox at once. They stay open, and you can still answer them from their Runs. Case approvals stay in your inbox because they need a decision.
* **Clear all resolved** — removes answered requests from your inbox. They stay on their Runs.
* **Clear all** — removes everything from your inbox, both pending and answered. Requests stay on their Runs, and pending ones can still be answered there.

You can also filter by **status** (Pending / Answered) and **type** (Approval / Question) to focus on what matters most before taking a bulk action.

## Practical Examples

> [accordion] Reviewing outbound communications
>
> Add this to any agent that sends messages on your behalf:
>
> ```
> Draft the message but do not send it. In the approval title, include the recipient and subject.
> In the description, include the full body. Only send after I approve. If I decline, ask what to change and revise.
> ```

> [accordion] Expense threshold enforcement
>
> Add this to an expense-processing AOP:
>
> ```
> Auto-approve expenses under $200. For $200 to $1,000, request approval with the employee name,
> amount, and justification. For over $1,000, ask: approve, deny, or escalate to the finance director?
> ```

> [accordion] Data modification gate
>
> Add this before writing to a live system:
>
> ```
> Before updating any records, summarize the changes you are about to make and the number of
> rows affected. Request approval before committing. If declined, stop and report what was skipped.
> ```

> [accordion] Exception routing
>
> Add this to a support or operations agent:
>
> ```
> If the case does not match any standard category, ask: should I route this to tier-1 support,
> tier-2 support, or the customer success team?
> ```

## Tips

> [!TIP]
>
> **Define the decline behavior.** Tell the agent what to do if declined. Without a fallback, it may stop entirely or retry the same action.

> [!TIP]
>
> **Use questions for branching.** When the right path depends on context you have but the agent does not, use a question rather than a yes/no approval.

> [!WARNING]
>
> **Do not overuse approvals.** Every approval gate adds wait time. Use them only for decisions that genuinely require human judgment, and let the agent handle routine steps on its own.

> [!TIP]
>
> **Test the pause behavior.** Run the agent once and verify it pauses where you expect, and that the approval title and description give you enough context to decide without opening other systems.

## Related

> [card] [Designing Human-in-the-Loop Workflows](https://docs.duvo.ai/user-guide/assignment-features/hitl-design.md)
>
> When to add approval gates, how to choose request types, escalation patterns, and ramping toward safe autonomy.

> [card] [Requests](https://docs.duvo.ai/user-guide/assignment-features/requests.md)
>
> Where you manage and respond to all pending requests.

> [card] [Scheduling Agents](https://docs.duvo.ai/user-guide/assignment-features/scheduling-assignments.md)
>
> Run agents automatically so requests appear in your inbox.

> [card] [Expense Report Approval](https://docs.duvo.ai/user-guide/examples/expense-report-approval.md)
>
> A full tutorial showing Human-in-the-Loop in a finance workflow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.