Skip to content

feat(subagents): read pi's model:level suffix for a run's thinking (#1188) - #1189

Merged
agegr merged 1 commit into
mainfrom
claude/subagent-model-level-1188
Oct 11, 2026
Merged

agegr merged 1 commit into
mainfrom
claude/subagent-model-level-1188

Conversation

@agegr

@agegr agegr commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Closes #1188.

Problem

A delegated run can pick its model (Agent({ model })) but not its thinking level: the level comes from the profile, or from the parent when the profile sets none. Writing provider/model:high fails with Subagent model not found.

#1138 deliberately removed a per-call thinking parameter, because models filled it in by guesswork and silently overrode the profile. This PR does not bring that parameter back.

Change

Model references now read the way pi's own --model reads them: provider/modelId or a bare id, optionally followed by :<thinking level>. In pi this already works for a subagent profile's model:, since pi's subagent example passes it to --model.

  • Parsing (parseSubagentModel): the whole reference is tried first, so an id that contains a colon (qwen3:8b) still matches. Then a trailing valid level (off…max) is split off. Any other suffix is refused, as in pi's strict --model parsing.
  • Precedence: a call's model: "x:high" sets that run's level over the profile's thinking. A call that names a model without a level keeps the profile's thinking, as before. Within a profile, thinking: wins over a level on its own model:, mirroring --thinking over --model x:level. pi clamps the level to what the model supports.
  • Tool description: each profile's line lists Thinking: <level> beside Model:, and the model parameter documents the suffix. Resume still rejects model, so a running child keeps its level.
  • Agents panel: a profile model with a suffix shows as its base model with the reference as written, instead of "unavailable".
  • docs/agents/subagents.md and the demo's captured Agent schema are updated.

Testing

  • New runtime integration tests against a real AgentSession with the faux provider:
    • a call's level beats the profile's thinking, and a call without a level keeps it;
    • a profile model's level applies unless the profile sets thinking;
    • a colon id (tuned:high) matches whole;
    • :turbo is refused.
  • On the old runtime, the first two fail with Subagent model not found: faux/faux-model:high.
  • Unit test for the panel's profileModelBase(); the extension test pins Thinking: in the description.
  • tsc --noEmit (root and demo), eslint, and npm test all pass: 2624 pass, 1 skip, 0 fail.
  • Not checked in a browser: the Agents panel label.

🤖 Generated with Claude Code

…1188)

A delegated run could pick its model but not its thinking level: the
level came from the profile (or the parent), and `provider/model:high`
failed with "Subagent model not found". pi's own `--model` reads that
suffix as the model plus its level, and pi's subagent example passes a
profile's model to `--model`, so the same reference already works there.

- `parseSubagentModel` tries the whole reference first (an id such as
  `qwen3:8b` still matches), then a trailing valid thinking level; any
  other suffix is refused, as pi's strict `--model` parsing does.
- A call's `model: "x:high"` sets that run's level over the profile's
  `thinking`; a call naming a model without a level keeps the profile's.
  Within a profile, `thinking:` beats a level on its own `model:`, like
  `--thinking` over `--model x:level`. No `thinking` parameter returns,
  so the guessing #1138 removed stays out.
- The `Agent` description lists each profile's thinking beside its model,
  and the `model` parameter documents the suffix.
- The Agents panel shows such a profile model as its base model with the
  reference as written, instead of "unavailable".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agegr
agegr merged commit 445b58c into main Oct 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: allow explicit per-call thinking level overrides in built-in Agent tool

1 participant