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.

ACL
default_model = "provider/fast-model"
providers "provider" {
apiKey = env("PROVIDER_API_KEY")
baseUrl = env("PROVIDER_BASE_URL")
models "fast-model" { tool_call = true }
models "review-model" { tool_call = true }
}

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.

Rust
Node.js
Python
Go

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:

Rust
Node.js
Python
Go

Notes:

  • The model value is a provider/model reference that must match a provider and model declared in your agent file (with an API key); otherwise session creation fails with a model configuration error. The SDKs contain no hard-coded model names.
  • parallel and pipeline step specs have no model field; every step runs on the session's model.
  • The task tool has no model field. Each task item accepts only agent, description, prompt, background, max_steps, and output_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.