Agentforce Guardrails: What Salesforce Handles and What You Set Up

Agentforce Guardrails: What Salesforce Handles and What You Set Up header

Hey everyone,

Agentforce guardrails are the layers that keep an AI agent on task and safe: the Einstein Trust Layer that Salesforce provides (zero data retention, toxicity and prompt injection detection, audit trails), plus the guardrails you configure yourself (scoped subagents, approved actions only, rejection responses, and a least-privilege agent user). Salesforce calls this a shared responsibility model. Salesforce secures the foundation, and you’re responsible for access, permissions and agent-specific guardrails.

Here’s what each layer does, what you have to set up yourself, and the mistakes that leave gaps.

Agentforce guardrails: what Salesforce handles vs what you handle

Salesforce providesYou configure
Einstein Trust Layer between your org and the LLMsLeast-privilege permissions, profiles, permission sets and field-level security
Zero data retention with third-party LLM providersWhich subagents and actions the agent has
Toxicity and prompt injection detectionRejection responses for out-of-scope requests
Audit logging capabilitiesMonitoring agent activity, Enhanced Event Logs, human-in-the-loop for custom actions
Diagram of Agentforce guardrails under the shared responsibility model: the Einstein Trust Layer handles zero data retention, toxicity and prompt injection detection and audit trail; admins scope subagents, approve actions and set a least-privilege agent user.

Layer 1: the Einstein Trust Layer

The Trust Layer intercepts every prompt and response between your org and the large language models (LLMs) behind your agents.

Zero data retention. Third-party LLM providers don’t keep your prompts or responses, and your data isn’t used to train their models.

Toxicity and prompt injection detection. It checks both what users send and what the model returns. Trailhead describes toxicity scoring in five categories (violence, sexual, profanity, hate and physical) with an overall score from 0 to 1, where 1 is the most toxic.

Audit trail. It tracks how generative AI is used in your org so you can check it against your security, privacy and AI governance policies.

Layer 2: scope the agent with subagents and approved actions

Restrict what it handles. Define the specific subagents (formerly topics) and business jobs the agent is allowed to take on. Anything outside them is out of scope.

Limit actions. Give the agent only predefined, approved actions, like specific Flows, Apex classes or API calls. Salesforce says you can and should do this, because it stops the agent from doing things you never intended.

Write rejection responses. Set the message the agent gives when a request is out of scope, unethical, or against your security policy.

Layer 3: agent-level instructions and overrides

In Agent Script, agent-level system instructions apply to every subagent by default. A subagent can have its own system block, which overrides the agent-level instructions for that subagent only.

Why this matters for guardrails: if your agent-level instructions contradict a subagent’s reasoning instructions, Salesforce warns the agent can hang or behave unexpectedly. Use an override instead of hoping the agent sorts it out. Here’s the shape, adapted from Salesforce’s Agent Script example:

guardrail-system-override.agent
1  system:
2    instructions: "You are an event planning assistant. NEVER suggest alcoholic beverages for children's parties."
3
4  subagent baby_first_birthday:
5    description: "Plan a baby's first birthday celebration with adult guests"
6    system:
7      instructions: "Adult guests are present. You may suggest champagne for adults."

Layer 4: the agent user and data access

This is the guardrail people skip, and it matters most. Agents on public channels like Messaging or web chat run as a dedicated agent user, and that user’s permissions decide what the agent can do.

Employee agents run as the logged-in user, so your existing licenses, permission sets, field-level security and sharing rules apply automatically.

Customer agents run as that dedicated agent user. Salesforce’s best practice is to create a new agent user so it starts with minimal access, then grant only the permissions it needs.

Field-level and object security also control which data is available when the agent grounds its answers in your records and Knowledge.

Layer 5: test and monitor

Test off-topic and hostile prompts in Preview. Agentforce Builder’s Preview panel shows which subagent and actions the agent picks. Watch Live Test Mode: in live mode, the agent can change real data in your org. Switch to Simulate when you’re testing.

Keep watching after launch. Salesforce lists monitoring agent activity, Enhanced Event Logs and human-in-the-loop for custom actions as your responsibilities. Shield Event Monitoring and Field Audit Trail add deeper logging for orgs that need it.

Common Agentforce guardrail mistakes

  • Giving the agent user broad access “to make it work.” Whatever that user can do, the agent can do.
  • Adding every action “just in case.” Every extra action is something the agent might run.
  • No rejection response. Out-of-scope requests need a clear, friendly answer you wrote.
  • Instructions that contradict each other. Use a subagent override.
  • Testing in Live Test Mode against real records. Use Simulate.

Practice this for the Agentforce Specialist exam

Trust, security and agent configuration are big themes on the Agentforce Specialist certification. The Cert Lab gives you exam-style questions and hands-on tasks to practice them.

Cert Lab by Nick Frates

Practice Agentforce trust questions before the exam

Agentforce Specialist Cert Lab: lessons for every exam section, practice questions that explain every option, and flashcards. $9.99.

Start the Agentforce Specialist Cert Lab for $9.99 →

Practice questions

1. A customer-facing agent on a Messaging channel can update fields it shouldn’t touch. Where do you fix it first?

The agent user’s permissions and field-level security. Agents on public channels run as a dedicated agent user.

2. Agent-level instructions conflict with one subagent’s needs. What does Salesforce recommend?

Add a system block to that subagent to override the agent-level instructions for that subagent only.

FAQ

What are Agentforce guardrails? The Einstein Trust Layer from Salesforce, plus the scope, actions, rejection responses and permissions you configure.

Does Agentforce train the LLM on my data? No. Third-party LLM providers have zero data retention agreements and don’t use your data for training.

Who is responsible for agent security? Both. Salesforce secures the platform and Trust Layer. You handle least privilege, guardrails and monitoring.

Related: How to build an Agentforce Service Agent and Agentforce for Service.

Sources: Agentforce Security and the Shared Responsibility Model (Salesforce Help), Trust Layer, Agentforce Developer Guide, Agent Script System Overrides, Trailhead: Einstein Trust Layer, Salesforce blog: LLM data masking.

Hope this helps!

Best,

Nick

Keep reading

See all posts →

Salesforce Saturdays

Join 1,033 Salesforce pros getting one 10-minute tip on Salesforce tech or career growth every Saturday.