Core types
Enabling HITL
myGateway.RequestApproval before execution.
Gateway implementations
hitl.AlwaysApprove
Auto-approves every tool call. Useful in testing or trusted environments.
hitl.NewFuncGateway
Inline function — simplest integration:
hitl.NewCLIGateway
Prompts on stdout, reads from stdin:
hitl.NewChannelGateway
Channel-based — ideal for HTTP servers, UIs, or test harnesses:
Filtering which tools require approval
hitl.OnlyTools — only named tools go through the gateway
hitl.ExcludeTools — all tools except named ones go through the gateway
Override messages
When a gateway rejects a tool call, theOverride string is returned to the LLM as the tool’s result. The LLM then continues the conversation with this information.
Override is empty, the default "Action not approved." is used.
Debug events
HITL emits two debug events observable viaWithDebugHandler:
| Kind | When | Fields set |
|---|---|---|
DebugHITLRequest | Before gateway is called | ToolCall, Iteration |
DebugHITLResponse | After gateway returns | ToolCall, Iteration, ToolOutput ("approved=true/false") |
Partial approval (multiple tools)
When the LLM requests multiple tools in one turn, each is evaluated independently. Approved tools execute normally; rejected tools receive their override message. Both results are merged into history before the next LLM call.Custom gateway
Implementhitl.Gateway for any approval system (database, Slack, PagerDuty, etc.):