Agent Script
Agent Script is a programming language purpose-built for AI agents. It gives you deterministic control over workflows while letting the LLM reason where it matters. One file defines your entire agent: subagents, actions, transitions, and guardrails.
Readable by Anyone
Syntax designed so product managers, architects, and developers can all understand what an agent does at a glance.
Deterministic Where It Counts
Business-critical logic runs before the LLM. Conditionals, transitions, and action chains execute exactly as written.
Source-Controlled
.agent files live in your repo. Version, diff, review, and deploy agents the same way you ship code.
Your First Agent in 30 Lines
Here's a complete agent that routes customer requests, verifies identity, and manages orders:
config:
developer_name: "Support_Agent"
agent_type: "AgentforceServiceAgent"
system:
instructions: "You are a customer support agent. Be concise and helpful."
start_agent topic_selector:
description: "Welcome the user and route to the right subagent"
reasoning:
instructions: ->
| Welcome the user and determine what they need help with.
| Use the available actions to route them appropriately.
actions:
go_to_orders: @utils.transition to @subagent.Order_Management
description: "Handles order lookup, refunds, and updates"
go_to_faq: @utils.transition to @subagent.General_FAQ
description: "Answers common questions about products and policies"
go_to_escalation: @utils.transition to @subagent.Escalation
description: "Connects user with a human representative"
That's it. The agent greets the user, the LLM classifies their intent, and they're routed to the right subagent. No framework, no boilerplate, no deployment pipeline to configure.
Two Types of Instructions
Agent Script's power comes from separating what's deterministic from what needs AI reasoning. Two arrow types make this explicit:
Patterns That Ship
Building Blocks
Deploy from Your IDE
Agent Script files are standard source — build, test, and deploy using the tools you already know:
What's Coming Next
On the Roadmap
Agent Script is evolving fast. Here's what's shipping soon:
- MCP Integration — Connect agents directly to Model Context Protocol servers. Your agent will be able to call external tools, databases, and APIs through the standard MCP interface, making it a first-class citizen in the broader AI tooling ecosystem.
- Enhanced Flexibility — More expressive control flow, richer variable types, and deeper integration with Salesforce data models. Write less configuration, get more capability.
- Cross-Agent Orchestration — Agents that can invoke other agents as tools, enabling multi-agent architectures for complex enterprise workflows.
Quick Reference
| Symbol | Meaning | Example |
|---|---|---|
-> | Logic instructions (deterministic) | instructions: -> |
| | Prompt instructions (sent to LLM) | | Help the customer with their order |
@variables. | Reference a variable | @variables.customer_email |
@actions. | Reference an action | @actions.Get_Order |
@subagent. | Delegate to another subagent | @subagent.Order_Management |
@outputs. | Reference action output | @outputs.order_data |
@utils. | Utility functions | @utils.transition to @subagent.FAQ |
{!expr} | Interpolate in prompts | {!@variables.name} |
... | LLM slot-fill token | with order_id = ... |
# | Comment | # This is a comment |
Language Reference
Variable Types
| Type | Notes |
|---|---|
string | Alphanumeric text |
number | IEEE 754 double-precision (integers and decimals) |
boolean | True / False (case-sensitive, capitalize first letter) |
object | JSON object — regular variables only, not linked |
date | Any valid date format |
id | Salesforce record ID |
list[<type>] | List of any primitive type — regular variables only, not linked |
Variables come in three kinds: regular (mutable, with optional default), linked (read-only, tied to an external source like @session.sessionID), and system (predefined, read-only — currently only @system_variables.user_input).
Action Targets
Actions support several target protocols:
| Target | Format | Example |
|---|---|---|
| Apex | apex://<class>.<method> | apex://c__CustomerActions.getProfile |
| Flow | flow://<flow_name> | flow://Issue_Refund |
| Prompt | prompt://<template_name> | prompt://Case_Summary_Template |
Action parameter types: string, number, integer, long, boolean, object, date, datetime, time, currency, id, list[<type>].
Operators
| Category | Operators |
|---|---|
| Comparison | ==, !=, <, <=, >, >=, is, is not |
| Logical | and, or, not |
| Arithmetic | +, - |
Conditionals support if and else only (no else if).
Utils
| Utility | Purpose |
|---|---|
@utils.transition to @subagent.<name> | One-way transfer to another subagent. No return to caller. Discards any accumulated prompt from the source subagent. |
@utils.setVariables | Lets the LLM set variable values from conversation context. Use ... token for LLM-determined values. |
@utils.escalate | Hands off to a human service rep via Omni-Channel. Requires an active connection messaging block. |
Flow of Control
- Every utterance starts at the
start_agentsubagent (the router). - The router classifies intent and transitions to the appropriate
subagent. - Reasoning instructions are parsed sequentially, top-to-bottom.
- Logic instructions (
->) execute deterministically — actions run, variables set, conditions evaluate. - Prompt instructions (
|) are concatenated into a single prompt sent to the LLM. after_reasoningruns after the LLM responds.- The next utterance returns to
start_agent.
Transitions via @utils.transition to are one-way — the caller's context is discarded. Use @subagent.<name> as a tool reference for round-trip delegation that returns to the caller.