AskUserMiddleware(
self,
*,
system_prompt: str = ASK_USER_SYSTEM_PROMPT,
tool_description: str = ASK_USER_TOOL_DESCRIPTIONMiddleware that provides an ask_user tool for interactive questioning.
This middleware adds an ask_user tool that allows agents to ask the user
questions during execution. Questions can be free-form text or multiple choice.
The tool uses LangGraph interrupts to pause execution and wait for user input.
System-level instructions injected into every LLM
request to guide ask_user usage.
Description string passed to the ask_user tool
decorator, visible to the LLM in the tool schema.
Inject the ask_user system prompt.
Inject the ask_user system prompt (async).