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 Agent
2from kern.tools.user_control_flow import UserControlFlowTools
3
4agent = 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)
13
14agent.print_response("Help me create a personalized workout plan", stream=True)

Toolkit Params

ParameterTypeDefaultDescription
instructionsOptional[str]NoneCustom instructions for user interaction behavior.
add_instructionsboolTrueWhether to add instructions to the agent.
enable_get_user_inputboolTrueEnable user input request functionality.

Toolkit Functions

FunctionDescription
get_user_inputPause agent execution and request input from the user.

Developer Resources