enable_functions_on_timeout

View as MarkdownOpen in Claude

Control whether SWAIG functions can be called when a speaker timeout occurs. When enabled, the agent can invoke functions after the user has been silent for the configured timeout period.

Parameters

enabled
boolDefaults to True

True to allow function calls on speaker timeout, False to disable.

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="enable_escalation_on_timeout", description="Enable function calls on timeout")
8def enable_escalation_on_timeout(args, raw_data):
9 return (
10 FunctionResult("I'll help you with that.")
11 .enable_functions_on_timeout(enabled=True)
12 )
13
14agent.serve()