Skip to main content
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

How It Works

When you mark a tool with @tool(requires_user_input=True), your agent will:
  1. Pause execution before calling the tool
  2. Set is_paused to True on the run response
  3. Populate user_input_schema with the fields that need to be filled
  4. Wait for you to provide the requested values
  5. Continue execution once you call continue_run() with the filled values
The key difference from user confirmation is that here you’re actually providing data to fill in the tool’s parameters, not just approving or rejecting the tool call.

Collecting Specific Fields

You can control which fields require user input using the user_input_fields parameter. Fields not in this list will be filled by the agent automatically based on the conversation context. In the example below, the agent pauses to collect the to_address parameter from the user for the send_email tool:
In this example, the agent will fill in subject and body based on the user’s request (“Hello” and “Hello, world!”), but will pause and ask the user for the to_address since it’s in the user_input_fields list.

Understanding UserInputField

The RunOutput object has a list of requirements. When a tool requires user input, you will find a requirement object with a user_input_schema field, populated with UserInputField objects:
If field.value is already set (not None), it means the agent has pre-filled it from the conversation context. You can either use that value or override it with user input.The same UserInputField structure is used in Dynamic User Input, where the agent dynamically creates these fields when it needs information.

Collecting All Fields

If you want the user to provide all fields instead of letting the agent fill some automatically, simply omit the user_input_fields parameter or pass an empty list:
This is useful when you want complete control over the data being passed to sensitive operations, or when you don’t trust the LLM to extract the right values from context.

Handling Pre-Filled Values

When you specify user_input_fields, you’re telling the agent which parameters the user should provide. The agent will automatically fill in the other parameters based on the conversation context. For example, with user_input_fields=["to_address"] on a send_email(subject, body, to_address) function:
  • subject and body (not in the list) → Agent fills these from context, value="Hello" etc.
  • to_address (in the list) → User must provide this, value=None
The user_input_schema will include all parameters, but you only need to collect values for fields where value=None:

Async Support

User input works seamlessly with async agents. Just use arun() and acontinue_run():
Dynamic User Input also supports async patterns with the same methods.

Streaming Support

User input also works with streaming. The agent will emit events until it needs user input, then pause:
Remember that tools marked with @tool(requires_user_input=True) are mutually exclusive with @tool(requires_confirmation=True) and @tool(external_execution=True).A tool can only use one of these patterns at a time.

Usage Examples

Basic User Input

Simple user input collection

All Fields Input

Collecting all tool parameters from user

Async User Input

Using user input with async agents

Streaming User Input

User input with streaming responses

Developer Resources