feat: expose multi-agent v2 as model-only tools (#22514)

## Why

`code_mode_only` filters code-mode nested tools out of the top-level
tool list. For multi-agent v2, we need a rollout shape where the
collaboration tools remain callable as normal model tools without also
being embedded into the code-mode `exec` tool declaration.

Related to this:
https://openai-corpws.slack.com/archives/C0AQLHB4U75/p1778660267922549

## What Changed

- Adds `features.multi_agent_v2.non_code_mode_only`, including config
resolution, profile override handling, and generated schema coverage.
- Introduces `ToolExposure::DirectModelOnly` so a tool can be included
in the initial model-visible list while staying out of the nested
code-mode tool surface.
- Applies that exposure to the multi-agent v2 tools when the new flag is
set: `spawn_agent`, `send_message`, `followup_task`, `wait_agent`,
`close_agent`, and `list_agents`.
- Updates code-mode-only filtering so direct-model-only tools remain
visible while ordinary nested code-mode tools are still hidden.

## Verification

- Added config parsing/profile tests for `non_code_mode_only`.
- Added tool spec coverage for the code-mode-only multi-agent v2
exposure behavior.
This commit is contained in:
jif-oai
2026-05-13 19:49:47 +02:00
committed by GitHub
Unverified
parent 157fffc6a4
commit fc26af377f
13 changed files with 269 additions and 32 deletions
+6
View File
@@ -9656,6 +9656,7 @@ usage_hint_text = "Custom delegation guidance."
root_agent_usage_hint_text = "Root guidance."
subagent_usage_hint_text = "Subagent guidance."
hide_spawn_agent_metadata = true
non_code_mode_only = true
"#,
)?;
@@ -9683,6 +9684,7 @@ hide_spawn_agent_metadata = true
Some("Subagent guidance.")
);
assert!(config.multi_agent_v2.hide_spawn_agent_metadata);
assert!(config.multi_agent_v2.non_code_mode_only);
Ok(())
}
@@ -9702,6 +9704,7 @@ usage_hint_text = "base hint"
root_agent_usage_hint_text = "base root hint"
subagent_usage_hint_text = "base subagent hint"
hide_spawn_agent_metadata = true
non_code_mode_only = false
[profiles.no_hint.features.multi_agent_v2]
max_concurrent_threads_per_session = 6
@@ -9711,6 +9714,7 @@ usage_hint_text = "profile hint"
root_agent_usage_hint_text = "profile root hint"
subagent_usage_hint_text = "profile subagent hint"
hide_spawn_agent_metadata = false
non_code_mode_only = true
"#,
)?;
@@ -9736,6 +9740,7 @@ hide_spawn_agent_metadata = false
Some("profile subagent hint")
);
assert!(!config.multi_agent_v2.hide_spawn_agent_metadata);
assert!(config.multi_agent_v2.non_code_mode_only);
Ok(())
}
@@ -9759,6 +9764,7 @@ enabled = true
assert_eq!(config.multi_agent_v2.max_concurrent_threads_per_session, 4);
assert_eq!(config.multi_agent_v2.min_wait_timeout_ms, 10_000);
assert_eq!(config.agent_max_threads, Some(3));
assert!(!config.multi_agent_v2.non_code_mode_only);
Ok(())
}
+7
View File
@@ -846,6 +846,7 @@ pub struct MultiAgentV2Config {
pub root_agent_usage_hint_text: Option<String>,
pub subagent_usage_hint_text: Option<String>,
pub hide_spawn_agent_metadata: bool,
pub non_code_mode_only: bool,
}
impl Default for MultiAgentV2Config {
@@ -859,6 +860,7 @@ impl Default for MultiAgentV2Config {
root_agent_usage_hint_text: None,
subagent_usage_hint_text: None,
hide_spawn_agent_metadata: false,
non_code_mode_only: false,
}
}
}
@@ -1995,6 +1997,10 @@ fn resolve_multi_agent_v2_config(
.and_then(|config| config.hide_spawn_agent_metadata)
.or_else(|| base.and_then(|config| config.hide_spawn_agent_metadata))
.unwrap_or(default.hide_spawn_agent_metadata);
let non_code_mode_only = profile
.and_then(|config| config.non_code_mode_only)
.or_else(|| base.and_then(|config| config.non_code_mode_only))
.unwrap_or(default.non_code_mode_only);
MultiAgentV2Config {
max_concurrent_threads_per_session,
@@ -2004,6 +2010,7 @@ fn resolve_multi_agent_v2_config(
root_agent_usage_hint_text,
subagent_usage_hint_text,
hide_spawn_agent_metadata,
non_code_mode_only,
}
}