- 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:- 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
Pausing Agent Execution
User control 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 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
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.
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.
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: Always validate and sanitize user input to prevent security vulnerabilities.
- Error Handling: Always implement proper error handling for user input and external calls
- 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.