Support deferred custom tools in tool search (#36998)

## What changed

- Include top-level freeform tools in the tool-search index and mark them for deferred loading.
- Serialize searched freeform tools as Responses API `custom` tools and convert them back into executable tool specs after discovery.
- Cover indexing and the end-to-end search, load, and custom-call routing flow.

GitOrigin-RevId: 124a7705876067542e1bd609546adc9a8d0ef67e
This commit is contained in:
rka-oai authored and copyberry committed 2026-08-05 00:38:44 +00:00
1 parent e87e2b495b
commit 431c78eb9c
5 files changed
+181 -4

No files matched your search

+5 -1
View File
@@ -38,6 +38,10 @@ impl ToolSearchInfo {
tool.output_schema = None;
LoadableToolSpec::Function(tool)
}
ToolSpec::Freeform(mut tool) => {
tool.defer_loading = Some(true);
LoadableToolSpec::Custom(tool)
}
ToolSpec::Namespace(mut namespace) => {
if namespace.description.trim().is_empty() {
namespace.description = default_namespace_description(&namespace.name);
@@ -55,7 +59,7 @@ impl ToolSearchInfo {
}
LoadableToolSpec::Namespace(namespace)
}
ToolSpec::ToolSearch { .. } | ToolSpec::WebSearch { .. } | ToolSpec::Freeform(_) => {
ToolSpec::ToolSearch { .. } | ToolSpec::WebSearch { .. } => {
return None;
}
};