Support deferred loading for freeform tools (#36856)

## What changed

- Add optional `defer_loading` support to freeform Responses API tool definitions.
- Omit the field when it is unset so existing eager tool definitions retain their wire shape.

## Testing

- Verify legacy freeform tool deserialization and eager and deferred serialization shapes.

GitOrigin-RevId: 50e8658a54ac5b6ae0c1dbfe65f7bb62efef561d
This commit is contained in:
rka-oai authored and copyberry committed 2026-08-04 08:24:42 +00:00
1 parent 5af85998c2
commit 12288240b4
7 files changed
+40

No files matched your search

@@ -18,6 +18,7 @@ pub fn create_apply_patch_freeform_tool(include_environment_id: bool) -> ToolSpe
ToolSpec::Freeform(FreeformTool {
name: "apply_patch".to_string(),
description: "The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.".to_string(),
defer_loading: None,
format: FreeformToolFormat {
r#type: "grammar".to_string(),
syntax: "lark".to_string(),
@@ -10,6 +10,7 @@ fn create_apply_patch_freeform_tool_matches_expected_spec() {
description:
"The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON."
.to_string(),
defer_loading: None,
format: FreeformToolFormat {
r#type: "grammar".to_string(),
syntax: "lark".to_string(),