Model Switching
A session runs against whatever model you pass in the model option. Declare
the models your agent can reach once, then pick one per session — a fast model
for high-volume, low-stakes work and a stronger model for review. Use this when
you want to balance cost against capability without changing any of your prompts.
Declaring models
Models are configured in your agent file. Each provider lists the models it
exposes (tool_call defaults to true, so it is shown here only for clarity),
and default_model is used when a session does not set model.
Per-session model
The model option is set when you open the session. Everything that session
runs — send, run, parallel, pipeline, and delegated task children —
uses that model. One agent configuration can drive different model choices for different sessions.
Per-worker model
A worker spec can carry its own model. It takes effect when you open a session
from that spec with session_for_worker (Node.js sessionForWorkerAsync, Go
SessionForWorker): the worker's model, step budget, prompt, and permissions fill
in whatever the session options leave unset. Options you pass explicitly win, so
do not also set model in those options if you want the worker's model.
Delegated task children do not switch models. They run on the delegating
session's model, even when the worker registered in worker_agents has a
model. To run exploration on a cheaper model, open a worker session for it and
hand its result to a session on the stronger model:
Notes:
- The
modelvalue is aprovider/modelreference that must match a provider and model declared in your agent file (with an API key); otherwise session creation fails with amodelconfiguration error. The SDKs contain no hard-coded model names. parallelandpipelinestep specs have nomodelfield; every step runs on the session's model.- The
tasktool has nomodelfield. Each task item accepts onlyagent,description,prompt,background,max_steps, andoutput_schema, and rejects any other field.
A runnable version showing the model option on a session ships at
sdk/node/examples/basic/test_api_alignment.ts.