How Does Salesforce Agentforce Work? Subagents, Reasoning, Actions and Data Explained
An Agentforce agent is not a chatbot with a script. It routes each request to a subagent, plans, calls your Flows, Apex and APIs, checks its answer against your data, and only then replies. Here is what happens at each step, what you configure, what it costs, and what your org needs first.
Key Takeaways
- Agentforce works in a loop: route the request to a subagent, decide the next step, run an action, look at the result, repeat, then check the answer is grounded before replying.
- You control an agent through subagents (called topics until April 2026), instructions and actions. Agent Script adds hard rules where the LLM should not decide.
- Actions reuse what your org already has: Flows, Apex, prompt templates, MuleSoft APIs and external services.
- Agents answer from your data through Data 360 and the Agentforce Data Library, and they can only see what their agent user is allowed to see.
- On consumption pricing, each standard action uses 20 Flex Credits, about US$0.10 at list price. Test in a sandbox, then watch every session in Agentforce Observability.
How does Agentforce work? Salesforce Agentforce takes a request from a person, a record change or an API call, and its reasoning engine routes that request to the right subagent. The engine then decides which of your Flows, Apex classes, prompt templates or APIs to run, reads the results, and repeats until it can give an answer grounded in your data. The answer is checked against your instructions before it is sent, and the agent can only reach the data its permissions allow.
We first published this guide in February 2025. Since then Salesforce has replaced the agent builder, renamed topics to subagents, added Agent Script, renamed Data Cloud to Data 360 and changed how Agentforce is priced. We have rewritten the guide from Salesforce's current documentation. It is written for operations, service and sales leaders at growing and mid-market companies, and for the Salesforce admins and architects who will build their agents.
How Does Agentforce Work, in One Picture?
An Agentforce agent needs three things to get work done: data, reasoning and actions. The reasoning engine plans what to do. Actions do the work in your org. Data 360 and your Salesforce records supply the facts. Around them, the Einstein Trust Layer and the agent's own permissions limit what it can see and say. Each layer below is something you configure.
Where the request comes in
Web chat, messaging, voice, Slack, a mobile app, the Salesforce UI, or a Flow, Apex class or API call that starts the agent without a human.
The reasoning engine, subagents and instructions
The Agent Router picks a subagent. Its scope, instructions and available actions go to the LLM, which decides the next step. Agent Script can force steps that must always happen the same way.
Flows, Apex, prompt templates and APIs
The same automation your org already runs, now callable by the agent, plus Salesforce's standard agent actions.
Data 360, the Data Library, the Trust Layer and the agent user
Records, knowledge articles and files the agent is allowed to read, retrieved at the moment of the question. The Trust Layer adds grounding, toxicity detection, an audit trail and zero data retention with third-party models.
Source: Salesforce's How Agentforce Works page and its guide to reasoning, subagents, instructions and actions.
What Are the Building Blocks of an Agentforce Agent?
Every agent is made of subagents, instructions and actions, plus the variables, filters and channels around them. Subagents define the jobs the agent can do. Instructions tell it how to do each job. Actions are the tools it uses. Salesforce describes these three as the levers you control: change them, and you change the prompts the reasoning engine works from.
| Building block | What it is | Example |
|---|---|---|
| Agent | The whole assistant: its role, its subagents, its channels and the user it runs as | A customer service agent on your website |
| Subagent (formerly topic) | One job the agent can handle, defined by a name, a classification description and a scope | "Order Management": check, change or cancel an order |
| Instructions | Plain-language guidance inside a subagent: which action to use when, tone, what to ask, when to hand off | "Always confirm the order number before changing a delivery date." |
| Actions | The tasks the agent can run, each with a name, instructions and defined inputs and outputs | Get Order Details (a Flow); Change Delivery Date (Apex) |
| Variables and filters | Stored facts about the conversation that show or hide subagents and actions | Hide account subagents until the customer is verified |
| Channels | Where the agent is deployed; the logic is built once and reused on each channel | Enhanced Chat, voice, Slack, a mobile app |
The naming changed in April 2026. Salesforce now calls topics subagents, the Topic Selector the Agent Router, and a Connected Agent a Connected Subagent. Nothing works differently. You will still see "topics" in older documentation, and in screenshots like the one below from the earlier builder.

The classification description matters more than most teams expect. When a message arrives, the Agent Router looks only at each subagent's name and classification description to choose one. Two subagents with overlapping descriptions are the most common reason an agent picks the wrong job.
Salesforce's Agentforce considerations set some practical limits worth designing around:
- No more than 10 subagents per agent and 10 actions per subagent, and up to 100 agents per org. Einstein Bots count towards that limit.
- Actions time out after 60 seconds and reasoning requests after 30 seconds, so slow integrations need care.
- Agents handle one intent per message, and subagent and action instructions are supported in English only.
- Agents are available in Enterprise, Performance, Unlimited and Developer Editions, not in Government Cloud.
What Happens Inside the Atlas Reasoning Engine?
The reasoning engine runs a loop: classify the request, load the matching subagent, let the LLM decide the next step, run actions until it has what it needs, then check that the answer is grounded before sending it. If the answer fails that check, the agent tries again. If it still cannot produce a grounded answer, it sends a standard message saying it can't help, rather than guessing.
Salesforce documents eight steps. We have put them in plain terms:

This loop explains most agent behaviour. An agent that "ignores" an instruction usually had the instruction in the wrong subagent. An agent that picks the wrong action usually had two actions with similar names or descriptions, because the engine chooses actions from their names, descriptions and inputs. Salesforce introduced this layer as the Atlas Reasoning Engine; current documentation simply calls it the reasoning engine. Agent Script, announced with Agentforce 360 in October 2025, gives you direct control over it, as the next section shows.
How Does Agent Script Make Agents Predictable?
Agent Script lets you decide which steps the LLM may reason about and which must always run the same way. It mixes natural-language instructions with programmatic logic, such as if/else conditions, variables and forced transitions between subagents. Business rules like "verify identity before any refund" then don't depend on how an LLM reads a sentence. Salesforce calls this hybrid reasoning.
The new Agentforce Builder, generally available since February 2026, offers three ways to write Agent Script:
- Chat with Agentforce: describe the behaviour, for example "if the order total is over $100, offer free shipping", and the builder turns it into subagents, actions and instructions.
- Canvas view: the script shown as readable blocks. Type
/to add common patterns such as conditions and@to reference subagents, actions and variables. - Script view: edit the script directly, with syntax highlighting and validation. Developers can also pull the script into VS Code with Agentforce DX.
| In Agent Script | What it does | Use it for |
|---|---|---|
| prompt instructions | Natural-language guidance the LLM interprets | Tone, clarifying questions, explaining options |
-> logic instructions | Deterministic conditions the agent always follows | Eligibility rules, required checks, thresholds |
| Variables | Store state reliably instead of relying on the LLM's memory of the chat | "Customer verified", order ID, membership tier |
available when | Show a tool only when a condition is true | Hide refund actions until identity is verified |
Transitions and @utils.escalate | Move to another subagent, or hand off to a human service rep | Complaints, legal threats, high-value accounts |
Syntax from Salesforce's Agent Script reference; see also Get Started with Agent Script. Our rule of thumb: anything you would put in a compliance policy belongs in logic, and anything you would put in a style guide belongs in prompt instructions.
What Can an Agentforce Action Do?
An action is anything your org can already automate, made callable by the agent. Salesforce supplies standard agent actions, such as answering questions from knowledge, and you add custom actions built on Flows, Apex, prompt templates, MuleSoft APIs or external services. Salesforce recommends checking for a standard action before building a custom one. Each action needs a clear name, instructions on when to use it, and defined inputs and outputs.
| Action type | Use it to | Build style | Extra licence |
|---|---|---|---|
| Flow | Run low-code, rules-based automation and look up records | Low-code | No |
| Apex | Run pro-code logic and complex record retrieval | Pro-code | No |
| Prompt template | Have the LLM generate a response, such as a summary or a grounded answer (one way agents use RAG) | Low-code | Yes |
| MuleSoft API | Reach legacy systems and other external applications | Pro-code | Yes |
| External Service | Call REST APIs described by an OpenAPI spec | Low-code | Yes |
| Predictive model | Use a prediction, such as a score, inside the conversation | Low-code | Yes |
Source: the action-type table in Salesforce's Agentforce guide. Licence requirements change, so confirm them for your edition.

Prompt templates on their own are also useful outside agents. Salesforce describes them as single-turn and stateless, so they are the right tool for one-off jobs like summarising a case or rewording an email. Use an agent when the work needs several steps, choices between paths or actions in other systems. Agents can also be started from Flow or Apex through an invocable action, so an agent can run a step inside an existing automation.
How Does Agentforce Use Your Data to Answer Accurately?
Agentforce grounds each answer in your data at the moment of the question, using retrieval augmented generation (RAG). Structured data comes from Salesforce records through actions. Unstructured content, such as knowledge articles, uploaded files and websites, is indexed in Data 360 through the Agentforce Data Library. The model is not retrained on your data. It is handed the relevant facts each time.
The Agentforce Data Library does this in two stages, according to Salesforce's Data Library module:
At setup
Creating a library creates a data stream and data model objects in Data 360, splits the content into chunks, and builds a search index and a retriever.
At runtime
The question goes into a prompt template that calls the retriever. The most relevant chunks are added to the prompt, and the LLM answers from them.
Before replying
The response is checked against the prompt instructions and sources. With citations enabled, reviewers can see which source an answer came from.
Data 360 is not optional. Salesforce states that Data 360 must be provisioned and enabled for all Agentforce use, and that the Data Library and the Einstein Trust Layer don't work without it. Data 360 is the name Data Cloud has used since October 14, 2025. It also connects data that lives outside Salesforce, for example by bringing it in on a schedule, querying it in place without copying it (zero copy), or calling it live through an API action.
In practice, answer quality depends on content quality. If three knowledge articles disagree about your returns window, the agent can retrieve any of them. Cleaning up content is usually a bigger job than configuring the library. Our Agentforce data and knowledge integration work starts there.
What Can an Agentforce Agent Access, and How Is It Kept Safe?
An agent sees only what its user record allows, and its generative AI runs inside the Einstein Trust Layer. An employee agent runs as the signed-in user. A customer-facing Service agent runs as a dedicated agent user, created with minimal access, and you widen that access object by object, on the principle of least privilege. Third-party models work under zero data retention agreements, so they don't keep your prompts.
For Agentforce Service agents, Salesforce's agent user documentation sets out how this works:
- The agent user. Anonymous and unverified conversations run as the "EinsteinServiceAgent User" with the Einstein Agent User profile. Its profile, permission sets, field-level security and sharing rules decide what the agent can read or change.
- Secure by default. The user gets the Agentforce Service Agent Secure Base permission set and an agent-specific permission set. You add object access for every object the agent's Flows, Apex or prompt templates touch.
- Logged-in users. On a site where the customer is signed in, the agent runs as that customer, with that customer's own access.
- Getting it wrong cuts both ways. Too little access and the agent can't answer. Too much and it can expose data a customer should never see.
Salesforce lists the Trust Layer's protections for agents as grounding in CRM data, masking of sensitive data, toxicity detection, an audit trail with feedback, and zero data retention with third-party models. It also notes that some Trust Layer features apply only to the agent's final response, so don't treat masking as a replacement for tight agent-user access. Agentforce guardrails combine your own rules with protections managed by Salesforce, to keep agents on topic and limit hallucination and bias. Twopir's Agentforce governance and security service reviews agent-user access and guardrails before go-live.
Where Do Agentforce Agents Run, and How Do They Hand Off to People?
You build an agent once and deploy it to several channels without rebuilding the logic for each. Customer-facing agents run in web chat, in-app messaging, voice and mobile apps. Employee agents run inside Salesforce and Slack. Developers can call any agent through the Agent API, or from a Flow or Apex. Escalation to a human service rep carries the full conversation with it.
| Channel or interface | Typical use |
|---|---|
| Enhanced Chat v2 (web) | Customer service agents on your website, with JavaScript APIs to pass context such as the page or cart |
| Enhanced In-App Chat SDK | Service chat in your iOS or Android app, with human escalation that keeps the full context |
| Agentforce Mobile SDK | Conversational agents built into your own native mobile app |
| Agentforce Voice | Voice agents for service lines |
| Salesforce and Slack | Employee agents that work alongside users in the flow of work |
| Agent API, Flow and Apex | Start sessions from your own systems, or run an agent as a step inside existing automation |
Source: Salesforce's Agentforce APIs and SDKs overview. Handoff is where many first agents fail. Decide in advance which requests always go to a person, which queue receives them, and what the person sees when the case arrives.
How Do You Test and Monitor an Agentforce Agent?
Test manually in the builder's conversation preview, then in batches in the Agentforce Testing Center, and monitor every production session in Agentforce Observability. Batch tests pair sample questions (utterances) with the subagent, action and answer you expect. They run in parallel in a sandbox, and AI can generate hundreds of test conversations. After go-live, session traces show each decision the agent made.
| Tool | What it gives you | Best for |
|---|---|---|
| Conversation preview | Ask a question and see the plan: the subagent, the actions and the answer | Building and debugging |
| Testing Center | No-code batch tests from CSV, run in a sandbox (the new Testing Center is in beta) | Regression tests before each release |
| Agentforce DX and the Testing API | Test specs in YAML or XML, run from the CLI or code, with custom evaluations | CI/CD pipelines |
| Agentforce Observability | Session traces, quality and health metrics, citations and error locations in one dashboard | Production monitoring |
Sources: Trailhead's agent testing module and Salesforce's July 2026 Observability update. That update made out-of-the-box observability unmetered for every Agentforce customer, so it no longer draws on Flex Credits. Building new dashboards or bringing in external data is still metered. Session outcomes such as deflection are now judged by an LLM that reviews the whole session, using a prompt you can inspect and edit. See our Agentforce testing and deployment service for how we run this before launch.
How Is Agentforce Priced?
Agentforce is priced either by consumption or per user. With Flex Credits, each action an agent runs draws from a prepaid pool: 20 credits for a standard action and 30 for a voice action, at a list price of US$500 per 100,000 credits. That makes a standard action about US$0.10. Customer-facing agents can also be priced per conversation, and employee use can be bought per user.
| Model | How it is charged (list price) | Fits |
|---|---|---|
| Flex Credits | US$500 per 100,000 credits; 20 per action, 30 per voice action | Customer- and employee-facing agents, voice |
| Conversations | Per conversation (US$2 when Salesforce announced flexible pricing in May 2025; confirm the current rate) | Customer-facing agents |
| Agentforce add-ons | From US$125 per user per month (Sales, Service, Field Service); US$150 for Industries | Unmetered employee use for licensed users |
| Core, Advanced and Max editions | US$195, US$395 and US$550 per user per month, including 500,000, 1 million and 2.75 million Flex Credits | New purchases bundling Agentforce, Slack and analytics |
Salesforce's own worked example: a self-service agent that uses two actions per "where is my order?" request (verify the customer, then fetch the order) and handles 20 requests a day uses 24,000 credits a month, about US$120. A case-management example with 100 users and three actions per case comes to about US$1,800 a month. Sources: Agentforce pricing and the 2026 editions announcement. Contract prices vary, and Data 360 consumption and implementation are extra.
The cost driver to watch is the number of actions per request, not the number of conversations. A badly scoped subagent that calls four actions where one would do costs four times as much per answer.
What Agentforce Is Not: Four Common Misunderstandings
Agentforce is an AI agent platform, not a routing engine, a chatbot script tree or a system that teaches itself. Our February 2025 version of this article described it partly as call-centre routing and dashboards. Those features belong to Service Cloud's Omni-Channel, which agents can hand work to, but they are not how Agentforce works.
How Do You Build Your First Agentforce Agent?
Start with one narrow, high-volume job, map it before you build, and test it in a sandbox against real questions. A first agent that handles order-status questions or qualifies inbound leads well teaches you more than a broad agent that handles ten things badly. Most of the effort goes into the data, the permissions and the handoff rules, not into the builder.
These are the gaps we see most often when a company wants to switch on Agentforce:
Our Agentforce readiness assessment checks these in two to four weeks and ends with a costed shortlist of use cases. Sometimes the recommendation is "not yet". When you are ready to build, our AI agents for Salesforce team designs, builds and governs the agent. In one published project, we connected Salesforce, OpenAI GPT and AWS Textract for a US legal tech platform so that every inbound email and attachment becomes a Salesforce case note. That removed more than 15 hours a week of manual case-note work. Results depend on each company's data and process, so treat this as an example of the pattern, not a benchmark.
The Bottom Line
Agentforce works the same way whatever the job: a reasoning loop chooses a subagent, runs your actions against your data, and checks its answer before replying. The parts you control are the ones that decide whether it works. That means clear subagents, precise instructions, well-named actions, clean content and tight permissions.
- 1
Learn the loop: classify, load the subagent, decide, act, repeat, check grounding, respond.
- 2
Write distinct classification descriptions, and put business rules in Agent Script logic rather than prose.
- 3
Reuse your Flows and Apex as actions, and give each one a clear name and instructions.
- 4
Plan for Data 360, clean knowledge content and a least-privilege agent user.
- 5
Count actions per request to forecast cost, test in a sandbox, and monitor every session after launch.
Plan Your First Agentforce Agent With an Architect
On a 30-minute discovery call, a Twopir Salesforce architect will look at your data, processes and goals, and tell you which agent to build first and what needs fixing before you do.
Schedule a Discovery CallFrequently Asked Questions
Agentforce's reasoning engine routes each request to a subagent, loads that subagent's instructions and actions, and lets an LLM decide the next step. It runs actions such as Flows, Apex or API calls, reviews the results, and repeats until it can answer. The answer is checked for grounding before it is sent.
They are the same thing. In April 2026 Salesforce renamed agent topics to subagents, the Topic Selector to the Agent Router, and a Connected Agent to a Connected Subagent. Salesforce states that the functionality has not changed, so older documentation that says "topics" still applies.
The Atlas Reasoning Engine is the name Salesforce introduced for the part of Agentforce that plans and decides. It classifies the request, builds a prompt from the chosen subagent's scope, instructions and actions, calls actions in a loop, and checks the final response for grounding. Agent Script lets you add deterministic logic to that reasoning.
Agent Script is the language behind the new Agentforce Builder. It combines natural-language instructions with programmatic logic such as if/else conditions, variables and subagent transitions. You can write it by chatting with Agentforce, in a visual canvas, or directly in script view or VS Code.
Yes. Salesforce states that Data 360 must be provisioned and enabled for all Agentforce use, and that the Agentforce Data Library and the Einstein Trust Layer don't work without it. Data 360 is the name Data Cloud has used since October 14, 2025.
On Flex Credits, a standard Agentforce action uses 20 credits and a voice action 30. At the list price of US$500 per 100,000 credits, a standard action costs about US$0.10. Per-conversation and per-user pricing are also available, and contract prices vary.
No. An agent sees only what its user allows. Employee agents run as the signed-in employee. Service agents talking to anonymous visitors run as a dedicated agent user created with minimal access, and you add object permissions one by one. With signed-in customers, the agent runs with that customer's own access.
Twopir Consulting
Twopir Consulting helps growing and mid-market companies solve complex CRM, integration, and business system challenges. We implement, rescue, optimize, and integrate complex CRM and revenue systems, including Agentforce, Data 360 and AI delivery on Salesforce for 500+ clients over 12+ years.