The SDK set_model control request is now asynchronous. If the session is busy or has queued work, the model change is deferred and applied once the session goes idle rather than being forced through. Any notices the change produces are forwarded back to the caller, and a thrown error now replies set_model failed instead of leaving the request hanging.
- Applies to every
set_modelcontrol request; there is no flag.
`if (u0(e) || Ek.of(e).pending > 0) lt(() => ng(e, O));
else await O();`
Strings lifted out of the shipped bundle, so the claim above can be checked against them.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
| `set_model(model)` | Change the model for the current session. Pass `None` to reset to [Claude Code's default model](/docs/en/model-config) |agent-sdk/python see the edit
Anthropic's documentation has since written up set_model, on Agent SDK reference - Python.