How Agents Work

Follow the path of a user message through the Atlas reasoning engine to learn how Agentforce agents reason, take action, and generate responses.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type.
Note
Note Beginning in April 2026, agent topics are now called subagents. There are no changes to functionality. During this transition, you may see a mix of the new and previous terms in our documentation.

The Atlas reasoning engine is a graph-based reasoning engine. You can think of it like a flowchart with nodes, variables, and transitions, so agents follow specific, predictable paths. Unlike strictly prompt-based reasoning engines, Atlas separates an agent’s big-picture workflow from its conversational skills. It uses Agent Script, the language for building agents in Agentforce Builder, to combine programmatic expressions with natural language instructions. The result is hybrid reasoning, which gives you the predictability and control that enterprise demands and the flexibility and creativity that large language models (LLMs) make possible.

Note
Note The number and size of LLM calls in an agent conversation depends on the complexity of the task and which subagents and actions are used. Learn more about large language model support for Agentforce.

Step 1: A user sends a message

The process begins when a user enters a question or request.

Step 2: The agent goes to a starting subagent

The agent moves to the subagent defined as the starting subagent. In Agent Script, this is whatever subagent uses the `start_agent` prefix instead of the `subagent` prefix. By default, this is the Agent Router, which guides the agent to select a subagent based on the recent conversation history and the subagents available to the agent.

Step 3: The agent resolves the subagent instructions from top to bottom

After the agent moves to a subagent, it begins resolving the subagent’s reasoning instructions deterministically, in the order that they’re written. At this stage in the subagent’s execution, no reasoning takes place, so the agent doesn’t rely on an LLM yet.

If at any point in the reasoning instructions the agent executes a transition to another subagent, the agent redirects the conversation before the instructions are resolved and any reasoning occurs. Otherwise, when all reasoning instructions have been resolved, the resulting reasoning instructions, including any natural language instructions, are used to build a prompt.

Step 4: The agent builds a prompt

The agent uses the reasoning instructions to build a prompt to send to the LLM and kick off the reasoning process. The prompt includes:

  • Agent-level instructions, which apply to every agent interaction
  • The recent conversation history, including the user’s most recent message
  • The resolved subagent reasoning instructions
  • Reasoning actions included in the subagent, which are the actions (including agent actions) an agent is allowed to take during its reasoning process

Step 5: The agent sends the prompt to the LLM to begin reasoning and take action

The agent uses the LLM to analyze the available information in the prompt and determine its next steps.

  • Run an agent action or utility, based on the logic defined for the action or utility and any descriptions, inputs, and outputs
  • Ask the user for more information
  • Ask the user clarifying questions to disambiguate between available options
  • Respond directly to the user’s question or request, if the user’s question or request can be resolved with information the agent already has access to

When the agent runs an action, it checks the result in a reasoning loop to make sure it has the right information before responding to the user. The agent adds the action output to the information it already has about the conversation. Then it decides whether to run another action, ask the user more questions, or send a final response. This process continues up to seven reasoning loops.

Step 6: The agent performs a final response validation (Agentforce Service agents only)

Before an Agentforce Service agent sends a response, it checks whether the response is grounded in data sources, adheres to the subagent’s scope and instructions, and doesn’t include hallucinations, unverified information, or potential prompt injection risks. If the proposed response fails this validation, the agent generates a new response.

Note
Note Agents stream LLM responses in conversations as the responses are received. The response validation is applied to the final agent response. If a proposed response fails this validation after the response has started streaming, the response is deleted and a new response is generated.

If the agent can’t generate a response that passes validation, it informs the user that it can’t help with their question or request.

Step 7: The agent sends a response to the user

After the agent completes the reasoning loop, it sends a message to the user. The user can continue the conversation by asking a follow-up question or changing the subject, and the agent responds appropriately. Behind the scenes, the user’s response restarts the journey, but to the user, it feels like they’re taking turns in a conversation.