Const Returns a handler that approves every request immediately without any human interaction.
Intended for use in automated tests and CI pipelines where human review is not required.
A HitlHandler that always resolves { approved: true }.
handler: hitl.autoApprove()
Returns a handler that rejects every request immediately without any human interaction.
Useful for dry-run or read-only execution modes where you want to confirm which actions would have been triggered without actually permitting any.
Optional reason: stringOptional human-readable rejection reason appended to the
decision. Defaults to "Auto-rejected".
A HitlHandler that always resolves { approved: false, reason }.
handler: hitl.autoReject('dry-run mode — no side effects permitted')
Returns a handler that pauses execution and prompts the user interactively
via stdin/stdout.
Displays the approval request summary (description, agent, action, type)
and waits for the user to type y (approve) or n (reject).
Important: This handler reads from process.stdin, so it must only be
used in interactive terminal environments (not in CI/CD pipelines or
serverless functions).
A HitlHandler that waits for interactive CLI input.
handler: hitl.cli()
Returns a handler that POSTs the ApprovalRequest as JSON to the provided URL and expects the server to respond with an ApprovalDecision.
The server must respond with Content-Type: application/json containing an
object with at least an approved: boolean field. Non-2xx responses are
treated as a rejection with the HTTP status code as the reason.
The full URL to POST approval requests to.
A HitlHandler that delegates decisions to an HTTP endpoint.
handler: hitl.webhook('https://my-approval-service.example.com/approve')
Returns a handler that posts a notification to a Slack channel when an approval is requested.
v1 behaviour: The message is sent to the configured Slack channel, then
the handler immediately auto-approves. A future version will poll for
emoji reactions (:white_check_mark: / :x:) on the posted message before
resolving.
Slack channel ID or name (e.g. "#approvals" or
"C0123456789").
Slack Bot OAuth token with chat:write scope.
A HitlHandler that posts to Slack and auto-approves for v1.
handler: hitl.slack({ channel: '#approvals', token: process.env.SLACK_BOT_TOKEN! })
Creates an HITL handler that delegates approval decisions to an LLM judge.
The LLM evaluates the approval request against configurable criteria and
returns a structured approve/reject decision with reasoning. When the LLM's
self-reported confidence falls below confidenceThreshold, the decision is
delegated to a fallback handler (default: hitl.autoReject).
LLM judge configuration.
Optional model?: stringLLM model to use.
'gpt-4o-mini'
Optional provider?: stringLLM provider.
'openai'
Optional criteria?: stringCustom evaluation criteria/rubric.
'Evaluate whether this action is safe, relevant, and appropriate.'
Optional confidenceConfidence threshold — below this, escalate to fallback handler.
0.7
Optional fallback?: HitlHandlerFallback handler when confidence is below threshold.
hitl.autoReject('LLM judge confidence too low')
Optional apiAPI key override.
A HitlHandler that auto-decides via LLM.
import { agency, hitl } from '@framers/agentos';
const guarded = agency({
agents: { worker: { instructions: 'Execute tasks.' } },
hitl: {
approvals: { beforeTool: ['delete-file'] },
handler: hitl.llmJudge({
model: 'gpt-4o-mini',
criteria: 'Is this action safe and non-destructive?',
confidenceThreshold: 0.8,
fallback: hitl.cli(), // escalate uncertain decisions to human
}),
},
});
A collection of factory functions that produce HitlHandler instances for common approval patterns.
All handlers are composable: you can wrap any factory result in your own function to add logging, fallback logic, or conditional routing.