User Control Flow
UserControlFlowTools enable agents to pause execution and request input from users during conversations.
Example
The following agent can request user input during conversations:
1from kern.agent import Agent2from kern.tools.user_control_flow import UserControlFlowTools34agent = Agent(5 instructions=[6 "You are an interactive assistant that can ask users for input when needed",7 "Use user input requests to gather specific information or clarify requirements",8 "Always explain why you need the user input and how it will be used",9 "Provide clear prompts and instructions for user responses",10 ],11 tools=[UserControlFlowTools()],12)1314agent.print_response("Help me create a personalized workout plan", stream=True)Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
instructions | Optional[str] | None | Custom instructions for user interaction behavior. |
add_instructions | bool | True | Whether to add instructions to the agent. |
enable_get_user_input | bool | True | Enable user input request functionality. |
Toolkit Functions
| Function | Description |
|---|---|
get_user_input | Pause agent execution and request input from the user. |