Skip to main content
User control flows in Agno enable you to implement “Human in the Loop” 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 User Control Flows

Agno supports four main types of user control 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

Pausing Agent Execution

User control 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 run_response of a specific run to the continue_run method, or the run_id.

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 RunResponse object has a list of tools and 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: Always validate and sanitize user input to prevent security vulnerabilities.
  2. Error Handling: Always implement proper error handling for user input and external calls
  3. Input Validation: Validate user input before processing
If you are using streaming, it is recommended to pass the run_id and a list of updated_tools to the continue_run or acontinue_run method. See an example here.

Developer Resources