Sub topic 13
Choosing a model for agent work
This chapter assumes you have used agent mode in VS Code, know the agent loop (plan, call tools, observe, iterate), and can read a diff. It covers how to pick a model from the model picker and what to do when the choice goes wrong.
Why the model matters more in agent mode
In ask mode, a weak answer costs you one reply. In agent mode, the model makes many decisions in a row: which files to read, which command to run, and when to stop. A small error early in the loop carries into every later step. The model you pick therefore affects reliability as well as quality.
The model picker in the chat view lists the models your account and organization allow. The list changes over time, so check it instead of relying on names from a tutorial.
What to compare
Models differ along a few dimensions that matter for agent work.
| Dimension | Why it matters for agents |
|---|---|
| Tool calling | The model must emit well-formed tool calls. Models without good support may not appear in agent mode at all. |
| Context window | A larger window holds more files and tool output before older content is dropped or summarized. |
| Speed | Each loop step is a model call. Slow models make long tasks slow. |
| Cost or usage multiplier | Agent runs make many calls. Some plans charge premium models at a higher rate per request. |
| Reasoning depth | Models that reason more handle planning and debugging better, but respond more slowly. |
A practical way to choose
Match the model to the task instead of using one model for everything.
- Use a fast, low-cost model for small, well-defined edits such as renaming a function, adding a test case, or fixing a lint error.
- Use a stronger reasoning model for work that spans several files, needs a plan, or involves a bug you cannot explain yet.
- Switch up when the agent repeats the same failed step, edits the wrong files, or ignores your instructions file.
- Switch down when the task is simple and the premium model is only adding delay and cost.
Switching models mid-session
You can change the model from the picker between messages. The conversation history stays, and the next request goes to the new model. Two cautions apply:
- A different model may interpret earlier tool output and plans differently. If results get strange after a switch, start a new chat and restate the goal.
- A smaller context window on the new model can force older content out sooner.
Common errors
- Using the strongest model for everything. This burns usage quota on tasks a fast model handles well.
- Blaming the model for missing context. If the agent did not see the right files, a better model will not fix it. Check attachments and instructions first.
- Changing the model and the prompt together. You then cannot tell which change helped. Change one at a time.
- Assuming availability. Organization policies can hide models. If a model is missing from the picker, ask your administrator or check the plan.
- Trusting the label. Names such as "fast" or "advanced" are marketing. Test with one of your own tasks.
Try it yourself
Pick one real task, such as adding validation to a function with tests. Run it with a fast model and note the number of loop steps, whether tests pass, and how long it took. Reset with version control, then run the same prompt with a stronger model. Compare the two diffs and the time taken.
Exercise
The agent keeps retrying the same failing command and then edits an unrelated file. Your instructions file and attachments are correct. Name two reasonable next steps involving the model.
Show answer
Switch to a stronger reasoning model for the task, and start a fresh chat that restates the goal, so that the failed attempts do not stay in the context. Keep the prompt the same so you can tell whether the model made the difference.
Exercise
You need to rename a variable across one file. Which kind of model should you start with, and why?
Show answer
A fast, low-cost model. The task is small and well defined, so extra reasoning depth adds delay and usage cost without improving the result.