A

Agent Script

Agent Script is Salesforce's scripting language for defining how an Agentforce agent behaves, mixing deterministic logic with LLM reasoning.

What it is

Agent Script is Salesforce's scripting language for defining how an Agentforce agent behaves, combining deterministic rules with LLM reasoning. It gives builders granular control over steps that must always happen the same way, such as conditions, variables and escalation to a human.

Why it matters

Pure prompting leaves business-critical steps up to the model. Scripted logic makes the parts that must be predictable, like when to hand a conversation to a person, behave the same way every time.

Key components

  • Conditional logic (if / else if)
  • Expression functions
  • System variables for connection and modality
  • Deterministic escalate statement

How it connects

Agent Script is authored in Agentforce Builder. The Winter '27 updates added more expression functions, else-if conditions, new system variables and a top-level escalate statement for deterministic human handoff.

Good to know

Nested if statements and elif were not supported as of the Winter '27 developer guide; check current release notes before designing complex branches.

Frequently asked questions

What is Agent Script in Agentforce?

Agent Script is the language used to define Agentforce agent behavior with deterministic rules, such as conditions, variables and escalation, alongside LLM reasoning.

Need Help Implementing This?

We specialize in putting AI and Agentforce to work for Salesforce customers. Let's talk about your use case.

Book Intro Call