Ask User for Input
Theask_user_for_input tool pauses agents to request clarification during a
conversation. Agents decide when they need more information and ask users directly.
Enable the Tool
Addenable_ask_for_user_input=True when starting your agent:
images/main/main.py
images/main/Dockerfile
autonomy.yaml
How It Works
When an agent invokesask_user_for_input:
- Agent pauses - The agent’s state transitions to
"waiting_for_input" - Question is returned - The streaming response completes with the agent’s question
- Conversation waits - The conversation remains paused until the user responds
- User responds - The next message from the user resumes the conversation
- Agent continues - The agent processes the response and continues its task
Example Flow
Initial request - User asks to book a flight:Best Practices
Write Clear Instructions
Guide your agent when to ask for input:Handle Multi-Step Workflows
Agents ask multiple questions to gather all necessary information:Combine with Other Tools
Useask_user_for_input alongside other tools for powerful workflows:
Client Integration
Streaming Responses
When usingstream=true, check the phase field to detect when the agent waits:
Non-Streaming Responses
Without streaming, check the response status:Conversation State
Waiting State
When an agent invokesask_user_for_input:
- Phase:
"waiting_for_input" - Message: The agent’s question
- Turn: The conversation remains on the same turn
- Memory: The tool call and question are saved
Resume State
When the user responds:- Phase:
"completed"(or other non-waiting state) - Message: The agent’s continued response
- Turn: Advances to next turn
- Memory: The user’s answer and agent’s continuation are saved

