Skip to content

Let a spawn set each task's model and thinking level - #185

Merged
jonaslsaa merged 3 commits into
mainfrom
feature/spawn-model-thinking
Oct 17, 2026
Merged

jonaslsaa merged 3 commits into
mainfrom
feature/spawn-model-thinking

Conversation

@aaaxn

@aaaxn aaaxn commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Part of #184 (model and thinking per spawn; roles are left for the questions in the issue).

Why

Every subagent ran the profile's subagent model. A quick review and a deep one could not use different models or effort without changing the profile setting between spawns.

What changed

  • Each spawn task takes optional model (provider/id) and thinking, in both spawn tools. What a task leaves out comes from the profile.
  • Models are resolved before any child opens. An unknown model refuses the whole spawn, and the error lists the models the user can use.
  • The tool text says to set them only when the user asks, so the profile setting stays the default.

Tradeoffs

  • The tool descriptions do not list the available models: the list would change the cached tool prefix whenever the user logs in to a provider. The error lists them instead, so a wrong guess costs one call.
  • Exact provider/id, as in config.json and the run records. Pi's fuzzy --model matching needs a ModelRuntime that Children does not have.

Blast Radius

Spawns without the new fields behave as before. The spawn tool schema changes, so the main agent's cached prompt is rewritten once after the update.

Verification

  • npm run check, npm test (288 pass) and npm pack --dry-run. The new test fails with the change reverted.
  • Real Pi (verify-pi-optchat, isolated profile on openai/gpt-6-luna:max): asked in plain words for three tasks, the agent spawned Haiku 5.5 at low, the profile model at low, and the profile model at max. Each child session's model_change, thinking_level_change and assistant message match, and the agent view shows claude-haiku-5-5.

Every subagent ran the profile's subagent model, so a quick review and a
deep one could not run at different models or effort without changing the
profile setting between spawns (#184).

The spawn tools' tasks now take optional model (provider/id) and thinking.
What a task leaves out comes from the profile, models are resolved before
any child opens, and an unknown model refuses the spawn with the list of
models the user can use. A resumed child keeps its model and level, as
before.
@jonaslsaa

Copy link
Copy Markdown
Owner

Reviewed and tested on top of main (924e61f): check clean, 289/290 pass, new test fails without the src change as it should. Design is right — per-task override on the profile's subagent model, one shared TASKS schema.

Pushed one line (0427965): a task that names a model now also needs configured auth for its provider (like Pi's own setModel), otherwise a guess at a provider you're not logged in to passed validation and failed in the child's first request. Default path unchanged.

Holding the merge for now.

The model only sees the spawn schema's optional model field; it does not know
which ids Pi is logged in to, nor ids newer than its training. models(provider?)
lists provider/id for every available model with the profile's subagent default
marked, for the main agent and delegating children alike. The main prompt and
the delegation paragraph tell the model to call it when the user names a family
without a version ("Opus").
@jonaslsaa

Copy link
Copy Markdown
Owner

Pushed 2334126: a models(provider?) tool beside spawn (main agent and delegating children), listing provider/id for every model Pi is logged in to with the profile's subagent default marked. The main prompt and the delegation paragraph now say: when the user names a family without a version ("Opus"), assume the newest and call models() for the exact id. Without this the model could only guess ids and learn from find()'s error. tsc clean, 289 tests (288 pass, 1 skipped).

@jonaslsaa
jonaslsaa merged commit 9dfcb5a into main Oct 17, 2026
4 checks passed
@jonaslsaa
jonaslsaa deleted the feature/spawn-model-thinking branch October 17, 2026 22:19
@jonaslsaa jonaslsaa mentioned this pull request Oct 17, 2026
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.

2 participants