Some tool calls should not run without user approval (refunds, deletes, payments). Tool approval posts an Approve / Deny card in the conversation and pauses the turn until the user decides.
This page covers ctx.toolApproval.request(), the onToolApproval handler, and card customization. How you gate a tool depends on your runtime.
Asking a human a question (ctx.ask / ctx.approve / ctx.choose / ctx.tell) is a different flow. On managed agents the equivalent is the novu_human tool plus the Novu HITL skill — see Add skills.
Channel support#
| Capability | Slack | Teams | Telegram | ||
|---|---|---|---|---|---|
| Action / tool approval | Yes (native block) | Yes (Adaptive Card) | Yes (quick replies) | Yes | Yes (action links) |
| MCP tool approval | Yes | Yes | Yes | Yes | Yes |
| MCP connect card | Yes | Yes | Yes | Yes | Yes |
See Channels overview for the full matrix.
Set needsApproval: true on an AI SDK tool. When the model calls it, Novu posts the approval card and pauses the turn. After the user clicks Approve or Deny, Novu re-runs onMessage so generateText continues the tool loop - no ctx.toolApproval.request() needed.
See AI SDK for auto-resume and optional onToolApproval hooks.
Set needsApproval on a LangChainAgentConfig. When the model calls a gated tool, Novu posts the approval card and pauses the turn. After the user clicks Approve or Deny, Novu re-runs onMessage and resumes from ctx.history - no ctx.toolApproval.request() needed.
See LangChain for auto-resume and optional onToolApproval hooks.
Call ctx.toolApproval.request() with the tool call and return it from onMessage. This posts the approval card and ends the turn:
request() takes an AgentToolCall:
| Field | Type | Description |
|---|---|---|
id | string | Your identifier for this tool call |
name | string | Tool name shown on the card |
input | Record<string, unknown> (optional) | Arguments, available to card customization |
Default behavior#
When you do not register an onToolApproval handler, Novu handles the click for you:
- The user clicks Approve or Deny.
- Novu deletes the approval card and restarts the typing indicator. See Typing indicator.
- The decision is recorded in
ctx.history.
If several tools need approval in the same turn, they surface one at a time - the next card appears after the current one is resolved.
If the user sends a new message while a card is pending, Novu auto-denies the pending tool(s), deletes the card, and processes the new message.
This is the simplest path - post the card and let Novu clean it up. On the Custom code path, handle the decision in onToolApproval when you need to run the tool or post a reply after the click.
Handle the decision with onToolApproval#
Register onToolApproval when you need to act on the click - run the tool, post a result, edit the card, or audit the decision. It receives a decision:
On the Custom code path, you run the tool yourself in onToolApproval - there is no automatic model resume.
When you register onToolApproval, you own card cleanup. Novu no longer auto-deletes the card - call decision.approvalMessage.edit() or decision.approvalMessage.delete() yourself.
The decision object:
| Field | Type | Description |
|---|---|---|
toolCall | AgentToolCall | The gated tool (id, name, input?) |
approved | boolean | true if approved, false if denied |
approvalMessage | ReplyHandle | Handle to the card - edit() or delete() it. See Edit sent messages |
Edit the card in place#
Instead of deleting, edit the card to reflect the outcome so the thread keeps a record:
Customize the card#
By default Novu renders an Approve / Deny card. Customize it with toolApproval.renderApproval. Novu always supplies the action ids and wires the buttons unless you build a fully custom card.
renderApproval receives:
| Arg | Description |
|---|---|
toolCall | The gated tool (id, name, input) |
actionIds | { approve, deny } - wire these to your own buttons for a fully custom card |
approvalCard(overrides?) | Helper returning Novu’s native card descriptor |
approvalCard() fields (channel support noted):
| Field | Channels | Description |
|---|---|---|
title | All | Card title. Defaults to Tool approval required |
subtitle | All | Subtitle; auto-generated from the tool when omitted |
approveLabel / denyLabel | All | Button labels. Default Approve / Deny |
icon | Slack only | Catalog id, https:// URL (32×32), or omit to auto-match the tool name |
body | Slack only | Optional markdown body (e.g. argument preview) |
For a fully custom card, wire the action ids onto your own buttons: