Support per-agent model selection in workflow scripts - #27
Open
camerondurham wants to merge 1 commit into
Open
Conversation
camerondurham
marked this pull request as draft
July 10, 2026 22:30
camerondurham
force-pushed
the
feature/per-agent-model-selection
branch
from
July 11, 2026 19:49
b36cb76 to
dc9224c
Compare
camerondurham
marked this pull request as ready for review
July 11, 2026 19:50
camerondurham
force-pushed
the
feature/per-agent-model-selection
branch
from
July 13, 2026 12:53
24fb583 to
e071a75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
agent(..., { model })previously added the model name to the prompt but still ran every subagent on the parent model. This PR makes it select the actual Pi model, so workflows can use faster models for fan-out work and stronger models for synthesis. Omittingmodelstill inherits the parent model.Routing fails early for unavailable or ambiguous models instead of silently choosing another provider. The resolved
provider/idis shown in workflow progress and results. Subagents also exclude theworkflowtool to prevent recursive workflows, an issue found during live testing with a local model.Validation
npm testpasses all 41 tests.For the live test, I created a temporary
PI_CODING_AGENT_DIR, copied the real Nix-managedauth.json,models.json, andsettings.jsoninto it, then installed this checkout with:On Pi
0.80.6, I ran this workflow through the installed extension:The parent Pi process used JSON mode so the tool result and model metadata could be checked directly:
The
tool_execution_endevent contained two completed agents:[ { "label": "local gemma retry", "status": "done", "model": "ollama/gemma4-pi", "resultPreview": "LOCAL_GEMMA_CODEX_RETRY_OK" }, { "label": "openai codex retry", "status": "done", "model": "openai-codex/gpt-5.4-mini", "resultPreview": "OPENAI_CODEX_LOW_RETRY_OK" } ]The
modelfields are populated from each spawned session's resolvedsession.model, not copied from the requested strings. I also ranollama psbefore and after the workflow: it was empty before the run and showedgemma4-piloaded afterward, independently confirming the local-model request.The temporary Pi directory was deleted and Gemma was unloaded afterward.
Closes #9