Switch Model • AI Agent SDK
switch_model: Switch the agent's LLM model while preserving conversation history.
switch_model
Method
</div>
Switch the agent’s LLM model while preserving conversation history.
Signature
def switch_model(new_model: str) -> NoneParameters
ParamField
strThe new model name to switch to (e.g., “gpt-4o”, “claude-3-sonnet”)
Uses
LLM
Source
View on GitHubpraisonaiagents/agent/agent.py at line 6087