higgs-realtime-1.5 calls tools asynchronously. A tool call does not pause the conversation: while it runs, the user can keep talking and the model keeps answering. When the result arrives, the model works it into the conversation.
Your existing function tool code works unchanged. This page covers what the model does on its own, and what you can add:
Asynchronous tool calls need
higgs-realtime-1.5. higgs-realtime accepts timeout_sec and cancellable on a tool and ignores them: it sends no status items and never cancels a call.How a call runs
- The model calls the tool. It may say a short line first (“Let me check that for you.”). The response ends with
response.donecarrying thefunction_callitem, as for any tool call. - Your client starts the work. The conversation stays open meanwhile: the user can ask something else, and the model answers it.
- Your client returns the result with
conversation.item.create(function_call_output) and sendsresponse.create. The model speaks the answer.
- The model is still speaking. A
response.createthat follows a tool result never cuts the model off: the reply starts when it finishes. - The user is speaking. The
response.createis rejected with anerror(code: "user_speech_in_progress"). Don’t retry it: the result is already in the conversation, and the reply to what the user is saying takes it into account.
Return each result as it arrives
The server does not continue by itself after your function tool’s result: as with any function tool, the model replies when you sendresponse.create. What changes with higgs-realtime-1.5 is that you don’t have to collect all of a response’s results first.
When a response makes several calls, return each result as soon as you have it and send response.create after each one. The model answers the fast call first and the slow one when it lands.
Who starts the model’s reply depends on what arrived:
Run each call as its own task, so your receive loop keeps reading events while tools work:
Status updates
When a call has run for 10 seconds without a result, the server adds afunction_call_status item to the conversation. The model can then tell the user that it is still working on it.
- It arrives like any item:
conversation.item.added, thenconversation.item.done, in theprevious_item_idchain. - You don’t need to act on it. The server starts the model’s reply by itself, so don’t send
response.createfor a status. If the model is speaking or the user is talking, the status waits until that turn ends. - It is not the tool’s output. Keep the call running, and return its result when you have it.
statusis not the call’s state. It is the item’s own lifecycle, as on every item, and is alwayscompleted. The call’s state iscall_status.- Server-side tools get them too. A
web_searchthat runs long produces the samein_progressitem. - Only the server creates them. A
conversation.item.createwith afunction_call_statusitem is rejected with anerror.
Timeouts
A function tool call never times out by default. Settimeout_sec on the tool to give its calls a limit:
- Value: a number of seconds greater than
0. - When a call passes it, the server adds a
function_call_statusitem withcall_status: "timed_out", and the model reacts: typically it tells the user, and it may call the tool again. A retry is a new call with its owncall_id. - A late result is still accepted. If your client returns the
function_call_outputafter the timeout, it is added to the conversation as usual. - The model never sees the field. You don’t need to describe the limit in the tool’s description.
Cancellation
Mark a toolcancellable to let the model stop a call of it that is still running:
response.function_call.cancel:
call_id. You don’t need to return a result or send response.create: the model goes on with the conversation by itself, for example by calling the tool again with the corrected arguments.
- Mark only tools that are safe to stop. A lookup is. A write that can’t be undone is not: leave
cancellableoff (the default), and the model lets the call finish. - A result that still arrives is accepted. If your client could not stop in time and returns the
function_call_output, it is added to the conversation. - Don’t describe cancellation yourself. While any tool is
cancellable, the server adds a sentence to each tool’s description that tells the model whether it can be cancelled. - What you see on the wire: the model cancels through a server-side tool named
cancel_task. It appears as afunction_callitem withexecutor: "server"and itsfunction_call_output, which need no action. Its arguments name the call by the model’s own short id (such asc3), not by yourcall_id. Take thecall_idfromresponse.function_call.cancel. cancel_taskis a reserved name. Withhiggs-realtime-1.5, asession.updatethat declares a function tool namedcancel_taskfails.- Function tools only.
web_searchcannot be markedcancellable.
Session acknowledgements
session.created and session.updated echo your tools without timeout_sec and cancellable. Keep your own tool definitions and send those in later session.update events, not the echoed ones.
Related
Tool use
Declaring function tools and web search, and returning results.
Server events
response.function_call.cancel and the function_call_status item.