diff --git a/assistant/src/runtime/routes/llm-context-normalization.ts b/assistant/src/runtime/routes/llm-context-normalization.ts index 09d90997fbf..1ab54822278 100644 --- a/assistant/src/runtime/routes/llm-context-normalization.ts +++ b/assistant/src/runtime/routes/llm-context-normalization.ts @@ -400,7 +400,8 @@ function normalizeOpenAiResponsesResponsePayload( output.some( (item) => asString(item.type) === "message" || - asString(item.type) === "function_call", + asString(item.type) === "function_call" || + asString(item.type) === "web_search_call", ); if (!hasResponsesSignal) { return null; @@ -444,6 +445,22 @@ function normalizeOpenAiResponsesResponsePayload( }; toolCallSections.push(section); responseSections.push(section); + continue; + } + + if (itemType === "web_search_call") { + toolCallIndex++; + const status = asString(item.status); + const section: LlmContextSection = { + kind: "tool_use", + label: `Response tool call ${toolCallIndex}`, + role: "assistant", + toolName: "web_search", + data: omitRecordKeys(item, ["type"]) ?? undefined, + text: status ? `[Web search: ${status}]` : "[Web search]", + }; + toolCallSections.push(section); + responseSections.push(section); } }