On this page (14)
The Agentforce best practices that matter most are about control: give each agent a small number of clearly separated jobs, put every business rule in fixed logic such as Flow, Apex or Agent Script, and let the AI model handle only the conversation in between. Then give the agent the narrowest access its job needs, test every change against a saved set of real requests, and name one owner who reviews its work each week and can switch it off. When an agent disappoints in production, it has usually broken one of those rules.
Which work should an agent do, and which should stay as Flow, rules or people?
Give an agent work where the request arrives in everyday language and the answer depends on understanding it: a customer explaining a problem, an employee asking about a policy, a rep asking what changed on a deal. Keep work that follows the same steps every time in Flow, the Salesforce automation tool, or in rules. As of November 2026, Salesforce's Agentforce guide recommends a standard Flow for any process that is static and never changes.
| If the work looks like this | Best fit | Why |
|---|---|---|
| Same trigger, same steps, every time | Flow or rules | Cheaper, faster and fully predictable |
| Request in free text, answer exists in records or approved articles | Agent | Understanding the request is the hard part |
| Request in free text, then a fixed process | Agent that calls a Flow or Apex action | The agent understands, the action does the work the same way every time |
| High-value judgment, exceptions, upset customers | Person, with the agent preparing a summary | Risk and relationship outweigh speed |
A background agent, one that works on records without a chat window, suits work that nobody is waiting on in real time, such as summarizing new cases or tagging inbound leads overnight. A chat agent suits work where a person is waiting for an answer. Background work is usually the safer first step, because staff can review the output before anyone outside the company sees it.
Signs a use case is too big for a first agent: it needs more than one or two systems outside Salesforce, more than a handful of actions, judgment calls nobody has written down, or answers that change by customer contract. Our readiness checklist has a scoring method for choosing the pilot from a long wish list.
What should be ready before you build the first agent?
Six things: clean data in the fields the agent reads, permissions limited to its job, current knowledge articles, no conflicting automation on the objects it touches, a way to grade its output, and a named owner. Confirm the licenses and features with your Salesforce account team, since packaging changes often. Our Agentforce readiness checklist covers each area in detail, and our cost guide covers licensing and consumption.
How should subagents, instructions and actions be structured?
Think of the agent as three layers. Subagents (formerly topics) are the jobs the agent can do, such as order status or returns. Instructions tell the agent how to do each job. Actions are the things it can actually execute, like looking up an order through a Flow. The agent first picks a subagent based on the request, then follows that subagent's instructions to choose actions.
Salesforce's published build guidance gives practical limits as of November 2026: keep an agent to roughly 10 to 15 subagents, and assign no more than 15 actions to any one subagent. More than that makes routing less consistent and responses slower. When a single agent needs more than that, it is usually doing two jobs and should be split.
- Name each subagent for one job, starting with a verb, and make sure no two names mean nearly the same thing.
- Write each subagent description in the words customers or employees actually use, because the routing step reads only the name and description.
- Define scope both ways, like a brief for a new hire: what this job covers and what it must not do.
- Make instructions specific: which action to use, in what order, and how to decide. Use exact action names.
- Be careful with "always" and "never". The agent reads them literally, and they can block reasonable requests.
- Write action descriptions in one to three sentences: what it does, when to use it, what it needs, and its edge cases.
When the agent ignores an instruction that seems clear, the cause is usually one of three things: the request was routed to the wrong subagent, two instructions conflict, or the instruction is carrying a business rule that belongs in an action. Fix routing first, by tightening subagent names and descriptions, since those are what the routing step reads.
For messy conversations, keep in mind that the reasoning engine typically sees only the most recent turns, typically the last six, according to Salesforce's guide as of November 2026. Store facts the agent must remember, such as a verified customer ID or an order number, in variables so they survive a long conversation. If users keep looping between two subagents, their descriptions overlap and need clearer boundaries.
Where should the AI reason, and where should fixed logic decide?
Use the model for understanding and wording, and fixed logic for anything with a right answer. Refund limits, eligibility checks, price calculations, the order of mandatory steps and identity checks should never depend on the model following an instruction. Instructions guide the model; coded business rules inside the action are what enforce the rule.
Salesforce describes a range of control levels, from letting the agent choose freely, through instructions, grounding in your data and variables, to Flow, Apex and API actions, and finally Agent Script. Agent Script is Salesforce's scripting language for agents: it lets builders write if/then rules, forced transitions between subagents and explicit variable handling, alongside the AI reasoning. As of November 2026, Salesforce includes Agent Script with Agentforce at no extra cost.
A useful pattern from Salesforce's guide is the "deterministic sandwich": fixed logic handles the start of an interaction, such as identity checks and gathering required details, and the end, such as writing the record and confirming. The model handles the conversation in the middle. Filters add another layer of control: they can hide a subagent or action until a condition is met, for example until the customer is verified or an order number is stored.
There is no fixed percentage of a workflow that should stay deterministic. A practical test: if two reviewers would agree on the right outcome every time, write it as logic. If the right response depends on reading the request, leave it to the agent, and grade it in testing.
Why does an agent give wrong answers when the right one is in your knowledge base?
Usually because retrieval found the wrong passage, or found two that disagree. Agents ground their answers by searching your articles and records, then answering from what the search returns. Long articles that mix several topics, near-duplicate articles with different answers, and internal notes stored next to customer content all make the wrong passage more likely to come back.
- Keep one topic per article, written as plain steps, with the question it answers in the title.
- Retire or merge duplicates so two articles never give different answers.
- Separate internal-only content so it cannot reach a customer-facing answer.
- Expose only the objects and fields the agent needs; every extra field is another chance to read the wrong one.
- Give every article an owner and a review date. When no department owns AI-ready content, the agent owner should assign it before launch.
Knowledge quality checks and grounding setup are covered step by step in the readiness checklist. If the agent grounds on Data 360 (formerly Data Cloud), include that setup and its usage in your plan from the start.
How do actions collide with your existing automation?
An agent action that updates a record fires everything already attached to that record: validation rules, record-triggered flows, Apex triggers and approval processes. Those were built for people clicking buttons, so they can block the agent with an error it cannot explain, or set off emails and updates nobody planned for an agent to trigger.
- Before build, list every automation on each object the agent will update, and test the agent's updates against them in a full-copy sandbox.
- Keep actions narrow: one action, one job, with clearly described inputs and outputs. Tell the agent how to clean inputs, such as removing formatting from phone numbers.
- Return a plain, safe error message from every action. It should tell the agent what to do next without exposing system details.
- Make record-creating actions check for an existing record first, so a retried request does not create a duplicate case or order.
- Remember that actions run as ordinary Salesforce transactions, so platform limits on queries, records and run time still apply. Test with realistic data volumes, because a sandbox with ten records hides these limits.
How should agent permissions and security be set up?
Every agent runs as a user, and that user's permissions decide what the agent can see and do. Under Salesforce's security guidance from September 2025, new agents start with no permissions, and actions inherit the permissions of the Flow, Apex or prompt template they call. Customer-facing service agents typically run as a dedicated agent user, so everything a customer can reach through the agent is limited by that user's access. That is why the agent user needs the narrowest access the job requires.
- Build the agent user's access from nothing with permission sets. Never clone an admin or a busy staff user.
- Check sharing settings and the role hierarchy, since they can widen access without anyone intending it.
- Require a verification step before sensitive actions such as changing contact details or account settings, and use filters to keep sensitive subagents hidden until the person is verified.
- Store verified facts in variables set by trusted system actions, so a user cannot simply claim to be verified.
- Review the agent user's permissions on a schedule, and every time you add an action.
Salesforce's Einstein Trust Layer, its set of AI safeguards, lists zero data retention with the model providers, data masking, toxicity detection, grounding in your data and permission-aware data retrieval as of November 2026. Those protect your data on its way to and from the model. They do not decide what the agent is allowed to do in your org. Treat text the agent reads from cases, emails and web forms as untrusted: someone can paste instructions into a case description. Limit what each action can change, validate inputs inside the action, and include these attempts in your test set.
How should you test an agent before launch?
Test against a saved set of real requests with written expected outcomes, run important cases more than once because output varies from run to run, test permissions logged in as the agent user, and agree go-live thresholds before the first run. Sandbox results are a good guide to production only when the sandbox has realistic data, the same automation and the same agent user setup. Our guide to testing Agentforce agents covers test sources, grading, adversarial prompts and go-live criteria in full.
How do you find out why an agent failed?
Work through the layers in order, because a failure early in the chain makes everything after it look wrong. Session traces in Salesforce's observability tools show each step the agent took, which makes this much faster.
| Check | What it looks like | Typical fix |
|---|---|---|
| 1. Routing | The request landed in the wrong subagent | Sharpen subagent names and descriptions; remove overlap |
| 2. Instructions | Right subagent, wrong choice of action or order | Make the instruction specific, or move the rule into a filter or Agent Script |
| 3. Action | Right action, wrong inputs or a failed call | Fix input descriptions, input cleanup and error messages |
| 4. Flow or Apex | The action ran but the result was wrong | Debug the Flow or Apex as you would for any user |
| 5. Permissions | Missing data, or an error only in production | Compare the agent user's access between sandbox and production |
| 6. Data and knowledge | Confident answer from the wrong record or article | Clean the source; retire duplicates; narrow what the agent can read |
For failures that happen only sometimes, save the exact conversation from the trace and add it to your test set, then run it several times. A case that fails one run in five is a real defect. Turning every production failure into a saved test case is the habit that keeps agents reliable over time.
How should agent changes move from sandbox to production?
Treat agent changes like code changes. Build and test in a sandbox, then move the agent's metadata to production with Salesforce CLI or your DevOps tool, together with everything it depends on: Flows, Apex, prompt templates and the agent user's permission sets. Salesforce's Trailhead deployment steps add checks after deploying: confirm the agent is active, the permission sets are assigned to the agent user, and each deployed Flow has the correct version active.
- Keep instructions, actions and the test set in version control together, so you can see what changed between a good run and a bad one.
- Rerun the full test set after every change, including a Flow change made for people that happens to touch an object the agent uses.
- Run the test set in a preview sandbox before each Salesforce seasonal release.
- Put any automation on objects the agent touches under the same change review as the agent itself.
Agent Script also helps here, since Salesforce stores it as a text file that can be reviewed and versioned like code.
What should you monitor after launch, and what is your incident plan?
Monitor outcomes and failures, which tell you far more than conversation counts. Our guide to monitoring Agentforce agents covers the native tools, KPIs, alerts and session traces in depth, and the implementation playbook lists what to read in the weekly review. The best practice to settle before launch is the incident plan, because the time to decide who can switch the agent off is not during a bad afternoon.
- Name who can deactivate the agent, and make sure that person can reach the controls quickly.
- Decide in advance what happens to conversations when the agent is off, such as routing them to a staffed queue.
- Keep a log of every record the agent creates or changes, so wrong updates can be found and reversed.
- After any incident, add the failing conversation to the test set before the fix goes live.
What does it take to run agents over time?
Measure cost per successful outcome, such as a case resolved without a handoff or a lead correctly routed. Cost per conversation hides the real number, because a cheap conversation that ends in a handoff and a repeat contact is expensive. Our Agentforce cost guide explains the billing models and what goes into total cost, including the build, testing and weekly tuning that never appear on the Salesforce invoice.
Ownership needs three roles: a business owner accountable for what the agent does, a builder who owns its configuration, and an admin or developer who owns the Flows, Apex and permissions underneath. In a small team one person can hold two roles, but not all three. As a planning rule, each live agent needs a few hours of review and tuning a week once it is stable, and more in its first month. Add the next agent only when the first one has an owner who is not also building the second.
Trust is the last best practice. Users stop using an agent after one confident wrong answer far faster than they adopt it after ten good ones. Start where staff review the output, say plainly what the agent can and cannot do, make the handoff to a person easy, and tell users when you fix something they reported.
Where Abstrakt Solutions fits
Abstrakt Solutions has been a Salesforce partner since 2017 and is a Salesforce Select partner. Our team holds 104 Salesforce certifications and has worked on nearly 900 Salesforce projects, plus 30 Agentforce, Data 360 and Claude projects. We design, build, test and tune Agentforce agents, set up the agent user and permissions, and put the test set, release checks and weekly review in place so the agent keeps working after launch.
What is the next step?
Tell us about the agent you are planning, or the one that is not behaving, through our contact form and we will set up a free Agentforce review. We look at your use case, subagents and actions, the automation and permissions underneath, and how you test and release changes. You leave knowing what to fix first and what it would take to get the agent reliable in production.
Questions people also ask
What are the most important Agentforce best practices?
Give each agent a few clearly separated jobs, put business rules in Flow, Apex or Agent Script, give the agent user only the access its job needs, test every change against a saved set of real requests, and name an owner who reviews the agent weekly and can switch it off.
How many subagents and actions should an Agentforce agent have?
As of November 2026, Salesforce guidance suggests about 10 to 15 subagents per agent and no more than 15 actions per subagent. More than that makes routing less consistent and responses slower, and usually means the agent should be split.
Why does my Agentforce agent ignore its instructions?
Most often the request went to the wrong subagent, two instructions conflict, or the instruction carries a business rule that belongs in an action. Check routing first by sharpening subagent names and descriptions, then move fixed rules into Flow, Apex, filters or Agent Script.
What is Agent Script?
Agent Script is Salesforce's scripting language for agents. It lets builders combine fixed rules, such as if/then checks and forced transitions between subagents, with the agent's AI reasoning. As of November 2026, Salesforce includes it with Agentforce at no extra cost.
Does the Einstein Trust Layer stop prompt injection?
The Trust Layer protects data on its way to and from the model, with features such as zero data retention, masking and toxicity detection. It does not decide what your agent may do in your org. Limit each action's scope, validate inputs inside actions, require verification before sensitive actions and test injection attempts before launch.
How do you debug an Agentforce agent?
Check the layers in order: routing to the subagent, the instructions, the action inputs, the Flow or Apex behind the action, the agent user's permissions, and finally the data or knowledge it read. Session traces show each step the agent took.
How do you deploy Agentforce agents from sandbox to production?
Move the agent metadata with Salesforce CLI or a DevOps tool, along with the Flows, Apex, prompt templates and permission sets it depends on. Then confirm the agent is active, the permission sets are assigned to the agent user and the right Flow versions are active, and rerun the test set.
