Human-in-the-Loop (HITL)
Agentium can pause the agent loop before executing sensitive tools and request human approval. This is useful for:- Destructive operations (delete file, drop database)
- Financial actions (send payment, place order)
- External communications (send email, post message)
- Any tool where you want a human reviewer in the loop
HITL is fully optional. By default, all tools execute automatically. You opt in per-tool or per-agent.
Quick Start
How It Works
ApprovalConfig
Set onAgentConfig.approval:
'none' | 'all' | string[]
required
Which tools require approval:
"none"— No tools require approval (default behavior)"all"— Every tool call requires approvalstring[]— List of tool names that require approval (e.g.,["deleteUser", "sendPayment"])
(request: ApprovalRequest) => Promise<ApprovalDecision>
Callback invoked when approval is needed. Return
{ approved: true/false, reason?: string }. If not provided, approval operates in event-driven mode.number
default:"300000"
Timeout in milliseconds for waiting on a human response. Auto-denied after timeout (default: 5 minutes).
Per-Tool Approval
SetrequiresApproval on individual tools:
Conditional Approval
Pass a function for dynamic approval logic:Agent-Level Policy
Setapproval.policy on the agent to control which tools need approval:
Priority
Per-toolrequiresApproval takes precedence over the agent-level policy:
Callback Mode
For CLI scripts or simple integrations, useonApproval:
Event-Driven Mode
For web apps (Socket.IO, REST), omitonApproval and use events:
Events
ApprovalRequest & ApprovalDecision
Timeout
If no human responds within the configuredtimeout (default: 5 minutes), the tool call is auto-denied with reason "Approval timed out". This prevents the agent from hanging indefinitely.
See Also
- Sandbox Execution — Run tools in isolated subprocesses
- Tools & Function Calling —
defineTool()reference - Hooks & Guardrails — Pre/post run hooks