Supervise pending tool approvals
A tool your agent calls is either unguarded (it runs as soon as the model seeks it) or approval-gated (it pauses until a human signs off). This guide walks the full supervisor loop for gated tools: declare which tools require approval, watch the pending queue, decide approve or deny, and read the audit trail. The decision recurs hourly in production, so the loop is what matters — not the one-time setup. The endpoint paths below are relative. Send them againsthttps://api.orbit.devotel.io/api/v1. The concepts behind the queue are in
Human-in-the-loop oversight; this guide
is the operational walk.
1. When gate tracking acts: pre-execution vs post-hoc
The approval gate is synchronous pre-execution: when the model emits a gated tool call, the executor writes apending approval row and returns a
blocked stub to the model instead of running the tool. Nothing touches
the action until a human approves it. After approval the resume worker runs
the deferred call and the conversation continues. That is the only safe
timing that meets “a human saw this first”.
Async post-hoc review is the opposite shape and is cheaper: let the tool
run now and review the record after. Text-only guardrail violations
(warn-severity) work like that, because a wrong reply is recoverable. For
a gated tool call, post-hoc is wrong — a payment capture or a PII egress has
already happened by the time you review it.
Choose pre-execution approval for the calls that hurt; choose post-hoc
warning for the rest. The worked pattern in section 8 shows both in one
agent.
2. Prerequisites
- A supervisor identity. Approve and reject calls run behind the
owneroradminrole — reading the list or the dashboard view is fine for asupervisorrole, but the decide step requiresowner/admin. Authenticate every call with an API key (X-API-Key: dv_live_sk_...) or a dashboard session. - Tool policy in Agent Studio. The agent’s tools are declared in Agent
Studio with a per-tool confirmation flag, or
through the agent API’s
safety_config. Either path marks a tool as gated; both feed the same queue. - Your tools exist. The gate fires on a tool the agent actually has. A typo in the tool id silently produces an unguarded call — verify the id before you rely on the gate.
3. Declare which tools require approval
Gate a tool per-call by setting itsconfirmation to "always" in the
tool definition. Gate every tool on the agent by setting
safety_config.approval_required: true. The two flags are additive; either
one firing puts the call in the queue.
approval_required: true stops every tool call
and quickly buries the queue under harmless lookups — see the worked pattern
in section 8.
4. Surface pending approvals to a supervisor
The pending queue lives on the dashboard at/agents → the
tool-approvals tab, and programmatically at
GET /api/v1/agents/tool-approvals?status=pending&limit=50:
tool_id), the arguments the
model proposed (tool_args), the agent and conversation refs, requested_at,
and a cost_estimate when the tool priced the call in advance — an SMS
fan-out or a payment capture shows the projected spend right on the pause
card. Filter by status (pending, approved, rejected) and age the
queue by requested_at.
Wire the same GET into your own alerting path (an oncall webhook or a
polling supervisor screen) — the JSON shape above is the contract. The
badge-count on the tool-approvals tab in the dashboard reads the same
pending list, so the queue is visible without manual polling.
A row that stays pending is the failure mode to watch: the turn is
blocked and the customer experience hangs while no one decides. Treat an
aged pending queue as an alarm, not an inbox.
5. Resolve with approve or deny
Approve lets the deferred call run.reason is optional on approve:
resumed: true confirms the deferred-turn resume job was accepted. If the
resume queue is briefly unavailable the decision still saves
(resumed: false + a warning string) and the platform retries — the
approval record is the source of truth, no decision is lost.
Reject blocks the call. reason is required so the refusal is
documented:
6. Timeout policy: what an unresolved pending row means
There is no auto-approve timeout by design: apending row never
resolves itself, and an aged pending row simply pauses the conversation
until someone decides. That is the deliberate, safe default — an
auto-approve after N minutes would defeat the point of the gate.
So the timeout you actually operate is on the queue, not the row: a
pending approval that sits past a few minutes is a stalled turn, and the
correct action is to escalate the queue to a supervisor, not to let it
auto-resolve. The warning string on resumed: false is your signal to
route a hard-deny or a manual callback.
If your risk posture truly wants an auto-approve-after-N-minutes rule, the
fall-back lives outside the gate: add a scheduled sweep that reads the
pending list (step 4), rejects or approves with a named reason (step 5), and
is explicit in the audit trail (step 7). Run that sweep from your own
operator tooling — never inside the agent.
7. Audit — every decision writes the supervisor identity
Both decide endpoints append an audit record with the deciding user, the tool id, and whether a reason was attached. The audit entry is written after the status update persists, so the trail never claims a decision that didn’t commit. Approvals carryapproved with an optional-reason flag;
rejections carry rejected with the reason length recorded (never the free
text verbatim, which shouldn’t spill to a warn-path log). Read the trail in
the audit log.
8. Common pattern — gate high-risk, leave low-risk unguarded
The single most useful shape: gate the few calls that move money or leak data; let everything else run.- Gate:
payment_capture,issue_refund,pii_egress(export / send),cancel_subscription— anything irreversible or paid. - Unguarded:
lookup_order_status,search_knowledge_base,get_weather— read-only or recoverable.
confirmation: "always" (step 3). If you
set approval_required: true on the agent instead, every safe lookup goes
to the queue too and a supervisor spends the shift on trivia. Pick the gate
on the high-risk tools, not the agent as a whole.
Where a cost_estimate exists on the gated tool, the pause card shows the
projected spend — use it to reject the obviously-wrong fan-out before the
carrier touches it.
9. Governing close_support_ticket — the agent closes real tickets
close_support_ticket (listed as close_ticket in the built-in tools
catalog) is the mutating tool your agents are most
likely to want gated: it closes real inbox tickets through the same path an
operator’s close takes. This section documents what the tool does, how to opt
in and gate it, and what a close leaves behind.
9.1 What the tool does, and its deliberate limits
The tool moves a ticket to a terminal state only:resolved, or
wont_fix for requests the business will not act on. It is not a general
ticket-update tool. Reopening, reassigning, re-prioritizing, and changing the
subject are operator actions, and the tool refuses those attempts in its
handler — not just in the parameter schema, so a model that ignores the
schema still cannot queue one:
ticket_id is refused the same way.
9.2 Opt in
The tool is not on an agent by default. Addclose_support_ticket to the
agent’s tools array (the built-in catalog in Creating agents
lists it as close_ticket), or tick it on in the Agent Studio tool picker —
the two paths write the same declaration. The model only sees the tool when
it is granted; there is no wildcard that implies it.
9.3 Gate it: approve-once vs always-ask
The tool is registered as a mutating tool, so a timeout in the underlying call never replays it and cannot double-fire a close. That is why the gate is the right place to keep a human on the decision. To require approval, set the tool’sconfirmation to "always"
(section 3): every close the model
proposes then writes a pending row and blocks until a supervisor approves
or rejects it on the dashboard /agents → tool-approvals tab, or via the
approve/reject endpoints in section 5. The
pause card shows the proposed ticket_id and status exactly as the model
submitted them — enough to confirm the ticket and the chosen terminal state
before anything changes.
Left unguarded, a close runs as soon as the model seeks it. The blast radius
is bounded by design: the worst case is a ticket closed early, which an
operator reopens from the ticket in one action.
9.4 A close leaves the same trail as a human close
A close goes through the same chokepoint as an operator’s close, so the side effects are identical:- A
status_changedrow in the ticket’s activity trail, naming who changed it — the agent’s identity, not a mystery edit. - A notification fan-out to the ticket’s followers.
- The CSAT survey, queued automatically when a ticket enters
resolved(not onwont_fix). - Your
ticket_status_changedautomations, which means open-ticket queues and SLA figures self-close without a human revisiting each row.
9.5 Replay safety
Closes are never retried after a timeout, so a slow response cannot re-fire the activity row, the follower fan-out, or the CSAT survey on an already-closed ticket. On the server side a status change only publishes a realtime event when the state actually moved, so re-sending the current status is a no-op everywhere. A404 means no ticket with that id exists in
your organization: the agent reports it to the caller and does not retry
with a guessed id.
9.6 Worked journey — closing a stuck-order ticket
- Grant the tool: include
close_support_ticketin the agent’stools, and gate it withconfirmation: "always"if your posture requires sign-off. - The customer confirms the replacement order arrived. The agent proposes
close_support_ticketwith theticket_idfrom the conversation and statusresolved. - With the gate on, the call pauses as
pending. A supervisor reviews the card and approves —resumed: trueconfirms the deferred close ran. - The ticket goes
resolved. Followers are notified, the CSAT survey is queued, and anyticket_status_changedautomation fires exactly as it would for an operator’s close. - Verify both ways: the realtime
ticket.status_changedinbox event lands on open ticket views live (payload:ticket_id,status,previous_status,changed_by,occurred_at— there is no polling to catch up), and the ticket’s activity trail shows the transition with the deciding supervisor’s identity attached.
Related reading
- Human-in-the-loop oversight — the concept page: whisper, approve, take-over.
- Audit log — read the decision trail.
- Ticket resolution lifecycle — the state machine behind the tickets an agent can close.
- Custom guardrail DSL — declare
warn/block/redactrules (post-hoc tracking) alongside this gate.