Skip to content

Add service tier overrides to spawned agents#22139

Merged
aibrahim-oai merged 4 commits into
mainfrom
dev/spawn-agent-service-tier
May 13, 2026
Merged

Add service tier overrides to spawned agents#22139
aibrahim-oai merged 4 commits into
mainfrom
dev/spawn-agent-service-tier

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

@aibrahim-oai aibrahim-oai commented May 11, 2026

Why

Spawned agents can already override model and reasoning_effort, but they have no equivalent way to opt into a model-supported service tier. That makes it impossible to preserve or intentionally select tiered execution behavior when delegating work to a sub-agent, even though the model catalog already advertises supported service_tiers.

What changed

  • Add optional service_tier to both legacy and MultiAgentV2 spawn_agent tool inputs.
  • Show each picker-visible model's supported service tier ids and descriptions in the spawn_agent tool guidance.
  • Resolve service tier selection after the child agent's effective model is known.
  • Inherit the parent tier when omitted and still supported by the final child model; otherwise clear it.
  • Reject explicit unsupported tier requests with a model-facing error.
  • Keep explicit service_tier usable on full-history forks, while still honoring the existing model/reasoning fork restrictions.
  • Hide service_tier alongside other spawn metadata when hide_spawn_agent_metadata is enabled.

Verification

Added focused coverage for:

  • v1/v2 spawn_agent schema exposure for service_tier
  • tier descriptions in spawn guidance
  • hidden-metadata suppression
  • explicit supported tier selection
  • explicit unknown and unsupported tier rejection
  • inherited tier preservation or clearing based on child-model support
  • full-history fork acceptance for explicit service tiers in both v1 and v2

Local Rust tests were not run in this workspace per repo guidance; the new coverage is included for CI.

@aibrahim-oai aibrahim-oai marked this pull request as ready for review May 11, 2026 11:54
@aibrahim-oai aibrahim-oai requested a review from a team as a code owner May 11, 2026 11:54
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's simplify a bit the tests but that's good for me


const SPAWN_AGENT_INHERITED_MODEL_GUIDANCE: &str = "Spawned agents inherit your current model by default. Omit `model` to use that preferred default; set `model` only when an explicit override is needed.";
const SPAWN_AGENT_MODEL_OVERRIDE_DESCRIPTION: &str = "Optional model override for the new agent. Leave unset to inherit the same model as the parent, which is the preferred default. Only set this when the user explicitly asks for a different model or the task clearly requires one.";
const SPAWN_AGENT_SERVICE_TIER_OVERRIDE_DESCRIPTION: &str = "Optional service tier override for the new agent. Leave unset unless the user explicitly asks for a service tier override. When unset, the spawned agent inherits the parent's active service tier if its effective model supports it; otherwise no service tier is used.";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"When unset, the spawned agent inherits the parent's active service tier if its effective model supports it; otherwise no service tier is used."
This sounds like a lot of information for 0-shot (and so consuming some useless tokens

@@ -444,6 +445,311 @@ async fn multi_agent_v2_spawn_defaults_to_full_fork_and_rejects_child_model_over
);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a lot of tests to test every single combination. But could we have just one test that has multiple assertion? This would unclog a bit CI

requested_service_tier: Option<&str>,
) -> Result<(), FunctionCallError> {
let Some(candidate_service_tier) = requested_service_tier.or(parent_service_tier) else {
config.service_tier = None;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do really want to set it to None? I feel like we should just ignore but keep what was already in the config

Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's simplify a bit the tests but that's good for me

@aibrahim-oai aibrahim-oai merged commit 87de4e3 into main May 13, 2026
44 of 47 checks passed
@aibrahim-oai aibrahim-oai deleted the dev/spawn-agent-service-tier branch May 13, 2026 15:11
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants