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.
Related terms
Agent Builder
Salesforce's low-code tool for creating and configuring Agentforce agents — define topics, actions, and guardrails without writing code.
Agent Handoff Protocol
The structured rules governing how one AI agent transfers context and control to another agent or human.
Agentforce
Salesforce's AI agent platform that enables businesses to build, customize, and deploy autonomous AI agents across sales, service, marketing, and commerce.
Guardrails
The boundaries you set on AI agents to control what they can discuss, what actions they can take, and when they must escalate to a human.
Topics and Actions
The building blocks of Agentforce agents — topics define what an agent can discuss, actions define what it can do.
Agent Script in practice
Articles from the Funnelists Team that put this term to work.

What Does a Salesforce AI Agent Architecture Look Like for a Head of Salesforce Running Service Cloud?
A Salesforce AI agent architecture has five layers: data and permissions, runtime, tools, channels, and oversight. A Head of Salesforce running Service Cloud should decide them in that order, starting with what the agent may see and do.

Agentforce vs Custom AI: 7 Decision Factors for Business Leaders
Choosing between Salesforce Agentforce and custom AI solutions requires weighing speed, cost, control, and long-term fit. This guide outlines seven practical decision factors.

Salesforce Headless 360 — What It Means for SMBs
Salesforce Headless 360 makes CRM API-first for AI agents. SMBs automate workflows without browsers, cutting dev time 40% and scaling ops. Technical guide with checklist.

Agentforce Agent Script: The Complete Guide to Intelligent Customer Interactions
Discover how Salesforce's Agentforce Agent Script transforms customer interactions from rigid scripts to intelligent, adaptive conversations that scale with your business.

