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

# set_speech_event_timeout

> Adjust the speech event timeout for noisy environments.

[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**

**`milliseconds`** `int` — required

Timeout in milliseconds.

---

## **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()
```