DocsRuntimeagent-runtimeCreateApprovalHandler
Package: @hexos/runtime

Creates a Next.js App Router handler for processing tool approval decisions.

Receives ApprovalDecision payloads and forwards them to AgentRuntime.submitApproval(). Returns 404 if no matching pending approval exists. Use alongside createAgentHandler for human-in-the-loop workflows.

Related: ToolApproval represents the pending request, useToolApproval sends decisions from the frontend, AgentRuntime.waitForApproval() blocks until resolved.

function createApprovalHandler(runtime: AgentRuntime): void

Parameters

runtime