dazzling-truck-32153
09/15/2025, 7:07 AM# -------------------------------------------------
# Tool functions
# -------------------------------------------------
@function_tool
async def verify_caller(self, ctx: RunContext[HelperSessionInfo], name: str = "") -> Optional[str]:
"""Ask caller for their name and store name"""
logger.info(":white_check_mark: Verify caller")
verification_code = str(uuid.uuid4().int)[:6]
ctx.session.userdata.verification_code = verification_code
ctx.session.userdata.user_name = name
logger.info(f":eyes: code: {verification_code}, name:{name}")
if name and name.strip():
return await self.send_sms_verification_code(ctx)
else:
return
How do i make the llm wait for user to say name then call next functiontall-airline-16756
09/15/2025, 7:07 AMtall-airline-16756
09/15/2025, 7:07 AMdazzling-truck-32153
09/15/2025, 7:08 AMtall-airline-16756
09/15/2025, 7:09 AMread_user_input() to pause execution until the user provides input. For instance: std::getline(std::cin, user_input);
if (std::cin.eof()) return 1; // Waits for user input
• Tool Parameter Validation: In TypeScript, it’s a good idea to check that all required parameters are present before continuing. If something’s missing, you can prompt the user like this: `if (!findItemsById(happyItems, mealId).length) {
throw new llm.ToolError(error: the meal ${mealId} was not found);
}`
• Stateful Confirmation Checks: You might use a function such as wait_for_playout() to make sure the system waits for a clear confirmation from the user before proceeding: await ctx.wait_for_playout();
if (!self._current_email.strip()) {
throw ToolError("error: no email address provided");
}
• Interactive Mode in CLI: For interactive applications, a loop that waits for user input can be very effective: do {
another_line = console::readline(line, params.multiline_input);
buffer += line;
} while (another_line);
These approaches help ensure the LLM pauses until it gets the input it needs. If you’d like me to walk you through any of these examples in more detail, just let me know—I’m here to help! Sources: tools/main/README.md | examples/src/drive-thru/drivethru_agent.ts | livekit-agents/livekit/agents/beta/workflows/email_address.py