Function Call Cancelled
The Voice Agent server sends FunctionCallCancelled when a client-side function call it already sent you is cancelled because the user started speaking again, either inside the speculative window (the turn resumed) or after the turn was confirmed (barge-in). Only calls the client already received are announced.
Purpose
The agent begins building a reply before the user’s turn is confirmed. Function calls produced in that window are dispatched immediately unless the function sets defer_until_eot. When the turn resumes, those calls are cancelled, and this message tells you which ones. The same message arrives when the user barges in after the turn was confirmed and the agent abandons the reply that produced the call.
Without it, a client holding a FunctionCallRequest cannot tell a live request from an abandoned one. For background on the window itself, see Speculative Replies & Turn Confirmation.
When you receive it
The server sends this message only for calls it already sent you, whether the cancellation came from a resumed turn or from a barge-in after the turn was confirmed. A call that was still held when the turn resumed was never announced, so there is nothing to cancel and no message arrives.
Handling the message
When your client receives a FunctionCallCancelled:
- Stop any work in progress for each
idin the list. - Do not send a
FunctionCallResponsefor those ids. A late response is dropped. - Roll back anything you already committed, if your function is not idempotent. Better still, set
defer_until_eot: trueon functions that cannot be rolled back, so they never fire speculatively.
Example payload
Fields
Related messages
FunctionCallRequest: The message this one cancels.UserStartedSpeaking: Sent when the turn resumes, which is what triggers the cancellation.- Speculative Replies & Turn Confirmation: Why calls can be cancelled, and how to stop it happening.