Add xAI realtime provider tools#1583
Conversation
🦋 Changeset detectedLatest commit: bd921b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
42b9982 to
bd921b1
Compare
|
|
There was a problem hiding this comment.
🔴 Reconnect skips restoring xAI provider tools when no function tools are present
The reconnect() method in OpenAIRealtimeSession at plugins/openai/src/realtime/realtime_model.ts:1002 only checks Object.keys(this._tools.functionTools).length > 0 before sending the tools update event. Since functionTools only returns function tools (not provider tools), if an xAI session is configured with only provider tools (e.g., WebSearch, XSearch, FileSearch) and no function tools, those tools will not be sent to the server during reconnection. After the default 20-minute maxSessionDuration triggers a reconnect, the xAI provider tools are silently lost.
Reconnect condition only checks function tools
At plugins/openai/src/realtime/realtime_model.ts:1002-1004:
if (Object.keys(this._tools.functionTools).length > 0) {
events.push(this.createToolsUpdateEvent(this._tools));
}functionTools (agents/src/llm/tool_context.ts:287-289) only returns entries from _functionToolsMap, not _providerTools. The xAI RealtimeSession overrides createToolsUpdateEvent to append provider tools, but that method is never called when this condition is false.
(Refers to lines 1002-1004)
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Stacked on #1576 for the ProviderTool base abstraction, mirroring #1582's provider-tool pattern for xAI.
Testing