diff --git a/codex-rs/core/src/agent/control/spawn.rs b/codex-rs/core/src/agent/control/spawn.rs index 20e28a8bfed7..8c51f05a5c23 100644 --- a/codex-rs/core/src/agent/control/spawn.rs +++ b/codex-rs/core/src/agent/control/spawn.rs @@ -925,6 +925,7 @@ impl LocalAgentControl { turn_trigger: options.turn_trigger, root_turn_id: options.root_turn_id, cyber_access_program: options.cyber_access_program, + final_output_json_schema: options.final_output_json_schema, ..Default::default() }; let input_admission_started_at = Instant::now(); diff --git a/codex-rs/core/src/agent/types.rs b/codex-rs/core/src/agent/types.rs index 852a51671364..7b80eeae9395 100644 --- a/codex-rs/core/src/agent/types.rs +++ b/codex-rs/core/src/agent/types.rs @@ -36,6 +36,9 @@ pub struct SpawnAgentOptions { pub environments: Option, pub multi_agent_v2_usage_hints: Option, pub cyber_access_program: Option, + /// JSON schema the child's first turn must satisfy as its final output. + /// Plumbed into `TurnStartOptions::final_output_json_schema`; not re-validated here. + pub final_output_json_schema: Option, } /// Identity and status observed from a loaded agent, without a handle to its runtime. diff --git a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs index 94079e0ebad4..0efe9c56e7f2 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs @@ -134,6 +134,7 @@ async fn handle_spawn_agent( environments: Some(step_context.environments.clone()), multi_agent_v2_usage_hints: None, cyber_access_program: turn.cyber_access_program, + final_output_json_schema: args.output_schema, }, }) .await @@ -224,6 +225,9 @@ struct SpawnAgentArgs { reasoning_effort: Option, #[serde(default)] fork_context: bool, + /// JSON schema the child's first turn must satisfy as its final output. + #[serde(default)] + output_schema: Option, } #[derive(Debug, Serialize)] diff --git a/codex-rs/core/src/tools/handlers/multi_agents_spec.rs b/codex-rs/core/src/tools/handlers/multi_agents_spec.rs index edc9467b4d02..0b895a94579c 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_spec.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_spec.rs @@ -643,6 +643,16 @@ fn spawn_agent_common_properties_v1(agent_type_description: &str) -> BTreeMap BTreeMap, fork_turns: Option, fork_context: Option, + /// JSON schema the child's first turn must satisfy as its final output. + #[serde(default)] + output_schema: Option, } impl SpawnAgentArgs { diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_active_environment_selection.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_active_environment_selection.snap index 2c899e4a82ba..49a7a1a1ec1d 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_active_environment_selection.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_active_environment_selection.snap @@ -6,7 +6,7 @@ Scenario: Astra starts in one workspace, switches for the next step of the activ ## Window 1 -- request 1 (turn) -- -00:additional_tools/developer (3; hash=62160ed28e692c35): +00:additional_tools/developer (3; hash=299a25860327c501): - namespace/functions; hash=4261ffb241688b3d - custom/exec - function/wait @@ -14,7 +14,7 @@ Scenario: Astra starts in one workspace, switches for the next step of the activ - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_async_question_and_answer.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_async_question_and_answer.snap index 815d076e4f2f..50ee5c00eeab 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_async_question_and_answer.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_async_question_and_answer.snap @@ -7,7 +7,7 @@ Scenario: Astra uses the catalog question schema to ask who a launch update is f ## Window 1 -- request 1 (request) -- -00:additional_tools/developer (3; hash=f181967456befa67): +00:additional_tools/developer (3; hash=4bdada565c53ed1b): - namespace/functions; hash=7e611b8ddd5621cf - custom/exec - function/wait @@ -15,7 +15,7 @@ Scenario: Astra uses the catalog question schema to ask who a launch update is f - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_disabled_executor_skills.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_disabled_executor_skills.snap index ce4690a6d0d3..3063cf6ad2bb 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_disabled_executor_skills.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_disabled_executor_skills.snap @@ -16,7 +16,7 @@ Settings: text: {"verbosity":"low"} tool_choice: "auto" -- request 1 (request) -- -00:additional_tools/developer (3; hash=5e8370540461db70): +00:additional_tools/developer (3; hash=832399eb45cc415c): - namespace/functions; hash=7d26e086c1dbba28 - custom/exec - function/wait @@ -24,7 +24,7 @@ Settings: - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_input_interrupts_response.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_input_interrupts_response.snap index b81315dda0b1..41ce44f825a4 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_input_interrupts_response.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_input_interrupts_response.snap @@ -6,7 +6,7 @@ Scenario: Astra receives new user input after its unfinished response is interru ## Window 1 -- request 1 (request) -- -00:additional_tools/developer (3; hash=bf2e30605ff5dc17): +00:additional_tools/developer (3; hash=82ca56c2b440b56b): - namespace/functions; hash=fada4a476a3754dd - custom/exec - function/wait @@ -14,7 +14,7 @@ Scenario: Astra receives new user input after its unfinished response is interru - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_kickoff_remote_compaction_windows.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_kickoff_remote_compaction_windows.snap index 29a6122a3924..70db6d67b7c3 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_kickoff_remote_compaction_windows.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__astra_kickoff_remote_compaction_windows.snap @@ -16,7 +16,7 @@ Settings: text: {"verbosity":"low"} tool_choice: "auto" -- request 1 (turn) -- -00:additional_tools/developer (3; hash=bf2e30605ff5dc17): +00:additional_tools/developer (3; hash=82ca56c2b440b56b): - namespace/functions; hash=fada4a476a3754dd - custom/exec - function/wait @@ -24,7 +24,7 @@ Settings: - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents @@ -187,7 +187,7 @@ Settings: ## Window 2 (after request 3: input diverged at item 02) Settings: same as window 1 -- request 4 (turn) -- -00:additional_tools/developer (3; hash=bf2e30605ff5dc17): +00:additional_tools/developer (3; hash=82ca56c2b440b56b): - namespace/functions; hash=fada4a476a3754dd - custom/exec - function/wait @@ -195,7 +195,7 @@ Settings: same as window 1 - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__compaction__remote_slash_compact.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__compaction__remote_slash_compact.snap index 4e78cadff514..c6aaccfa8e05 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__compaction__remote_slash_compact.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__compaction__remote_slash_compact.snap @@ -16,7 +16,7 @@ Settings: text: {"verbosity":"low"} tool_choice: "auto" -- request 1 (turn; Before /compact) -- -00:additional_tools/developer (3; hash=bf2e30605ff5dc17): +00:additional_tools/developer (3; hash=82ca56c2b440b56b): - namespace/functions; hash=fada4a476a3754dd - custom/exec - function/wait @@ -24,7 +24,7 @@ Settings: - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents @@ -164,7 +164,7 @@ Settings: unavailable (items only) ## Window 3 (after request 3: input diverged at item 00) Settings: same as window 1 -- request 4 (turn; First turn after /compact) -- -00:additional_tools/developer (3; hash=bf2e30605ff5dc17): +00:additional_tools/developer (3; hash=82ca56c2b440b56b): - namespace/functions; hash=fada4a476a3754dd - custom/exec - function/wait @@ -172,7 +172,7 @@ Settings: same as window 1 - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__model_catalog_refresh_preserves_tools_and_history.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__model_catalog_refresh_preserves_tools_and_history.snap index e7d2ffa51ee7..1df05913d656 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__model_catalog_refresh_preserves_tools_and_history.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__model_catalog_refresh_preserves_tools_and_history.snap @@ -14,12 +14,12 @@ Settings: store: false stream: true tool_choice: "auto" - tools (6; hash=1ea0fa9abde186d4): + tools (6; hash=cfc3c98a78e70ca0): - function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5 - function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2 - function/request_user_input: Request user input for one to three short questions and wait for the response. This tool is only ...; args=[questions]; hash=64a729b25c424fc6 - function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[path]; hash=1908de9c0be7118a - - namespace/multi_agent_v1: Tools for spawning and managing sub-agents.; hash=94c598b3c6ca141b + - namespace/multi_agent_v1: Tools for spawning and managing sub-agents.; hash=3600df73976fc1a7 - function/close_agent - function/resume_agent - function/send_input diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__multi_agent_catalog_parameters.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__multi_agent_catalog_parameters.snap index 5fb3ec889e96..3426e88f57de 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__multi_agent_catalog_parameters.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__multi_agent_catalog_parameters.snap @@ -16,7 +16,7 @@ Settings: text: {"verbosity":"low"} tool_choice: "auto" -- request 1 (turn) -- -00:additional_tools/developer (3; hash=2b84850bc279e5ed): +00:additional_tools/developer (3; hash=29ec89a35debc3c9): - namespace/functions; hash=fada4a476a3754dd - custom/exec - function/wait @@ -24,7 +24,7 @@ Settings: - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=7e156cf57f85af87 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=c9dc64d781a79893 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__provider_capabilities__custom_provider_capabilities.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__provider_capabilities__custom_provider_capabilities.snap index ade1be5bcfe3..f5897fd28e24 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__provider_capabilities__custom_provider_capabilities.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__provider_capabilities__custom_provider_capabilities.snap @@ -15,12 +15,12 @@ Settings: stream: true text: {"verbosity":"low"} tool_choice: "auto" - tools (6; hash=dde875513b2c7cff): + tools (6; hash=7034b0984ef6658b): - function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5 - function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2 - function/request_user_input: Request user input for one to three short questions and wait for the response. This tool is only ...; args=[questions]; hash=64a729b25c424fc6 - function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[detail, path]; hash=3b766d5bdec5d50e - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=3cbf715dc154e1b7 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=9cb3fe3bf82d4343 - function/followup_task - function/interrupt_agent - function/list_agents diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap index 3dcc2d2c8ab8..050b4509ac42 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap @@ -16,7 +16,7 @@ Settings: text: {"verbosity":"low"} tool_choice: "auto" -- request 1 (turn) -- -00:additional_tools/developer (3; hash=e80da11342c6e6dd): +00:additional_tools/developer (3; hash=11140157658710d9): - namespace/functions; hash=bd9e182b4235cdc1 - custom/exec - function/wait @@ -24,7 +24,7 @@ Settings: - function/request_user_input_async - namespace/clock: Tools for reading and waiting on time.; hash=f402e8c5e9b5e317 - function/sleep - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=2c8d6295978dbe63 + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=48f7a334813023a7 - function/followup_task - function/interrupt_agent - function/list_agents