Skip to main content
Human-in-the-Loop (HITL) in Agno enable you to implement patterns where human oversight and input are required during agent execution. This is crucial for:
  • Validating sensitive operations
  • Reviewing tool calls before execution
  • Gathering user input for decision-making
  • Managing external tool execution

Types of Human-in-the-Loop

Agno supports four main types of human-in-the-loop flows:
  1. User Confirmation: Require explicit user approval before executing tool calls
  2. User Input: Gather specific information from users during execution
  3. Dynamic User Input: Have the agent collect user input as it needs it
  4. External Tool Execution: Execute tools outside of the agent’s control
Currently Agno only supports user control flows for Agent. Team and Workflow will be supported in the near future!

Pausing Agent Execution

Human-in-the-loop flows interrupt the agent’s execution and require human oversight. The run can then be continued by calling the continue_run method. For example:
The continue_run method continues with the state of the agent at the time of the pause. You can also pass the RunOutput of a specific run to the continue_run method, or pass the run_id and list of updated tools in the updated_tools parameter.

User Confirmation

User confirmation allows you to pause execution and require explicit user approval before proceeding with tool calls. This is useful for:
  • Sensitive operations
  • API calls that modify data
  • Actions with significant consequences
The following example shows how to implement user confirmation.
You can also specify which tools in a toolkit require confirmation.

User Input

User input flows allow you to gather specific information from users during execution. This is useful for:
  • Collecting required parameters
  • Getting user preferences
  • Gathering missing information
In the example below, we require all the input for the send_email tool from the user.
The RunOutput object has a list of tools. In the case of requires_user_input, the tools that require input will have user_input_schema populated. This is a list of UserInputField objects.
You can also specify which fields should be filled by the user while the agent will provide the rest of the fields.

Dynamic User Input

This pattern provides the agent with tools to indicate when it needs user input. It’s ideal for cases:
  • Where it is unknown how the user will interact with the agent
  • When you want a form-like interaction with the user
In the following example, we use a specialized tool to allow the agent to collect user feedback when it needs it.

External Tool Execution

External tool execution allows you to execute tools outside of the agent’s control. This is useful for:
  • External service calls
  • Database operations

Best Practices

  1. Sanitise user input: Validate and sanitize user input to prevent security vulnerabilities
  2. Error Handling: Implement proper error handling for user input and external calls
  3. Input Validation: Validate user input before processing

Developer Resources