Nous.Plugins.HumanInTheLoop (nous v0.13.3)
View SourcePlugin for human-in-the-loop approval of tool calls.
Sets up an approval handler that intercepts tool calls for specified tools.
The handler is called before each tool execution for tools that have
requires_approval: true, or for tools whose names match the configured list.
Configuration
Store the HITL config in deps under the :hitl_config key:
agent = Agent.new("openai:gpt-4",
plugins: [Nous.Plugins.HumanInTheLoop],
tools: [&MyTools.send_email/2, &MyTools.search/2]
)
{:ok, result} = Agent.run(agent, "Send an email to bob",
deps: %{
hitl_config: %{
tools: ["send_email"],
handler: fn tool_call ->
IO.inspect(tool_call, label: "Approve?")
:approve
end
}
}
)When :tools is provided, those tools are automatically tagged with
requires_approval: true and the handler is only called for matching tools.
When :tools is omitted or empty, the handler is called for all tools
that already have requires_approval: true.
Handler Responses
:approve- Proceed with execution:reject- Skip execution, return rejection message{:edit, new_args}- Proceed with modified arguments