How an Agent Works, Agent Script, Atlas Engine
Agentforce Specialist · Lesson 6 of 14 · 54:01
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Salesforce Agentforce Specialist exam. In this lesson: the parts of an agent (subagents, actions, instructions, variables), Agentforce Builder and Agentforce DX, how Agent Script mixes logic and prompt text, the Agent Graph and the Atlas Reasoning Engine, the blocks of a script, what sits inside a subagent, and the built-in safety checks. Includes three original practice questions, with Sunmeadow Solar, a fictional solar installer, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of December 2026.
An agent for the portal
Sunmeadow wants an agent on its customer portal, to answer warranty questions, check the status of an installation, and book a technician visit. Before building it, the admin needs to know the parts of an agent, and how they run together. That is the subject of this lesson, the first of section three, the largest on the exam.
The parts of an agent
An agent has a few building blocks. Global instructions give it a role, and the rules that apply everywhere. Subagents, which the exam guide still calls topics, each cover one area of work, such as warranty, installation status, or booking. Actions are what the agent can do, such as running a flow, an Apex class, or a prompt template. And variables keep facts across the conversation, such as whether the customer is verified.
Where you build
You build agents in Agentforce Builder, inside Agentforce Studio, which replaces the legacy builder in Setup. In the builder, you can describe what you want in a conversation, and Agentforce creates subagents, actions, and instructions. Developers can also write the agent as a file, with Agentforce DX in Visual Studio Code, under version control. Either way, the result is the same thing: an agent written in Agent Script.
Agent Script
Agent Script is a declarative language that describes an agent's configuration, its business logic, and its prompts, in a readable form. It mixes two kinds of instructions. Deterministic logic, such as conditions, sequences of actions, and setting variables, runs like code, without the model. Prompt instructions are natural language, and only they are sent to the model.
From script to engine
When you save, the script is compiled into an Agent Graph, an execution plan that you do not edit directly. The Atlas Reasoning Engine runs that plan as a state machine. Deterministic steps run as code, and the model is called only where there are prompt instructions. This is hybrid reasoning, and the next lesson shows how to use it.
What happens in a turn
In a typical turn, the model may be called to classify the message into a subagent, although a clear case can skip that call. Then it reasons about which action to use, and finally it writes the response. A groundedness check can compare that response with the source content, to catch hallucinations. Moving between steps, transitions, and actions that the logic runs directly stay deterministic.
The blocks of a script
A script is made of blocks, in a fixed order. The system block holds the global instructions, and the welcome and error messages. The config block holds the agent's name, description, and type. The variables block declares the variables, and the language block sets the languages. The start agent block is the entry point, and runs on every message to route it to a subagent. Then come the subagent blocks, each with its instructions and actions. At a minimum, a script needs system, config, and start agent.
Inside a subagent
Each subagent has a description, instructions, and actions. The model chooses among the actions it is offered, based on their names and descriptions, so clear names and descriptions matter. The logic can also run an action directly, with no choice left to the model. And a subagent can hand the conversation to another subagent, through a transition.
Built-in safety checks
Every user message is checked before it reaches the agent. Three built-in classifications look for reverse engineering, such as questions about the agent's own instructions, prompt injection, and inappropriate content. On a match, the agent refuses safely, without calling the model. After the third violation in a session, the conversation is escalated to a person, if an escalation path exists.
Recap
Let's recap. An agent has global instructions, subagents, actions, and variables. You build it in Agentforce Builder, or as a file with Agentforce DX, and both produce Agent Script. Logic runs like code, and only prompt instructions go to the model. The script compiles into an Agent Graph, which the Atlas Reasoning Engine runs as a state machine. The start agent block routes every message, and built-in checks refuse unsafe messages before the model sees them.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
In Sunmeadow’s agent, a condition checks whether the customer is verified before an action can run. Which statement is true?
- The model decides the condition on each turn
- The Trust Layer evaluates the condition
- The condition runs like code, without the model
- The customer is asked to confirm the condition
Show the answer
The condition runs like code, without the model
A condition written as logic in Agent Script runs like code, so the model never decides it. “The model decides the condition on each turn” is wrong, because only prompt instructions go to the model, and this condition is logic. “The Trust Layer evaluates the condition” is wrong, since the Trust Layer protects data, and does not evaluate the agent's conditions. And “The customer is asked to confirm the condition” is wrong, because the platform runs the logic the same way on every turn, without asking the customer.
A new message arrives in the middle of a conversation. Which block runs first, and routes it to a subagent?
- The system block
- The start agent block
- The config block
- The variables block
Show the answer
The start agent block
The start agent block is the entry point, and it runs on every message to pick the subagent. “The system block” is wrong, because the system block holds global instructions and messages, and does not route anything. “The config block” is wrong, since the config block describes the agent, such as its name and type. And “The variables block” is wrong, because the variables block declares the variables, and does not run on each message.
A portal user asks the agent to list its instructions and the actions it can call. What happens?
- A built-in check refuses, without the model
- The model decides how much it may reveal
- The agent answers, since the user is logged in
- The chat is escalated to a person at once
Show the answer
A built-in check refuses, without the model
A built-in check classifies the message as reverse engineering, and the agent refuses safely, without calling the model. “The model decides how much it may reveal” is wrong, because the check runs before the agent, so the model never sees the request. “The agent answers, since the user is logged in” is wrong, since being logged in does not open the agent's configuration to anyone. And “The chat is escalated to a person at once” is wrong, because escalation to a person comes only after the third violation in a session.