AI agents · OpenClaw · self-hosting · automation

Quick Answer

How to Add Human Approval to AI Agent Tool Calls (2026)

Published:

The short answer

Human approval is four steps: flag the dangerous tools, pause when one is called, persist the state, resume with a decision. Every major agent framework now has a built-in way to do it, as of December 5, 2026:

FrameworkFlag the toolPause and surfaceResume
LangGraphCall interrupt(payload) in the node before the actionReturned under __interrupt__ (or stream.interrupts)graph.invoke(Command(resume=decision), config) with the same thread_id
OpenAI Agents SDK@tool(needs_approval=True) or a callable that decides per callresult.interruptionsstate = result.to_state(), state.approve(...) / state.reject(...), Runner.run(agent, state)
Claude Agent SDKask rules in settings, or the canUseTool callbackCallback receives tool name and inputReturn allow (optionally with edited input) or deny

Step 1: Decide what needs approval

Gate only actions you cannot undo cheaply: messages to customers, payments and refunds, deletes, production deploys, permission changes and unrestricted shell commands. Leave reads alone. An approval queue full of harmless reads gets rubber-stamped, which is worse than no gate. Our agent rollback vs approval gates vs monitoring guide covers when a gate is the wrong control.

Make the rule conditional when you can. The OpenAI Agents SDK accepts a callable for needs_approval that sees the parsed arguments — for example, approve refunds only above a threshold. Its docs note that callable rules fail closed: if the arguments are missing or malformed, the call goes to manual approval.

Step 2: Pause at the right place

LangGraph. Call interrupt() inside the node that would perform the action. LangGraph saves the graph state through the checkpointer and returns your JSON-serializable payload to the caller. Requirements from LangChain’s docs: a checkpointer (database-backed in production) and a thread_id in the config. Put side effects after the interrupt — when you resume, the node re-runs from its start.

OpenAI Agents SDK. Tools marked needs_approval stop the run; pending calls appear in result.interruptions. The approval surface is run-wide, so it also catches tools reached through handoffs or nested Agent.as_tool() runs.

Claude Agent SDK. Claude Code evaluates each call in order: hooks, deny rules, ask rules, permission mode, allow rules, then your canUseTool callback. Deny rules win even in bypassPermissions mode, and ask rules route to your callback even in bypassPermissions, so list must-approve tools there.

Step 3: Persist and show the request

Do not hold a process open while a person decides. LangGraph waits indefinitely on a saved checkpoint; the OpenAI SDK serializes with state.to_json() / to_string() and restores with RunState.from_json() / from_string(), keeping sticky decisions. Store the paused state with an ID, then send the reviewer:

  • the tool name and exact arguments (the email body, the SQL, the amount),
  • why the agent wants it (its last reasoning or plan step),
  • approve, reject, or edit buttons.

Slack, email or an internal queue all work; the decision just has to come back with the run ID.

Step 4: Resume with the decision

  • LangGraph: graph.invoke(Command(resume={"approved": True}), config={"configurable": {"thread_id": tid}}). The value becomes the return of interrupt().
  • OpenAI Agents SDK: load the state, call state.approve(item) or state.reject(item) for each interruption, then Runner.run(original_agent, state). The run re-enters the flow if it hits another gated tool.
  • Claude Agent SDK: return allow or deny from canUseTool; you can also return modified input, for example removing a recipient.

On rejection, tell the agent why so it can propose an alternative instead of retrying the same call.

Step 5: Log and test it

Record every request and decision with who approved it and when, outside anything the agent can edit. Then test the paths that break in production: a rejected call, a decision arriving hours later after a restart, and two approvals in one run. For credential handling around these tools, see how to give AI agents credentials without leaking them; for the framework choice itself, how to choose an AI agent framework.

Last verified: December 5, 2026.

Sources