Free Sample Lesson: How an agent works: the building blocks of Agent Script (Agentforce Specialist Cert Lab)

Free sample lesson from the Agentforce Specialist Cert Lab. The full course has 24 lessons and 240 practice questions.

Get the Cert Lab, $9.99
AI Agents · AG1 · part of the 35% section · about 25 min with practice

AG1: How an agent works: the building blocks of Agent Script

You’ll be able to: name the blocks in an Agent Script file, say what each one controls, and trace how a request moves from the agent router into a subagent.

Diagram: a customer message goes to the start_agent block (the Agent Router), which routes to a subagent; the subagent resolves its instructions into a prompt and the LLM responds. The next message starts at the router again.
Diagram: a customer message goes to the start_agent block (the Agent Router), which routes to a subagent; the subagent resolves its instructions into a prompt and the LLM responds. The next message starts at the router again.

Agent Script is the language for building agents in Agentforce Builder. An agent is one script file made of top-level properties called blocks. When you save a version of the agent, the script compiles into lower-level metadata that the reasoning engine uses.

Terminology note: beginning in April 2026, agent topics are called subagents, with no change in functionality. The Agentforce Specialist exam guide still says “topics”, so treat the two words as the same thing.

The blocks you need to know

BlockWhat it holdsRemember
systemGeneral instructions and system messageswelcome and error messages are required
configdeveloper_name, agent_label, description, agent_type and moredeveloper_name must be unique in the org (max 80 chars)
accessdefault_agent_userRequired for Agentforce Service agents
variablesGlobal variables every subagent can readReferenced as @variables.name
languageDefault and additional localesVoice needs a fixed default locale
connectionHow the agent works with an outside channel, such as messaging escalationPairs with @utils.escalate
start_agentThe Agent Router: classification and routingEvery customer utterance begins here
subagentdescription, reasoning (instructions + tools) and actions for one jobThe description helps routing pick it

Inside a subagent

A subagent block has a name (snake_case, no spaces), a description that helps the agent decide when the subagent fits the user’s intent, a reasoning section and an actions section. reasoning.instructions guides the reasoning engine once it picks the subagent. reasoning.actions lists the tools the reasoning engine may use. The subagent’s actions block defines the actions themselves (inputs, outputs and target). To let the reasoning engine use one of those actions, you must also point to it from reasoning.actions.

How a request flows

All requests, including the first one, begin at the start_agent block. It typically sets initial variable values and does subagent classification. Agentforce then processes the chosen subagent’s reasoning instructions from top to bottom, building a prompt. The LLM only starts reasoning after it receives the resolved prompt. After the subagent finishes, the agent waits for the next utterance, which starts at start_agent again.

Example

Agent Script
1system:
2    instructions: "You are a friendly agent that helps customers with their questions."
3    messages:
4        welcome: "Hello! How can I help today?"
5        error: "Sorry, something went wrong."
6
7config:
8    developer_name: "Demo_Agent_1"
9    agent_label: "Demo Agent"
10
11access:
12    default_agent_user: "service@example.com"
13
14start_agent agent_router:
15    description: "Welcome the user and pick the right subagent"
16    reasoning:
17        actions:
18            go_to_orders: @utils.transition to @subagent.Order_Management
19                description: "Order lookups and updates"

Adapted from: Agentforce Developer Guide: Agent Script Blocks

Exam trap

welcome and error are the required system messages. A distractor may claim the config block is where you set the agent user: default_agent_user is deprecated in config and belongs in the access block.

Predict, then reveal

A customer is mid-way through an order subagent and sends a new message. Where does processing start for that message?

Show the answer

At the start_agent block (the Agent Router). Every request begins there; by default the router decides again which subagent fits.

Try it 5 min · an org with Agentforce Builder

  1. Open Agentforce Studio from the App Launcher in an org with Agentforce Builder, and open or create an agent.
  2. Switch the editor from Canvas to Script and find the system, config, start_agent and subagent blocks.
  3. Result: you can point to the required welcome and error messages and to the router that every request starts from.

Practice questions

Ten exam-style questions on this lesson. Answer each one before you open it.

Question 1. A builder wants to change the greeting customers see when a conversation starts. Which block holds it?

  • A. config
  • B. system
  • C. access
  • D. variables
Show the answer and explanation

Answer: B. The system block holds the system messages, and welcome is one of the required ones.

config holds identity settings such as developer_name; access holds the agent user; variables holds state.

Question 2. An agent fails validation because its system block is missing a message. Which two messages are required?

  • A. welcome and error
  • B. welcome and goodbye
  • C. error and escalation
  • D. greeting and fallback
Show the answer and explanation

Answer: A. The docs list welcome and error as required messages in the system block.

The other pairs are not the required message names.

Question 3. Which block decides, for every new customer utterance, which subagent should handle it?

  • A. The first subagent listed in the file, because order sets priority
  • B. The config block
  • C. start_agent, shown as the Agent Router in Canvas
  • D. The language block
Show the answer and explanation

Answer: C. Every request begins at start_agent, which handles subagent classification and routing.

File order, config and language don’t route requests.

Question 4. An admin sets default_agent_user inside the config block of a new service agent. What should a reviewer say?

  • A. It is correct, because config is the only block that accepts a username
  • B. It is optional for service agents
  • C. It must be set in the variables block
  • D. Move it to the access block; it is deprecated in config
Show the answer and explanation

Answer: D. The config reference marks default_agent_user as deprecated there and points to the access block, where it is required for Agentforce Service agents.

Variables hold state, not the running user.

Question 5. A subagent defines a Flow action in its actions block, but the LLM never calls it. What is the most likely gap?

  • A. The action has no label
  • B. The action isn’t listed in reasoning.actions
  • C. The flow is not part of a managed package installed in the org
  • D. The agent has no language block
Show the answer and explanation

Answer: B. To let the reasoning engine use a defined action, you must also point to it from reasoning.actions.

Labels, packaging and locales don’t expose an action to the LLM.

Question 6. What happens to Agent Script when you save a version of the agent?

  • A. It is sent unchanged to the LLM on each turn
  • B. It is converted into an equivalent record-triggered Flow behind the scenes
  • C. It compiles into lower-level metadata for the reasoning engine
  • D. It is stored only as a draft that can’t run
Show the answer and explanation

Answer: C. Agent Script is a compiled language: saving a version compiles it into metadata used by the reasoning engine.

It isn’t passed raw to the LLM or converted to a Flow.

Question 7. Which property should help the router pick a subagent based on the user’s intent?

  • A. The subagent description
  • B. The subagent label
  • C. The agent_version
  • D. The developer_name of the agent
Show the answer and explanation

Answer: A. The subagent description helps the agent decide when to use the subagent based on the user’s intent.

Labels and version numbers are for display and tracking.

Question 8. A study partner says “topics” and “subagents” are different features. Which statement is accurate?

  • A. Subagents replaced topics and work differently
  • B. Topics are for service agents only
  • C. Topics are only for service agents and subagents only for employee agents
  • D. They are the same: topics were renamed subagents in April 2026
Show the answer and explanation

Answer: D. The developer guide notes that beginning in April 2026 topics are called subagents, with no change in functionality.

Nothing about the feature changed except the name.

Question 9. Which two statements about the subagent blocks are true? (Choose 2.)

  • A. reasoning.instructions guides the engine after it picks the subagent
  • B. The subagent name may contain spaces as long as it is wrapped in quotes
  • C. reasoning.actions lists the tools the engine can use
  • D. A subagent can’t have its own actions block
Show the answer and explanation

Answer: A, C. Instructions guide the reasoning engine once the subagent is relevant, and reasoning.actions lists its tools.

Names use snake_case without spaces, and subagents do have an actions block.

Question 10. When does the LLM start reasoning on a subagent?

  • A. As soon as the first instruction line is parsed by Agentforce
  • B. After it receives the fully resolved prompt
  • C. Before the router runs
  • D. Only after after_reasoning finishes
Show the answer and explanation

Answer: B. The flow-of-control doc says the LLM starts reasoning only after it has received the resolved prompt.

It doesn’t reason while Agentforce is still parsing, and after_reasoning runs after the reasoning loop.

Before you move on

1. (Exam guide) Which Agentforce Specialist exam section carries the most weight?

Show answer

AI Agents, at 35%.

2. (Exam guide) How many scored questions does the Agentforce Specialist exam have, and what is the passing score?

Show answer

60 multiple-choice questions, 72% to pass.

Key takeaways

  • An agent is one Agent Script file made of blocks; it compiles when you save a version.
  • system needs welcome and error messages; access holds default_agent_user.
  • Every request starts at start_agent (the Agent Router).
  • A defined action must also be listed in reasoning.actions for the LLM to use it.

Sources

Checked against Salesforce Help, the Agentforce Developer Guide and Trailhead on Oct 11, 2026. Exam questions align to the Spring ’26 release.

Liked this lesson?

There are 23 more like it, plus section checks, flashcards and 6 practice quizzes.

Get the Cert Lab, $9.99