Configure Models in Agent Script

By default, Agentforce uses the org-level model selected in Setup for all agents and subagents. To use a different model, or to change model behavior, use model_config parameters. To specify a model other than the default, set model. To configure how the model behaves, set max_tokens, temperature, and top_p.

ParameterWhat It DoesTypical Value
modelSpecifies the model to use for the agent or subagent.model://sfdc_ai__DefaultVertexAIGemini35Flash
temperatureControls how random responses are. Lower values give more focused, repeatable answers; higher values give more varied ones.0 to 1
max_tokensCaps the length of the model’s response, in tokens.For example, 500 or 2000
top_pNucleus sampling. The model picks from the most likely tokens until their combined probability reaches this value. Lower values make responses less random.0 to 1

This example uses model_config to override the org-level default model for the agent, set the temperature for more varied answers, and limit responses to 2,000 tokens. You can use a model_config block to configure a subagent’s model.

Specify any supported model. To test your model selections, use different models in different versions of your agent.

  • We recommend that you use GPT 4.1 (sfdc_ai__DefaultGPT41), Claude Haiku 4.5 (sfdc_ai__DefaultBedrockAnthropicClaude45Haiku), or Gemini 3.5 Flash (sfdc_ai__DefaultVertexAIGemini35Flash) because we’ve thoroughly tested these models with agents.
  • Thoroughly test your agent with your chosen model or models before deploying. Some supported models aren’t suitable for your agent or its tools.

An agent can use different models for different subagents. A subagent-level model overrides the agent-level model, and an agent-level model overrides the org-level default.

Suppose that your org, agent, and subagent specify these models:

  • Your org uses the Salesforce default model.
  • The MyTestAgent agent specifies Claude Haiku 4.5.
  • The HandleReservation subagent specifies Gemini 3.1 Pro.

In this example, Agentforce uses Gemini 3.1 Pro for the HandleReservation subagent. For all other subagents in MyTestAgent, Agentforce uses Claude Haiku 4.5. For other agents in the same org, Agentforce uses the Salesforce default model.

Some agent templates, such as Agentforce Service agent, use the Salesforce-owned EinsteinHyperClassifier model for subagent classification in the Agent Router. You can keep that model, or specify a different model in your Agent Router.

Compared to other LLMs, Salesforce’s EinsteinHyperClassifier offers these advantages for subagent classification:

  • Faster subagent classification
  • Higher classification accuracy, especially for specialized classification constraints and negative instructions

The EinsteinHyperClassifier model has these limitations:

  • Can’t use before_reasoning or after_reasoning
  • Can use only the @utils.transition tool. It can’t use other tools