mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
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:
committed by
GitHub
Unverified
parent
157fffc6a4
commit
fc26af377f
@@ -117,6 +117,7 @@ pub struct ToolsConfig {
|
||||
pub collab_tools: bool,
|
||||
pub goal_tools: bool,
|
||||
pub multi_agent_v2: bool,
|
||||
pub multi_agent_v2_non_code_mode_only: bool,
|
||||
pub hide_spawn_agent_metadata: bool,
|
||||
pub spawn_agent_usage_hint: bool,
|
||||
pub spawn_agent_usage_hint_text: Option<String>,
|
||||
@@ -257,6 +258,7 @@ impl ToolsConfig {
|
||||
collab_tools: include_collab_tools,
|
||||
goal_tools: include_goal_tools,
|
||||
multi_agent_v2: include_multi_agent_v2,
|
||||
multi_agent_v2_non_code_mode_only: false,
|
||||
hide_spawn_agent_metadata: false,
|
||||
spawn_agent_usage_hint: true,
|
||||
spawn_agent_usage_hint_text: None,
|
||||
@@ -314,6 +316,15 @@ impl ToolsConfig {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_multi_agent_v2_non_code_mode_only(
|
||||
mut self,
|
||||
multi_agent_v2_non_code_mode_only: bool,
|
||||
) -> Self {
|
||||
self.multi_agent_v2_non_code_mode_only =
|
||||
self.multi_agent_v2 && multi_agent_v2_non_code_mode_only;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_goal_tools_allowed(mut self, allowed: bool) -> Self {
|
||||
self.goal_tools = self.goal_tools && allowed;
|
||||
self
|
||||
|
||||
@@ -5,12 +5,30 @@ use crate::ToolName;
|
||||
use crate::ToolOutput;
|
||||
use crate::ToolSpec;
|
||||
|
||||
/// Controls whether a tool is exposed in the initial model-visible tool list
|
||||
/// or registered for later discovery.
|
||||
/// Controls where a tool is exposed to the model.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum ToolExposure {
|
||||
/// Include this tool in the initial model-visible tool list.
|
||||
///
|
||||
/// When code mode is enabled, this tool is also available as a nested
|
||||
/// code-mode tool.
|
||||
Direct,
|
||||
|
||||
/// Register this tool for later discovery, but omit it from the initial
|
||||
/// model-visible tool list.
|
||||
Deferred,
|
||||
|
||||
/// Include this tool in the initial model-visible tool list only.
|
||||
///
|
||||
/// In code-mode-only sessions, this keeps the tool callable as a normal
|
||||
/// model tool while excluding it from the nested code-mode tool surface.
|
||||
DirectModelOnly,
|
||||
}
|
||||
|
||||
impl ToolExposure {
|
||||
pub fn is_direct(self) -> bool {
|
||||
matches!(self, Self::Direct | Self::DirectModelOnly)
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared runtime contract for model-visible tools.
|
||||
|
||||
Reference in New Issue
Block a user