Most Agentforce deployments stall in the same place. The agent answers questions, resolves the easy cases, and then does something unpredictable on the tenth one: it picks the wrong action, invents a policy number, or hands a customer an answer that contradicts your actual business rules. Teams respond by writing longer instructions, which helps for a few weeks and then the drift returns. The assumption underneath all of it is wrong: reliability is not a prompt-tuning problem. It is a control problem, and Salesforce built a ladder for it.
The Agentforce architect guide defines six levels of agentic control, from instruction-free reasoning up to fully deterministic, hard-coded execution.1 Each level is a build decision, not a writing decision. Climb the ladder and the same workflow gets more predictable, more auditable, and safer. Stop early and you are shipping an LLM with guardrails bolted on, which is the configuration most production failures come from. This article walks the six rungs, names the concrete implementation pattern that belongs on each, and maps every one to a real build task across Data Cloud, Flow, Apex, and Experience Cloud. It is the companion to our integration seams piece, which describes the layers and the wiring. This is the sequence that makes the thing reliable.
Level 1: Instruction-free subagents, and the freedom that bites you
At the first rung the agent consists only of subagents (the April 2026 rename of what used to be called topics) and prompt actions, with nothing but names and classification descriptions to guide it.1 This is the largest degree of freedom an agent ever has. The reasoning engine, built on the ReAct pattern, classifies the user's message against the subagent descriptions, selects one, and lets the LLM decide which action to run, purely from the ongoing conversation.1

This is the right starting point only for demos. The agent has an implicit off-topic subagent, but nothing constrains its choices beyond how well you wrote the descriptions.1 The cost shows up in production as the agent reaching for the wrong action when two capabilities sound similar, for example a knowledge-lookup subagent grabbing a troubleshooting action. The fix is not more words in the description, it is moving up the ladder to give the reasoning engine explicit constraints.
Level 2: Instructions turn guidance into policy
The second rung adds instructions: rules, guidelines, guardrails, and examples that tell the agent how to handle each subagent, execute actions, and process outputs.1 Instructions are written at two granularities. Actions carry instructions that describe what the action does, which tells the engine when to call it, plus natural language descriptions of the action's inputs and outputs so the engine can prepare them correctly.1 Subagents carry higher-level instructions that govern tone, the desired sequence of actions, prerequisites, and when to escalate to a human.1
The discipline that separates a reliable agent from a brittle one is treating these as executable policy, not flavor text. The setup sequence is the same either way: create the agent from a template, configure channels, define topics, add actions, write instructions, set guardrails, test in the Agent Tester, then deploy.2 The step teams skip is the testing one, and it is the one that exposes whether the instructions actually constrain behavior. Topic classification quality, the natural language description of what belongs in each topic, is the single most common cause of incorrect agent behavior in production.2 Budget real time in the Agent Tester with diverse conversation samples before you activate.
Level 3: Grounding is where Data Cloud earns its place
Instructions constrain what the agent may do. Grounding determines what it actually knows, and it is the rung where Data Cloud (renamed Data 360) becomes load-bearing. Without grounding the agent answers from whatever the reasoning LLM carries, which for a service agent means confident hallucinations about your policies. Grounding connects the agent to external knowledge sources so answers are accurate, up-to-date, and verifiable.1
The implementation pattern is a retriever. In Data Cloud you build the pipeline that turns source content into a search index: ingest, map to a data model object, and build the index.3 Then you create a custom retriever in Einstein Studio that returns the chunk field, the actual text your FAQ or knowledge article lives in, rather than the grab bag of fields Data Cloud returns by default.3 The gotcha that trips every first implementation is the default retriever reference, {!$EinsteinSearch:sfdc_ai__DynamicRetriever.results}, which looks across web and internal knowledge sources you may not want the agent touching. Override it with your curated retriever.3

The reason grounding matters for reliability more than anything else on this ladder is that it changes what the agent is allowed to say. A grounded response is one the engine checks against retrieved chunks and the subagent's scope before sending it to the customer.1 That check is the difference between an answer that happens to be right and an answer that is verifiable. For the wider Data 360 setup, identity resolution, data streams, and calculated insights, our Data 360 implementation patterns walk the ground this rung stands on.
Test the retriever before you wire it to the agent. Salesforce guidance is to validate responses in Prompt Builder first, where you specify the retriever, see exactly which chunks come back, and adjust the instructions, before assigning it to a live agent.3 Retriever results default to 20 chunks, a balanced number between having enough context and overwhelming the LLM.3
Level 4: Variables give the agent working memory
The fourth rung lets the agent work with variables: session-scoped state it captures and carries across interactions, so a conversation becomes a tailored one rather than a stateless exchange.1 A service agent uses variables to hold the order number, the customer's account tier, and the outcome of earlier steps, and to reuse that context in later decisions and answers.
Variables are where the distinction between an agent and a scripted flow starts to blur in a useful direction. An agent with variables can personalize without you hard-coding every branch. The reliability win is that the agent stops re-asking for information it already has, which removes a whole class of user frustration and a whole class of inconsistency between turns. Keep the variable surface small. A variable that duplicates data you can look up is a maintenance trap, because it drifts from the source of truth the moment anything updates.
Level 5: Deterministic actions are where Flow and Apex plug in
The fifth rung integrates the agent with Salesforce's core execution machinery: Apex, APIs, and Flow.1 This is the rung where the directive's Flow and Apex components become concrete. An action is one of five types: execute Apex code, call an API, execute a flow, get an LLM response to a prompt template, or call a predictive model.1 The choice between them is the same logic as the Flow-versus-Apex decision: Apex for complex business logic, external integrations, and multi-object operations needing transaction control; Flow for admin-maintained processes and rapid iteration.2
An @InvocableMethod Apex method becomes an agent action the reasoning engine calls when the conversation context and the action's description match.2 An autolaunched Flow with defined input and output variables becomes a callable action with no code, letting admins contribute agent capabilities directly.2 The two directions of the Flow-agent relationship, an agent calling a Flow and a Flow calling an agent, are the plumbing we covered in Flow orchestrates Agentforce; on the ladder they are both level 5, the point where the agent stops reasoning about work and starts doing it through deterministic machinery.
This rung is also where the Summer '26 Apex security changes land, and they are not optional. As of API version 67.0, database operations run in user mode by default, enforcing the running user's sharing rules, field-level security, and object permissions; the WITH SECURITY_ENFORCED clause is removed entirely in favor of WITH USER_MODE; and any operation that needs system mode must ask for it explicitly with WITH SYSTEM_MODE.4 An Apex action an agent calls now runs under these defaults, which means the same action behaves differently depending on which identity crossed the boundary. Test both the integration user and a restricted end user before you upgrade a class, because tests that passed on 66.0 do not guarantee correct behavior on 67.0. The full code migration is our Apex v67 guide.
Level 6: Agent Script hard-codes the reasoning
The top of the ladder is deterministic control with Agent Script. Where earlier levels let the LLM decide which tool to use, Agent Script lets you hard-code the reasoning process itself: mandatory authentication gates, if/else conditional branching, forced subagent transitions, and run-after-action logic that executes regardless of user input.1 It also transforms the Agent Router (formerly the Topic Selector) into a fully configurable element, removing the black box of probabilistic routing and giving you absolute transparency over how the agent navigates.1

The mental model is hybrid reasoning. You sandwich the conversational flexibility of an LLM between layers of guaranteed execution: a mandatory identity check runs first, the LLM handles the flexible middle of the conversation, and a deterministic branch forces the escalation path for the high-stakes outcome.1 That is the shape a compliance workflow needs, where a customer must authenticate before the agent touches an account, and where the escalation to a human must fire on a fixed condition, not on the model's mood.
Agent Script is not the answer for every agent. It costs you the fluidity that makes an agent an agent, and it adds authoring complexity. Use it where the business process has hard gates, regulatory disclosures, or multi-step dependencies that cannot tolerate variance, and let the lower rungs carry the conversational work.
The security model is one rung the whole ladder rests on
Running all of this is a security posture that is independent of which rung you sit on, and it got stricter in Summer '26. An agent acts with the permissions of its running user, not the person who invoked it, so the blast radius of any agent action is the running user's effective access.5 On an Experience Cloud site, the guest profile is the outer boundary, and a documented active threat-actor campaign has been exploiting overly permissive guest configurations on public sites.6 Restrict the guest profile to the minimum objects and fields the site requires, scope the agent's running user to exactly what it needs, and treat the guest user as a hostile actor.

The identity rule from our integration seams piece holds one level out: an agent that calls an external system must act as the user, respecting that user's permissions in the external tool, never through a shared system key. The determinism ladder makes this concrete: the higher you climb, the more powerful the actions you attach, and the more the running-user and guest-user model decides who can trigger them.
Test before you promote, every rung
The reason teams get stuck at level 2 is that they never create the loop that lets them climb. The Agentforce Testing Center exists for exactly this, and it is the mechanical gate for ladder climbing: it generates test cases from your agent's subagents and actions, runs large-scale batch evaluation, and scores response accuracy, subagent and action validation, and quality metrics like completeness, coherence, conciseness, latency, and instruction adherence.7 It is available in Enterprise, Performance, Unlimited, and Developer editions, and running tests consumes credits, so plan it into the budget.7
Two operational rules matter. Test only in a sandbox: testing agents can modify CRM data, and the docs are explicit that you use Testing Center only in a sandbox environment.7 And re-run it after every rung you climb, because adding grounding, variables, or deterministic actions changes how the agent routes and responds. A test suite that passed on level 2 is not evidence that level 5 still works.
The ladder is the build order
Put it together and the sequence is legible. Start at level 1 to get a working conversational surface. Add instructions at level 2 and validate classification hard. Build the Data Cloud retriever and ground the agent at level 3. Add variables at level 4 only where they reduce re-asking. Attach Flow and Apex actions at level 5, and re-verify every action under the v67 user-mode defaults. Reach for Agent Script at level 6 only where the process demands a hard gate. Test at every promotion, in sandbox, before you activate.
We have seen the failure mode in our own delivery pipeline: an agent handed a set of capabilities without a grounding step answered confidently and reached for the wrong access, and the fix was exactly this sequence, ground before you act, constrain before you release. Reliability is not a quality you tune in. It is a position on a ladder you choose, one rung at a time.
Sources
-
Salesforce, "Achieving Reliable Agent Behavior" (levels of agentic control, the reasoning engine, subagents, actions, and Agent Script). salesforce.com ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15
-
Digital Applied, "Salesforce Agentforce 2026: CRM Automation Guide" (setup sequence, topics, actions, instructions, guardrails, and the Flow-versus-Apex action choice). digitalapplied.com ↩ ↩2 ↩3 ↩4 ↩5
-
Salesforce Ben (Atlas Can), "Connecting Agentforce to Data Cloud for Grounding With RAG" (the custom retriever, the Chunk__c field, the default-retriever override, and Prompt Builder testing). salesforceben.com ↩ ↩2 ↩3 ↩4 ↩5
-
Salesforce, "Database Operations Run in User Mode by Default, Not System Mode" (Summer '26 Release Notes) and "Summer '26 Release Architect Highlights". help.salesforce.com ↩
-
Salesforce, "Summer '26 Release Architect Highlights" (the security changes with hard enforcement dates in API version 67.0). salesforce.com ↩
-
Salesforce, "Essential Actions to Secure Experience Cloud Guest User Access" (the active threat-actor campaign exploiting permissive guest configurations). salesforce.com ↩
-
Salesforce, "Agentforce Testing Center" (batch evaluation, quality metrics, sandbox-only, and editions). help.salesforce.com ↩ ↩2 ↩3



