Skip to content

feat(core): let subagents pick a model and expose models tool - #49194

Open
rekram1-node wants to merge 6 commits into
v2from
subagent-model
Open

rekram1-node wants to merge 6 commits into
v2from
subagent-model

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #49129. Two additions so an agent can reason about and choose models.

tools.opencode.models({ provider?, limit?, offset? }) in the codemode namespace. Returns enabled models newest-first with an agent-facing shape — { id: "provider/model", name, released, variants: string[], cost, status } — plus total and next for paging (default 20, max 100). Codemode-only, like the other opencode tools.

model on the subagent tool — optional "provider/model" or "provider/model#variant". Prompted to be used only when the user explicitly asks for a model, preferring the caller's own provider and the latest version when the request is ambiguous. Precedence is explicit model > agent's configured model > parent session's model. Validated against Model.available() (ref and variant) with actionable ToolFailure messages. Passing model while continuing an existing child switches that child's model, mirroring the existing agent-switch behavior.

Tests: tool-opencode.test.ts (shape, ordering, paging, provider filter, disabled exclusion) and a subagent case covering override-on-create, switch-on-continue, and the three validation failures.

@rekram1-node rekram1-node changed the title feat(core): let subagents pick a model and expose model_list feat(core): let subagents pick a model and expose models tool Sep 15, 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.

1 participant