simulate_user_input

View as MarkdownOpen in Claude

Inject text as if the user spoke it. The AI agent processes the injected text exactly as it would process real speech input. Useful for driving automated workflows or confirmations.

Parameters

text
strRequired

Text to inject as simulated user speech.

Returns

FunctionResult — self, for chaining.

Example

1from signalwire import AgentBase
2from signalwire import FunctionResult
3
4agent = AgentBase(name="my-agent", route="/agent")
5agent.set_prompt_text("You are a helpful assistant.")
6
7@agent.tool(name="auto_confirm", description="Automatically confirm the action")
8def auto_confirm(args, raw_data):
9 return (
10 FunctionResult()
11 .simulate_user_input("yes, I confirm")
12 )
13
14agent.serve()