Chat tool confirmation API
When a chat turn wants to run a tool whose interactive level is Confirm (see the tool permission policy), the gateway stops the turn before that tool runs, shows the user one confirmation card and continues the same turn once the user answers. This page describes the card on the stream, the decision endpoint, how the turn continues, "Allow for this conversation", and the untrusted-content escalation. The same card appears in an agent's Try it. A tool at Approval by someone else is described in its own section: the call waits for a colleague's approval while the user keeps chatting.
Overview
- The model asks for one or more tool calls. Calls that may run (level Allow, read tools) run as usual. Calls whose interactive level is Confirm do not run.
- The stream sends one
tool_confirmevent for the turn, listing every waiting call, and then ends normally. The card is stored with the turn, so reloading the conversation shows it again. - The user answers with
POST /admin/v1/conversations/{id}/tool-confirm/{confirm_id}(runorcancel). - The client continues the turn: a regenerate of that turn with the header
x-aig-tool-confirm: <confirm_id>. The gateway runs the confirmed calls (or tells the model "The user declined to run <tool>." for each cancelled call) and the model writes the rest of the answer. The continued answer replaces the asking answer; the decided card stays on it unless the continuation asks for another confirmation.
While a card waits for its answer (or for its turn to continue), the conversation does not accept a new turn: 409 tool_confirm_pending.
The card on the stream (tool_confirm)
Sent only to clients that opted into the gateway's stream extensions (a server-owned chat turn with x-aig-turn-id, or x-aig-extensions: 1).
{
"aig_status": "tool_confirm",
"confirm_id": "6c0d9b6e-9a43-4a2b-8f3e-2f0d6c1b7a55",
"calls": [
{
"call_id": "call_1",
"connector_id": "9f3c…",
"connector": "CRM",
"tool": "add_note",
"title": null,
"class": "write",
"args_masked": "{\"key\":\"4711\",\"text\":\"Customer called back\"}",
"args_masking": "masked",
"allow_for_conversation_offered": true,
"class_source": "admin",
"asks_because": "policy"
}
]
}
| Field | Meaning |
|---|---|
confirm_id |
The card's id (a UUID). |
calls[].call_id |
The model's id of the call. |
calls[].connector_id / connector |
The connector and its name. A gateway tool (for example a fetch on an agent) has connector_id "builtin" and no connector. |
calls[].tool |
The connector's own tool name. For a gateway tool (connector_id "builtin") it is an internal identifier such as fetch_url: the chat does not show it, it shows a plain label instead (for example Open web page, or Assistant tool for a tool it has no label for, which shows no arguments at all and says they are withheld), and only the arguments a person can judge (the address for a page fetch, plus the instruction for an agentic fetch, the query for a web search). The raw args_masked string stays unchanged in the frame and in the decision record. |
calls[].class |
read, write, destructive or builtin. A tool nobody has classified fails closed to destructive (see class_source). |
calls[].class_source |
Where class came from, for display only: admin (an administrator classified the tool), catalog (the connector's catalog did) or default (nobody did: the tool is unclassified and the gateway treats it as destructive). null or absent when unknown (an older card) and for gateway tools. default only ever appears with class: "destructive"; any other combination, or any other value, makes the client drop the card. The chat shows default as Not classified, never as Delete. |
calls[].args_masked / args_masking |
The arguments exactly as the access decision record stores them: masked with the gateway's personal-data settings (masked), or not shown (withheld, unavailable, too_large, invalid_utf8). Never the raw arguments. |
calls[].allow_for_conversation_offered |
Whether the card may offer "Allow for this conversation" for this tool. Always false in a conversation with untrusted content and in Try it. |
calls[].allow_unavailable_because |
Only when allow_for_conversation_offered is false: why. no_conversation (a Try it run, which has no conversation) or untrusted_content (the conversation contains untrusted content); no_conversation wins when both apply. Explanation only: it never changes what may run. Absent when the offer is made. |
calls[].asks_because |
policy (the organisation's or the agent's level, or the built-in class default; see ask_origin) or untrusted_content (the escalation below). |
calls[].ask_origin |
class_default when the gateway's built-in class default asks (nobody set a level for the tool or its class). Absent otherwise. Only with class destructive (the built-in default asks for no other class). Any other value, or class_default on a call whose class is not destructive, makes the client drop the card; older clients ignore the field. |
A turn has at most one card; the card lists at most 32 calls.
Answering a card
POST /admin/v1/conversations/{id}/tool-confirm/{confirm_id}
POST /admin/v1/tool-confirm/{confirm_id} (a Try it card: no conversation)
Body (JSON object):
| Key | Rules |
|---|---|
decision |
Required: run or cancel. |
allow_for_conversation |
Optional (run only): tool names (1–200 bytes each, at most 32) the card offered "Allow for this conversation" for. |
approve_domains |
Optional (run only, domain cards only): the domain keys of the card's offer that the user approves. Never combined with allow_for_conversation. |
Any other key, a body that is not a JSON object, or a value outside these rules is refused with 400 and a named code.
- Who may answer. Only the user who was asked. Anyone else, an unknown card, another conversation's card and a Try it card on the conversation route all get the same
404 tool_confirm_not_found, checked before the body is read. - Exactly once. A second answer gets
409 tool_confirm_already_decided. A card that waited longer than 24 hours gets409 tool_confirm_expired. - Answer.
200 { "confirm": <the card, see below>, "resume": { "confirm_id": "…", "regen_of_turn": "<turn id>" } }.regen_of_turnis the turn the client continues (absent for Try it).
| Status | code |
When |
|---|---|---|
| 400 | invalid_body |
Not a JSON object, a key other than the three above, or approve_domains together with allow_for_conversation |
| 400 | invalid_decision |
decision missing or not run / cancel |
| 400 | invalid_allow_for_conversation |
Not an array of 1–200-byte strings, or more than 32 |
| 400 | allow_requires_run |
allow_for_conversation with cancel |
| 400 | allow_not_offered |
A tool the card did not offer "Allow for this conversation" for (also in a conversation with untrusted content, and for every Try it card) |
| 404 | tool_confirm_not_found |
Not your card, not this conversation's card, or no such card |
| 409 | tool_confirm_already_decided |
The card was answered already |
| 409 | tool_confirm_expired |
The card is older than 24 hours |
| 409 | allow_for_conversation_unavailable |
The conversation received untrusted content after the card was shown; nothing was saved — answer again without the list |
Continuing the turn
After a 200, the client sends the turn again as a regenerate of the asking turn (x-aig-regen-of-turn: <regen_of_turn>, a new x-aig-turn-id, the same conversation) and adds:
For Try it, the client invokes the agent again with the same input and this header.
The gateway checks the card again (the asker, the conversation, the turn, decided, not continued yet, not older than 24 hours) and claims it once: a second request with the same card is refused with 409 tool_confirm_unavailable (on an already open stream, the same code as an error frame) and runs nothing. A card that is still open gets 409 tool_confirm_pending.
- Run. Each confirmed call runs with the user's current access: a block or a revoked connector since the card was shown still refuses it. The call is recorded as
confirm_run(decided_by= the user). - Cancel. No call runs. The model gets "The user declined to run <tool>." for each call; each is recorded as
confirm_cancelled(decided_by= the user). - Calls that already ran in the same turn (read tools, Allow tools) are not run again.
- If the conversation changed in a way the stored state cannot continue (for example a different model), the card is closed and the request is refused with
409 tool_confirm_unavailable; the user sends the message again.
The card on the conversation
GET /admin/v1/conversations/{id} (owner) returns the card on the assistant message of its turn, as tool_confirm:
{ "confirm_id": "…", "status": "open", "calls": [ … ], "allowed": [ { "connector_id": "…", "tool": "add_note" } ], "decided_at": null, "resumed": false }
status is open, run, cancelled or expired; resumed tells whether the turn continued; allowed lists the grants made with the decision. The conversation also carries tool_grants (the active grants) and untrusted_since / untrusted_source (below).
A continuation can ask for another confirmation, even before it writes any prose. That answer shows the new asking card, both live and after reload; an older completed card resumed by the same answer cannot replace it. Run or Cancel answers this new card's confirm_id. If there is no new asking card, the historical resumed card remains the answer's card.
"Allow for this conversation"
A grant lets later calls of the same connector tool in the same conversation run without a card. It is stored on the server per conversation, connector and tool, never in the browser.
- It is offered only while the conversation contains no untrusted content.
- It never lifts a Block or an "Approval by someone else".
- Undo:
DELETE /admin/v1/conversations/{id}/tool-grants?connector_id=<id>&tool=<name>→200 { "removed": 0 | 1 }(only the conversation's owner removes anything; anything else answersremoved: 0). Missing or over-long parameters →400 invalid_grant. - When the conversation receives untrusted content, all its grants are deleted. The deletion is recorded so the app can say so (below).
Which grants ended. The first time untrusted content ends at least one grant, the conversation keeps one record of it, and GET /admin/v1/conversations/{id} (owner only) returns it as tool_grants_ended:
reason is one of web_content (a fetched page or web search), tool_result (another tool result with outside text), upload or untrusted_origin. grants lists at most 100 entries; omitted (only when above 0) counts the rest. The chat UI lists those (at most 100) ended grants and does not show omitted. The field is absent when no grant ended. The record is written after the grants are deleted and is best-effort: if it cannot be written, the grants are still gone. It is explanation only and never authorizes anything.
Approving web domains (fetch domain card)
When the only reason a turn stops is the untrusted-content escalation of the page fetch or agentic fetch (asks_because: "untrusted_content"), and the conversation is a stored chat of a signed-in user, the card offers domains instead of one confirmation per call. The user approves the domains they trust; calls to those domains then run in this conversation without a card.
On the stream. The tool_confirm event carries one extra field, domains: the offered domain keys (at most 20), in call order, followed by the sorted domains of the current turn's web-search results, minus the domains already approved. If more than 20 would be needed, the card falls back to one confirmation per call and has no domains.
{ "aig_status": "tool_confirm", "confirm_id": "…", "calls": [ … ], "domains": ["example.org", "docs.example.org:8443"] }
The domain key. The host, lower-case, without one trailing dot and without one leading www.; the port only when it is explicit and not the scheme's default. The scheme is not part of the key, and there is no public-suffix logic: example.org does not cover docs.example.org. An internationalized host is keyed by its ASCII form (xn--…); a non-ASCII host is never a key. An IP address is not a key, except a plain dotted IPv4 address the organisation's own allow list accepts. One exception: api.github.com (with no explicit non-default port) has the key github.com, so approving github.com also approves the GitHub API host. An approval of api.github.com stored before this change no longer matches any request (it fails closed); the card offers github.com instead, and the old entry can be removed with Undo.
The card (GET /admin/v1/conversations/{id} and the answer's confirm) carries domains_offered (array of keys; absent or empty on a per-call card) and domains_approved (array of keys, the ones the user approved with the answer).
Answering. POST body key approve_domains: array of 1–20 domain keys, all of them offered by the card.
| Status | code |
When |
|---|---|---|
| 400 | approve_domains_required |
decision: "run" on a domain card without approve_domains (never read as "run all") |
| 400 | invalid_approve_domains |
Not an array of 1–20 valid domain-key strings (a present but malformed value is never read as absent) |
| 400 | approve_domains_requires_run |
approve_domains with cancel |
| 400 | approve_domains_not_offered |
A key the card did not offer, or approve_domains on a card that is not a domain card |
Combining approve_domains with allow_for_conversation is refused with 400 invalid_body. A conversation with untrusted content never offers allow_for_conversation.
What a grant does. A call to a fetch tool whose domain is approved runs without a card and is recorded as confirm_domain_approved (rule_id confirm:domain_approved:<key>). A call to any other domain still asks. A redirect to a domain that is not approved is refused (the fetch ends with the kind redirect); the approved set for a redirect is the approved domains plus the domain of the call itself. The gateway-built api.github.com call that reads a github.com folder or file is part of the github.com approval: it is vetted like any other request, and when github.com is not approved neither the API request nor the page is sent (one web_domain_blocked row). Domain grants are not voided when the conversation receives untrusted content: they bind only the two fetch tools. Declined domains are told to the model like any cancelled call.
Undo. DELETE /admin/v1/conversations/{id}/fetch-domain-grants?domain=<key> → 200 { "removed": 0 | 1 }. Only the conversation's owner removes anything; anything else answers removed: 0. A missing or invalid domain → 400 invalid_domain.
The conversation carries fetch_domain_grants: the owner's approved domain keys (array of strings; [] when none).
Untrusted content
A conversation is marked as containing untrusted content (untrusted_since, unix seconds, and untrusted_source) the first time one of these enters it:
untrusted_source |
Source |
|---|---|
upload |
An uploaded document or file in a message |
tool_result |
A tool result that may carry outside text — a fetched web page, a web search, a code run, a sub-agent's answer, or a result of a connector the user did not pick for this chat (results of the gateway's own file, knowledge and image tools do not count) |
untrusted_origin |
A message from outside the workspace (for example a chat-bridge channel) |
The mark never clears within the conversation. While it is set:
- write, delete and outbound tools whose interactive level is Allow ask first (Confirm,
asks_because: "untrusted_content"), and "Allow for this conversation" is not offered; - all existing grants are void;
- read tools are unaffected, and nothing becomes looser.
The web-search confirmation is off by default (web_search_confirmation_enabled = 0); an organization can switch it on. While it is off, in a chat, the web tools (page fetch, agentic fetch and web search) are not escalated: they run without a card. Only when the organization has switched it on (1) do they ask as described above. Everything else stays as described above: connector tools that write, delete or send data still ask, an explicit Confirm on the agent for a web tool still applies, the conversation is still marked as containing untrusted content, and Try it and agent runs are unchanged.
The stream sends the policy-state event once, when the mark is set (this contract is unchanged):
When the mark ended grants, the same event also carries grants_ended (the record above, without omitted when it is 0). The event does not change otherwise, and a client that ignores grants_ended still behaves as before.
In Try it the mark lasts for the run.
Presentation only: chat (thread and composer) and Try it do not render a persistent external-content warning. An actionable open confirmation card with at least one calls[].asks_because: "untrusted_content" shows "The assistant read external content. Review this action before it runs." once, and an "External content" label on each affected call. Policy-only cards do not show this explanation. Decided, expired and read-only cards retain their outcome/Continue behavior without actionable guidance. Reload retains the policy state and any pending decision, but does not restore a generic warning.
The server-side conversation-wide mark, grants, holds, decisions and audit writes are unchanged. Web search still counts as external content; this presentation change does not introduce a web-search exemption or a per-turn policy.
Access decisions
reason |
decision |
Written when |
|---|---|---|
confirm_requested |
deny |
The card asked for the call (nothing ran yet) |
confirm_run |
allow |
The confirmed call ran (decided_by = the user) |
confirm_cancelled |
deny |
The user cancelled the call (decided_by = the user) |
confirm_allowed_for_conversation |
allow |
A grant let the call run without a card |
confirm_domain_approved |
allow |
A fetch to a domain the user approved for this conversation ran without a card (rule_id confirm:domain_approved:<key>) |
See Access decisions.
Approval by someone else
When a chat turn wants to run a connector tool whose interactive level is Approval by someone else (approval), the call does not run and the turn does not stop: the gateway opens an approval request, streams a waiting card, tells the model that nothing ran, and the turn ends normally. The user can keep chatting. Who may approve comes from the policy's approvers.interactive (see the tool permission policy): the named users that are active users of the organisation, minus the asker, and, with roles: ["governance_manage"], every holder of the governance permission other than the asker. When nobody else can approve (for example the other named approver was disabled since the policy was saved), no request is opened and the model is told the call did not run.
Available in chats with connectors (a user at the keyboard, a turn the chat owns). An agent's Try it, a chat with an agent, a private chat and a plain API call without the chat's turn id refuse such a call with reason interactive_approval, and the model is told why.
The request. A review_item of kind tool_gate with hold_reason: "chat_approval", run_id and agent_id null, linked to the conversation and the asking turn. It holds the call's arguments sealed with the gateway's master key (used only to run the approved call, wiped when it ran or the request ended) and the arguments masked exactly as the access decision record stored them (what the card and the approver see). Four-eyes does not apply: one approval is enough. It waits for the organisation's default approval waiting time when one is set (approval waiting time), else 24 hours.
On the stream. One event per held call, in the turn's stream:
The request object (the stream, the conversation, the poll and the withdraw answer):
| Field | Type | Meaning |
|---|---|---|
approval_id |
string | The request (= the review item id) |
call_id, turn_id |
string | The model's tool call id; the asking turn (the assistant message's turn_id) |
connector_id, connector |
string, string or null |
The connector and its display name |
tool, class |
string, read / write / destructive or null |
The connector's own tool name and its class |
args_masked, args_masking |
string or null, string |
The arguments as JSON text, masked like the access decision record (null when withheld), and how they were stored |
approvers |
{users: [{id, name}], admins: boolean} |
The named approvers (name, or e-mail when the user has no name) and whether "Organisation admins" may decide |
status |
waiting / approved / rejected / expired / withdrawn |
The decision state |
outcome |
running / ran / error / not_run or null |
Only with approved: the call is running, ran, returned an error, or did not run (a block or a lost access since the request) |
result |
string or null |
With ran / error: the tool's output (at most 16 KB); with not_run: why |
decided_by_name, decision_note |
string or null |
The approver and their comment (approved / rejected only) |
requested_at, expires_at, decided_at |
unix seconds (decided_at null while waiting) |
The conversation. For the owner, the assistant message of the asking turn carries tool_approvals (a list of request objects, oldest first; absent when none).
Polling. GET /admin/v1/conversations/{id}/tool-approvals → 200 {"approvals": [ … ]} (oldest first), owner only. The app polls it every 10 seconds while a card is waiting or running.
Withdrawing. POST /admin/v1/conversations/{id}/tool-approvals/{approval_id}/withdraw (no body), the asker only → 200 {"approval": { … status "withdrawn" }}; 409 tool_approval_already_decided when it is no longer waiting.
The path ids are untrusted: another user's conversation, a conversation of another organisation, an unknown or malformed id all answer the same 404 (not_found on the poll, tool_approval_not_found on the withdraw). Both routes are refused while impersonating; the withdraw also for a viewer.
Deciding. Approvers decide in /approvals with the existing routes (POST /admin/v1/me/tool-approvals/{id}/approve|deny, and the admin POST /admin/v1/review-items/{id}/approve|deny); see Held tool calls. The asker gets 403 {"error": "own_request"} (an administrator too), anyone else who may not decide 403 {"error": "not_approver"}; the decision itself re-checks the same rule. On approve the gateway runs the call once, as the asker, against the current policy and access (connector visibility, the asker's credential, the tool's level: a block since the request wins and the call does not run), and stores the result. An approved request whose run did not start (a gateway restart) is picked up by the scheduler within a minute.
The model is told on the next turn. The model never answers by itself. On the user's next turn in the conversation, the gateway puts one note in front of the user's message with every outcome decided since the model last heard: approved and ran (with the tool's output, framed as untrusted content and PII-protected like any tool result), approved but not run, rejected (with the comment), expired, withdrawn. Each outcome is told once (a regenerate of that turn tells it again).
Access decisions of a chat approval
reason |
decision |
Written when |
|---|---|---|
chat_approval_awaiting |
deny |
The request was opened; nothing ran (rule_id chat_approval:awaiting:<approval id>:<tool>; held, with the approval id, in the SIEM) |
chat_approval_approved |
allow |
The approved call ran (decided_by = the approver, rule_id chat_approval:approved:<approval id>:<tool>) |
chat_approval_rejected |
deny |
An approver rejected it (decided_by = the approver) |
chat_approval_expired |
deny |
Nobody decided in time |
chat_approval_withdrawn |
deny |
The asker withdrew it (decided_by = the asker) |
An approved call that did not run because of a block or a lost access since the request writes the refusal of that check instead (for example tool_policy).
Limits
- A private (ghost) chat stores nothing, so it cannot show a card: a Confirm tool is refused there (
interactive_confirm) and the model is told why. - A plain API call made without the chat's turn id cannot show a card either; it gets the same refusal.
- A card waits at most 24 hours.
- A chat approval's posted result is at most 16 KB of the tool's output; images and other media in it are passed on as their JSON text.
Data handling
Confirm cards and approval requests hold the tool call's arguments (and, for an approval request, the tool's output and the people named to decide it); an approved fetch domain holds the domain key; an "Allow for this conversation" grant holds which tool of which connector was allowed. All three are personal content. They are deleted when the conversation is permanently deleted (by the retention period or the organisation's erasure; a Try it card, which has no conversation, is deleted once it expires, at most 24 hours after it was shown), together with the user's account, and together with the organisation when it is erased. They are not part of the organisation's exit data export; the user-visible outcome is in the conversation's messages. The decision record in Approvals follows its own retention.