Skip to main content
After a reply, the basic voice agent waits for the caller indefinitely. Add an idle policy when you want it to check whether the caller still needs help.

Ask whether the caller is still there

Keep the dict-based configuration from the earlier lessons and add:
Restart the server, have one exchange, then stay quiet after the assistant finishes. The prompt should play after the idle interval. The timer starts after playback drains and the turn finishes; it does not run while a tool is still working.

Bound a quiet call

Expand the policy to use two prompts and an eventual hangup:
The assistant’s own prompts do not reset the user-silence hangup clock. Omit hangup_after_secs to keep waiting after the prompts. instructions can generate a check-in instead of using fixed text; this adds model generation and speech usage. Empty optional blocks mean unset and preserve server inheritance.

A slow agent turn

The voice turn timeout defaults to 60 seconds. To change it and its spoken fallback:
On expiry the session emits an error and stays open for the next turn. The fallback is spoken only if no audio was produced. An empty string disables the fallback. This bounds the voice turn; Agent.timeout separately bounds the runnable’s execution. Neither a timeout nor hangup rolls back completed side effects. Once the conversation behaves as intended, continue to Recording calls, Transports and phone calls, and Events and usage.