***

title: wait_for_user
slug: /reference/python/agents/function-result/wait-for-user
description: Control how the agent pauses and waits for user input.
max-toc-depth: 3
---------------------

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

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

Control how the agent pauses and waits for the user to speak. The arguments
are evaluated in priority order: `answer_first` takes precedence, then
`timeout`, then `enabled`. If none are provided, waiting is enabled with no
timeout.

## **Parameters**

<ParamField path="enabled" type="Optional[bool]" default="None" toc={true}>
  Explicitly enable (`True`) or disable (`False`) waiting for user input.
</ParamField>

<ParamField path="timeout" type="Optional[int]" default="None" toc={true}>
  Number of seconds to wait for the user to speak before the agent continues.
</ParamField>

<ParamField path="answer_first" type="bool" default="False" toc={true}>
  When `True`, activates the special `"answer_first"` mode. This answers the
  call and waits for the user to speak before the agent begins its greeting.
</ParamField>

## **Returns**

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

## **Examples**

### Wait with Timeout

```python {11}
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="wait_for_confirmation", description="Wait for user confirmation")
def wait_for_confirmation(args, raw_data):
    return (
        FunctionResult("Please respond when you're ready.")
        .wait_for_user(timeout=30)
    )

agent.serve()
```

### Disable Waiting

```python {11}
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="disable_wait", description="Continue without waiting for input")
def disable_wait(args, raw_data):
    return (
        FunctionResult("Continuing without waiting.")
        .wait_for_user(enabled=False)
    )

agent.serve()
```