Salesforce · Agentforce · How It Works

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.

Section 01 · Short Answer

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.

Layer 1 · Channels

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 message, plus up to the last six turns of conversation ↓
Layer 2 · Reasoning

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.

↓ run an action, read the result, decide again ↓
Layer 3 · Actions

Flows, Apex, prompt templates and APIs

The same automation your org already runs, now callable by the agent, plus Salesforce's standard agent actions.

↓ grounded in ↓
Layer 4 · Data and Trust

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.

Section 02 · Building Blocks

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 blockWhat it isExample
AgentThe whole assistant: its role, its subagents, its channels and the user it runs asA 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
InstructionsPlain-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."
ActionsThe tasks the agent can run, each with a name, instructions and defined inputs and outputsGet Order Details (a Flow); Change Delivery Date (Apex)
Variables and filtersStored facts about the conversation that show or hide subagents and actionsHide account subagents until the customer is verified
ChannelsWhere the agent is deployed; the logic is built once and reused on each channelEnhanced 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 earlier Agentforce agent builder editing an order topic, now called a subagent, with its actions listed: Order Status, Find Order Number, Check Order Status, Reorder, Create Order, Modify Order and Split Shipment, next to a conversation preview panel
One subagent ("topic" in this earlier builder) with the order actions it can call. The preview panel on the right lets you test while you build.

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.
Section 03 · Reasoning

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:

1. The agent is invoked.
→ By a user's message, or without a human by an event, a data change or an API call.
2. The request is classified.
→ The Agent Router compares the message with each subagent's name and classification description. If nothing matches, a default subagent is used.
3. Context is assembled.
→ The chosen subagent's scope, instructions and actions are added to the prompt with the message and recent conversation history (typically the last six turns).
4. The LLM decides.
→ Either run an action to get information or do a task, or reply to the user, for example to ask for a missing order number.
5. The action runs.
→ The Flow, Apex or API call executes, and its output goes back to the LLM with the same context.
6. The loop repeats.
→ The agent re-evaluates with the new information and runs another action or prepares a response.
7. A grounding check runs.
→ The response must be grounded in source information, stay within the subagent's instructions and scope, contain no unverified claims, and be free of prompt-injection risk.
8. The response is sent.
→ Or, if grounding keeps failing, a standard "I can't help with that" message is sent instead.
Agentforce builder plan trace for the question what is the status of my order: the user prompt, then Select Topic choosing Order Management, then Select Action choosing Retrieve Order Details, with the grounded order status answer shown in the preview
The plan trace shows each decision: the user prompt, the subagent chosen (Order Management) and the action called (Retrieve Order Details).

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.

Section 04 · Agent Script

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 ScriptWhat it doesUse it for
| prompt instructionsNatural-language guidance the LLM interpretsTone, clarifying questions, explaining options
-> logic instructionsDeterministic conditions the agent always followsEligibility rules, required checks, thresholds
VariablesStore state reliably instead of relying on the LLM's memory of the chat"Customer verified", order ID, membership tier
available whenShow a tool only when a condition is trueHide refund actions until identity is verified
Transitions and @utils.escalateMove to another subagent, or hand off to a human service repComplaints, 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.

Section 05 · Actions

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 typeUse it toBuild styleExtra licence
FlowRun low-code, rules-based automation and look up recordsLow-codeNo
ApexRun pro-code logic and complex record retrievalPro-codeNo
Prompt templateHave the LLM generate a response, such as a summary or a grounded answer (one way agents use RAG)Low-codeYes
MuleSoft APIReach legacy systems and other external applicationsPro-codeYes
External ServiceCall REST APIs described by an OpenAPI specLow-codeYes
Predictive modelUse a prediction, such as a score, inside the conversationLow-codeYes

Source: the action-type table in Salesforce's Agentforce guide. Licence requirements change, so confirm them for your edition.

Create an Agent Action screen for a Generate Pipeline Summary action, showing the action instructions describing when to use it, a UserId input with its own instructions, and a PromptResponse output set to show in the conversation
A custom action wrapping a prompt template. The instructions tell the reasoning engine when to use it; each input and output has its own instructions too.

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.

Section 06 · Data

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.

Section 07 · Trust

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.

Section 08 · Channels

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 interfaceTypical 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 SDKService chat in your iOS or Android app, with human escalation that keeps the full context
Agentforce Mobile SDKConversational agents built into your own native mobile app
Agentforce VoiceVoice agents for service lines
Salesforce and SlackEmployee agents that work alongside users in the flow of work
Agent API, Flow and ApexStart 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.

Section 09 · Testing

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.

ToolWhat it gives youBest for
Conversation previewAsk a question and see the plan: the subagent, the actions and the answerBuilding and debugging
Testing CenterNo-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 APITest specs in YAML or XML, run from the CLI or code, with custom evaluationsCI/CD pipelines
Agentforce ObservabilitySession traces, quality and health metrics, citations and error locations in one dashboardProduction 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.

Section 10 · Cost

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.

ModelHow it is charged (list price)Fits
Flex CreditsUS$500 per 100,000 credits; 20 per action, 30 per voice actionCustomer- and employee-facing agents, voice
ConversationsPer conversation (US$2 when Salesforce announced flexible pricing in May 2025; confirm the current rate)Customer-facing agents
Agentforce add-onsFrom US$125 per user per month (Sales, Service, Field Service); US$150 for IndustriesUnmetered employee use for licensed users
Core, Advanced and Max editionsUS$195, US$395 and US$550 per user per month, including 500,000, 1 million and 2.75 million Flex CreditsNew 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.

Section 11 · Myths

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.

1. "Agentforce routes cases to the best human agent." Omni-Channel routing does that. Agentforce does the work itself and escalates to a human when its instructions or scope say it should.
2. "The agent learns from every conversation." It does not retrain on your chats. It retrieves current data at the moment of each question, and improves when you change its subagents, instructions, actions or content.
3. "It's a smarter chatbot." Einstein Bots followed fixed dialog trees. An agent reasons over instructions and chooses actions. Salesforce offers a path to convert an Einstein Bot into an Agentforce agent while the bot keeps running.
4. "Turn it on and it works." An agent is only as good as the data, processes and permissions it is given. Most of an Agentforce project is preparing those.
Section 12 · Getting Started

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.

1. Pick one job and baseline it.
→ Choose a frequent, well-understood request. Record today's volume, handling time and resolution rate so you can measure the change.
2. Map the conversation.
→ Draw the path: what the agent must ask, which records it reads, which rules always apply, and when it hands off to a person.
3. Prepare the foundation.
→ Enable Einstein generative AI, Agentforce and Data 360. Clean up the knowledge content, and give the agent user only the access it needs.
4. Build subagents and actions.
→ Reuse existing Flows and Apex where you can. Write distinct classification descriptions, and put hard rules in Agent Script logic.
5. Test in a sandbox.
→ Preview manually, then run batch tests in the Testing Center using real customer phrasing, including edge cases and hostile inputs.
6. Launch, watch, refine.
→ Deploy to one channel, review sessions in Observability every week, and compare against the baseline before adding the next job.

These are the gaps we see most often when a company wants to switch on Agentforce:

Content nobody owns. Outdated or conflicting knowledge articles go straight into answers.
Automation debt. Overlapping Flows and legacy rules on the objects an agent touches make the same action behave differently each time.
Over-broad access. An agent user cloned from an admin profile can see far more than a customer should.

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.

Section 13 · Bottom Line

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. 1

    Learn the loop: classify, load the subagent, decide, act, repeat, check grounding, respond.

  2. 2

    Write distinct classification descriptions, and put business rules in Agent Script logic rather than prose.

  3. 3

    Reuse your Flows and Apex as actions, and give each one a clear name and instructions.

  4. 4

    Plan for Data 360, clean knowledge content and a least-privilege agent user.

  5. 5

    Count actions per request to forecast cost, test in a sandbox, and monitor every session after launch.

Ready to Start

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 Call

FAQ

Frequently 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.

TC

Twopir Consulting

Salesforce Partner · HubSpot Partner

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.