set_end_of_speech_timeout

View as MarkdownOpen in Claude

Adjust the end-of-speech timeout. This controls how many milliseconds of silence after detected speech are required before the system finalizes speech recognition. A shorter value makes the agent respond faster; a longer value gives the caller more time to pause mid-sentence.

Parameters

milliseconds
intRequired

Timeout in milliseconds.

Returns

FunctionResult — self, for chaining.

Example

from signalwire import AgentBase
from signalwire import FunctionResult
agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")
@agent.tool(name="speed_up_response", description="Reduce speech timeout for faster responses")
def speed_up_response(args, raw_data):
return (
FunctionResult()
.set_end_of_speech_timeout(500)
)
agent.serve()