- 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:- User Confirmation: Require explicit user approval before executing tool calls
- User Input: Gather specific information from users during execution
- Dynamic User Input: Have the agent collect user input as it needs it
- 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 thecontinue_run method.
For example:
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
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
send_email tool from the user.
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.
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
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
- Sanitise user input: Validate and sanitize user input to prevent security vulnerabilities
- Error Handling: Implement proper error handling for user input and external calls
- Input Validation: Validate user input before processing