# Human in the Loop: Making an Agent Ask Before It Acts

**URL:** <https://community.solace.com/t/human-in-the-loop-making-an-agent-ask-before-it-acts/4962>\
**Category:** Solace Agent Mesh\
**Created:** [November 23, 2026, 1:01pm UTC](https://community.solace.com/t/human-in-the-loop-making-an-agent-ask-before-it-acts/4962 "2026-11-23T13:01:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamimi](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/tamimi/32/2190_2.png) [@Tamimi](https://community.solace.com/u/Tamimi)\
**Post date:** [November 23, 2026, 1:01pm UTC](https://community.solace.com/t/human-in-the-loop-making-an-agent-ask-before-it-acts/4962/1 "2026-11-23T13:01:58Z")

</div>

Some tools I’m happy to let an agent call on its own. Others, the ones that post, book, delete or spend money, I want a person to approve first. Solace Agent Mesh calls this human in the loop (HIL), and it’s a per-tool setting rather than something you write into the prompt.

To try it, I gated the freight quote tool in my Northwind demo, but only for air shipments. The block goes in the toolset’s config under the reserved `hil` key, keyed by tool name:

```yaml
kind: toolset
name: freight-rates
spec:
  config:
    hil:
      quote_freight_rate:
        require_approval_when:
          - arg: mode
            eq: air
        approval_message: "Quote {{.weight_kg}} kg by {{.mode}} from {{.origin}} to {{.destination}}?"
        timeout: "10m"

```

`require_approval: true` gates every call. `require_approval_when` gates only when an argument matches, which is handy for one tool that does both reads and writes (gate `method` in `POST`, `PUT`, `DELETE` and let `GET` through). The message is a Go template over the call’s arguments. Connectors take the same block under `values.hil`.

I applied it with `sam config apply` and asked the Supply Chain Analyst to quote 340 kg Shanghai to Rotterdam by air and by ocean. The ocean quote ran straight through. The air one stopped and waited for me:

 ![Approval Required card in chat, with the arguments and Approve and Deny](https://canada1.discourse-cdn.com/solace/original/2X/0/0fca23ad795f525843f4433be0f10b8cadfda290.jpeg)

**Approve** ran the tool and the answer came back as normal. **Deny** and get the following:

 ![The agent's answer after the air quote was denied](https://canada1.discourse-cdn.com/solace/original/2X/0/040d9d11a83fb8162a4c986b731cab141d79b5e3.jpeg)

The agent didn’t say “you declined that”. It guessed: maybe the tariff needs more authorization, maybe I should supply a volume. None of that was true. If you gate tools, add a line to the system prompt telling the agent that a denied tool call means the user said no, and that it should say so and not invent a reason.

A few other things worth knowing:

- The default timeout is 45 minutes, after which the call is denied. Set `timeout` on the entry to change it.
- The gate applies to agent tool calls. A workflow `type: tool` node dispatches the tool without asking, and logs a warning.
- For a question rather than a yes or no, add the `hil_tools` toolset. Its `ask_user_question` tool renders a short multiple-choice form in chat.

Docs:

- [Configuring Tools](https://docs.solace.com/Agent-Mesh/Framework/building/tools.htm)
- [Built-In Tools](https://docs.solace.com/Agent-Mesh/Framework/reference/built-in-tools.htm)
- [CLI Reference](https://docs.solace.com/Agent-Mesh/Framework/reference/cli.htm) (`sam task send --hil-approve` and `--hil-deny` for scripted runs)

If you want to see the approval card yourself, [download the Solace Agent Mesh desktop app](https://solace.com/products/agent-mesh/) and gate one tool on a test agent.

Which of your agent’s tools would you put behind an approval first?
