OpenRouter Updates Agent SDK With Human-in-the-Loop Tools
- •OpenRouter added human-in-the-loop (HITL) tools to its Agent SDK to manage high-stakes decisions.
- •Developers can use conditional logic to auto-resolve routine calls or escalate specific cases to humans.
- •The SDK includes hooks for processing human responses, distinguishing HITL from static 'require approval' patterns.
OpenRouter updated its Agent SDK to include support for human-in-the-loop (HITL) tools. This feature allows developers to build agents that handle routine tasks autonomously while pausing execution for human intervention when high-stakes decisions are required, such as specific payment thresholds or policy violations.
The workflow utilizes an `onToolCalled` hook where developers define logic to inspect input. If the function returns a value, the agent continues; if it returns `null`, the agent pauses with a status of `awaiting_hitl`. The application can then capture this pending call, present it to a user, and resume the agent's cycle by calling `callModel` with a `function_call_output` item. An optional `onResponseReceived` hook enables post-processing of human inputs before the model resumes, allowing for metadata stamping or format normalization.
This implementation differs from the existing `requireApproval` pattern, which pauses execution for every invocation. HITL tools provide granular control, enabling developers to automate decision-making for simple tasks—such as approving payments under $100—while reserving human review for scenarios that exceed defined criteria.