***

title: set_speech_event_timeout
slug: /reference/python/agents/function-result/set-speech-event-timeout
description: Adjust the speech event timeout for noisy environments.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[set-end-of-speech-timeout]: /docs/server-sdks/reference/python/agents/function-result/set-end-of-speech-timeout

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Adjust the speech event timeout. This controls how many milliseconds since the
last speech detection event to wait before finalizing recognition. This timeout
works better than [`set_end_of_speech_timeout()`][set-end-of-speech-timeout]
in noisy environments.

## **Parameters**

<ParamField path="milliseconds" type="int" required={true} toc={true}>
  Timeout in milliseconds.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Example**

```python {12}
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="configure_timeouts", description="Configure speech recognition timeouts")
def configure_timeouts(args, raw_data):
    return (
        FunctionResult()
        .set_end_of_speech_timeout(800)
        .set_speech_event_timeout(5000)
    )

agent.serve()
```