Agentforce prompt injection detection

Agentforce's Einstein Trust Layer detects prompt injection and toxicity and can deflect or end a conversation, but restricting topics, limiting actions and approving custom actions remain the customer's job.

On this page

Does Agentforce prompt injection detection meet our requirement?

Before approving Agentforce, a security or platform lead needs to know whether the agent can resist users who try to override its instructions. The Einstein Trust Layer provides built-in prompt injection detection on the Salesforce platform, and the sources supplied for this page do not describe a separate edition, add-on or tier for it. Detection is not the whole control, though: customers still own restricting agent topics, limiting agents to approved actions and enabling human-in-the-loop for custom actions, as Salesforce's shared responsibility article sets out.

Salesforce's Trailhead material says the Einstein Trust Layer flags attempts to trick an agent into ignoring its instructions and then deflects or ends the conversation. Audit trail records include safety and toxicity scores and are stored in Data 360, so the reviewer should confirm which of those records the security team can query, how long they are kept and whether they reach the customer's existing SIEM. Prompt scrutiny appears among the Trust Layer controls named in Salesforce's Agentforce Privacy FAQ, which is the document to check for scope.

Before sign-off, confirm in writing with Salesforce which detection behavior applies to your org's Agentforce version and licenses, what the false positive and false negative handling looks like, and whether detection covers every channel your agents use. Then test the boundary yourself: attempt instruction overrides against each agent with its real topics and actions, and confirm that the agent cannot perform an action outside its approved list even when detection does not fire. If those tests fail, the gap sits in your permission and topic design, which Salesforce does not own.

Prompt injection controls by layer and responsibility

This table compares each prompt injection control against who provides it: Salesforce through the Einstein Trust Layer, or the customer through configuration. The third column shows whether the control is built in by Salesforce, customer configured, or still to be confirmed with Salesforce, so reviewers can see where their own evidence is needed. The main takeaway is that detection and deflection are vendor functions, while limiting what the agent can reach and do stays with the customer.

ControlWhat it doesResponsibility
Prompt injection detectionFlags attempts to trick the agent into ignoring its instructions, as described in Trailhead's Einstein Trust Layer module.Built in by Salesforce
Toxicity detectionScreens prompts and responses for toxic content as part of the Einstein Trust Layer.Built in by Salesforce
Conversation deflection or endingDeflects or ends a conversation once an injection attempt is flagged. Confirm the exact trigger and wording with Salesforce.Built in by Salesforce
Safety and toxicity scores in audit trailRecords safety and toxicity scores in audit trail records stored in Data 360. Confirm retention and access settings for these records.Built in by Salesforce, to be confirmed with Salesforce for retention
Prompt scrutinyListed in Salesforce's Agentforce Privacy FAQ among the Einstein Trust Layer controls that apply to Agentforce.Built in by Salesforce
Restricted topicsLimits the subjects an agent will address. Reviewers should confirm which topics are blocked for each agent.Customer configured
Approved actionsLimits the agent to actions the customer has approved. The agent's reach depends on its permissions and agent user.Customer configured
Human-in-the-loop for custom actionsRequires a person to approve custom actions before they run. Confirm which actions require approval in each deployment.Customer configured

How the Einstein Trust Layer handles an override attempt

The Einstein Trust Layer screens each user message before the agent acts on it. When a message reaches an Agentforce agent, the layer checks for attempts to trick the agent into ignoring its instructions. Salesforce's Trailhead material says flagged conversations are deflected or ended, so the agent stops following the attempted override. Prompt scrutiny and toxicity detection run within the same layer, as listed among the Einstein Trust Layer controls in Salesforce's Agentforce Privacy FAQ. Ask Salesforce to show you, in a test org, exactly what a flagged conversation looks like to an end user and whether the agent can resume the session.

Safety and toxicity scores for each interaction are written to the audit trail, which Salesforce says is stored in Data 360. For a security reviewer, this is the record that shows whether injection attempts are happening and at what rate. Confirm with your admin team which fields hold the scores, who holds read access to them, how long they are retained in your Data 360 configuration, and whether they can be exported to your SIEM. Do not assume the audit trail is complete for every channel until you have tested it, and plan a review of flagged conversations as a routine control.

Detection is a screening layer, not a guarantee. A crafted prompt can evade screening, so the layer should never be the only barrier between a user and a sensitive action. The more important question is what a successful override could reach. An agent's topics define the subjects it will address, and its actions and agent user permissions define the records it can read or change. Limit each agent to approved topics, restrict actions to the minimum needed, and require human approval for custom actions that write data. Salesforce's shared responsibility article places these configuration choices with the customer, so they remain your decision and your evidence to produce.

Request flow for a prompt injection attempt

The flow starts when a user or external input reaches the Agentforce agent. The Einstein Trust Layer screens that input for attempts to override instructions and for toxicity. Flagged conversations are deflected or ended, while clean requests pass to the topics and actions the customer has restricted. Custom actions wait for human approval, and safety scores are written to the audit trail in Data 360. Reviewers should confirm which screening outcomes their configuration produces and which actions still run without a human step.

Where a flagged prompt is screened, deflected, logged and where customer controls apply.

Decisions to make before enabling agents that take actions

Prompt injection detection in the Einstein Trust Layer flags attempts to override an agent, but it does not decide what the agent is allowed to do once a conversation is running. Salesforce states that customers remain responsible for restricting topics, limiting agents to approved actions and enabling human-in-the-loop for custom actions, so the decisions below set the blast radius if an injection gets past detection.

Which topics the agent may answer

Restricted topics define the subjects an agent will engage with. A narrow topic list limits the instructions an attacker can try to override and the content the agent can be steered toward. Check which topics are enabled for each agent, who approved them, and whether out-of-scope requests are deflected or escalated. Review topic instructions the same way you review any prompt that carries business rules, since topic text defines what the agent treats as normal.

Shared responsibility article

Which actions the agent may invoke

Actions are where a manipulated agent can change records, send messages or call external systems. Limit each agent to the actions its use case needs, and confirm which Flow, Apex or API actions are exposed. Ask who owns each action and whether it can be invoked without a user in the loop. The fewer actions an agent holds, the less damage a successful injection can cause.

Agent user permissions behind each action

An agent acts through an agent user, and that user's permission sets decide what it can read and write regardless of what the prompt asks for. Create a dedicated agent user per agent with the minimum object and field access. Confirm that the agent user cannot reach data beyond the agent's purpose, because prompt injection detection does not restrict database permissions.

Human-in-the-loop for custom actions

Salesforce states that customers must enable human-in-the-loop for custom actions. Decide which actions need a person to approve before they run, such as refunds, record deletions, outbound email or changes to customer contact data. Approval adds a review step but depends on the approver seeing the full action, so confirm what the approval screen shows.

Grounding data fields the agent can see

Grounding data is the record content the agent reads to answer. Any field the agent can read is a field an injected instruction can ask it to repeat or act on. Apply field-level security to grounding objects, exclude sensitive fields such as free-text notes, identifiers and health or financial data, and test whether the agent returns restricted values when asked directly.

Safety score log retention and review

Audit trail records include safety and toxicity scores and are stored in Data 360. Decide how long those records are kept, who can query them, and who reviews flagged conversations for patterns that suggest repeated injection attempts. Confirm the retention period with your Salesforce account team and your own records policy before you rely on the logs as evidence.

Trusted agents with Data 360

A detection layer outside Salesforce

The Einstein Trust Layer judges prompts and responses inside the platform, but content it cannot judge still reaches the agent, including text pulled from external sources. Decide whether to add a filter or review step outside Salesforce for inputs from untrusted channels. Ask Salesforce which injection patterns it detects and where its detection gaps are, and document what remains your responsibility.

How the prompt injection answer changes by use case

A customer-facing agent answers questions from anyone who can reach the chat, so it receives the most hostile input. The Einstein Trust Layer flags attempts to trick the agent into ignoring its instructions and can deflect or end the conversation. That detection is one layer. Your job is to limit what a successful override could reveal or do.

  • Detection scope: The Trust Layer flags override attempts and can deflect or end the conversation. Treat a flagged turn as a signal to review, not as proof that every injected instruction was caught.
  • Topic restriction: Limit the agent to published topics such as order status or product questions, and define explicitly what it must refuse.
  • Grounding content: Expose only knowledge that is safe for any visitor to read, because retrieved content can be repeated back to the user.
  • Safety score review: Review logged safety and toxicity scores in the audit trail to tune topics, escalation paths and refusal wording.

Confirm what an unauthenticated visitor can get from the agent and whether the published topics cover every action it can take. The shared responsibility article sets out which of these controls remain with you.

Order of work before production rollout

This sequence turns the Einstein Trust Layer's injection detection from a vendor feature into a tested, owned control before any agent reaches customers. Each step ends with a written output that a security reviewer can check. Confirm with Salesforce and your own admins before you move to the next step.

  1. Confirm detection scope and audit fields with Salesforce

    Ask Salesforce, in writing, which prompt injection and toxicity checks the Einstein Trust Layer applies to your Agentforce edition and org, and which of them can be configured or turned off. Ask for the exact audit trail fields that hold safety and toxicity scores, and confirm that those records are stored in Data 360 for your setup. The owner is the Salesforce admin with the security lead reviewing the answers. The step is done when you hold a written scope statement and a list of field names you can query.

  2. Define agent topics and approved actions

    Write down what each agent is for, which topics it may answer, and which topics it must refuse or hand off. List every action it may call, such as record reads, record updates, or outbound messages, and mark which ones are out of scope. Salesforce's shared responsibility guidance places topic restriction and action limits with the customer, so this list is your control, not the platform's. The step is done when each agent has a signed-off topic list and an action register that engineering and the business owner both accept.

  3. Configure agent users with least privilege

    Create a dedicated agent user for each agent and assign only the permission sets needed for its approved actions. Apply field-level security to grounding data so an injected instruction cannot pull fields the agent never needed. Review sharing rules so the agent user cannot see records outside its business purpose. The admin who owns Salesforce security performs the change, and the output is a permission report per agent user that a reviewer can compare against the action register from the previous step.

  4. Require human approval for custom actions

    For every custom action that writes data, sends external messages, or moves money or records, enable human-in-the-loop approval before execution. Salesforce's guidance places this responsibility with the customer, so the platform's detection alone will not stop a manipulated agent from taking a write action. Test that an approval request appears and that a rejected request leaves no change in the record. The step is done when the approval path is documented and tested for each custom action.

  5. Run adversarial prompt tests against each agent

    Build a test set of direct and indirect injection attempts that try to override the agent's instructions, reveal its configuration, or trigger actions outside its topics. Include attempts hidden in data the agent reads, such as record fields or case text. Run the set against a sandbox org before production, record whether the Einstein Trust Layer flagged, deflected, or ended each conversation, and log any bypass. Testing can be done by your team or by a security testing provider. The step is done when every failed case has a fix or an accepted risk record.

  6. Confirm where safety scores are stored and who reads them

    Using the field names from the first step, verify that safety and toxicity scores are written to the audit trail for your test conversations. Document which roles can query Data 360 or the audit records, and remove access for anyone who does not need it. Confirm with your security team whether the audit records meet your retention and access rules, since Salesforce's privacy terms tie some retention to the underlying services. The output is an access matrix and a written retention position that your compliance reviewer signs.

  7. Set a review cadence for flagged conversations

    Assign an owner to review flagged and ended conversations, and agree how often that review happens before launch. Define the triage path: what counts as an attack, who investigates, when an agent's topics or actions are changed, and how the change is tested again. Include a route for reporting suspected injection to the agent owner and the security team. The step is done when the cadence, owner, and triage steps are written into the agent's operating procedure and the first review has been scheduled.

Evidence a security reviewer should ask for

This table lists the artifacts a reviewer should request to test Agentforce prompt injection defenses, the source that describes each one, and what each artifact shows. Read it as a request list: the vendor documents explain the platform layer, while the configuration exports and test results show what your organization has actually restricted and verified.

ArtifactSource or originWhat it shows the reviewer
Shared responsibility descriptionSalesforce Help: Agentforce Security and the Shared Responsibility ModelWhich controls Salesforce provides (including toxicity and prompt injection detection) and which ones the customer must configure
Einstein Trust Layer descriptionTrailhead: Secure Agents with the Einstein Trust LayerHow the layer flags attempts to make an agent ignore its instructions and how it deflects or ends the conversation
Prompt scrutiny control listingAgentforce Privacy FAQ (June 2025)Confirmation that prompt scrutiny is among the Einstein Trust Layer controls that apply to Agentforce
Audit trail configuration exportYour org's Einstein Trust Layer audit trail settings and Data 360 recordsWhether safety and toxicity scores are being recorded and where they are stored for review
Agent topic and action inventoryYour Agentforce Builder configurationWhich topics are enabled, which actions each agent may call, and which actions require human approval
Agent user permission set assignmentsYour org's setup for agent users and permission setsWhat data and objects an injected instruction could reach if the agent were manipulated
Adversarial prompt test resultsYour own or a contracted test run, documented with prompts, outcomes and remediationWhether override attempts were blocked, deflected or escalated in your configuration, not only in Salesforce's default setup

Questions buyers ask about Agentforce prompt injection

Is prompt injection detection included in Agentforce?

Yes, detection is part of the Einstein Trust Layer that Salesforce provides for Agentforce, but the supplied material does not map every control to a specific edition or license, so confirm that in writing before approval. Salesforce's Agentforce Security and the Shared Responsibility Model article lists detection of toxicity and prompt injection among the Einstein Trust Layer features Salesforce supplies. The Agentforce Privacy FAQ also lists prompt scrutiny among the Einstein Trust Layer controls that apply to Agentforce. Ask Salesforce for the control list for your contracted edition, the pricing model you buy (Flex Credits, per-conversation fees or per-user add-ons), and whether any add-on changes which controls you receive. The price you pay does not show which safety controls you get.

What happens to a conversation flagged for prompt injection?

The Einstein Trust Layer flags attempts to trick an agent into ignoring its instructions, and it deflects or ends the conversation. Salesforce's Trailhead module on securing agents describes this behavior, so treat it as the documented baseline and verify it in your own org. Your runbook should cover what the end user sees, whether the agent hands the conversation to a person, and whether a flag opens a case in your ticketing or SIEM tooling. The supplied material does not say that a flag creates a case, so confirm that behavior with Salesforce and test it with your own agent topics. Also decide who reviews repeated flags from the same user or channel, because repeated attempts can show a deliberate probe.

Where are prompt injection safety scores logged, and how long are they kept?

Audit trail records include safety and toxicity scores, and Salesforce's Trailhead module on trusted agents with Data 360 states that these records are stored in Data 360. The supplied material does not give a retention period for the scores, so ask Salesforce for the default retention, whether your organization can change it, and how to export the records to your own log platform. Confirm also whether the audit trail stores full prompts and responses, because that decides what personal data sits in the log and which retention and deletion rules apply to it. The Agentforce Privacy FAQ states that Customer Data is stored in the underlying Salesforce services, so include the Data 360 location in your data-residency review.

Does prompt injection detection stop indirect injection through documents or records?

The supplied material describes detection of attempts to trick the agent into ignoring its instructions. It does not say that detection covers instructions hidden in documents, emails, web content or CRM records that the agent reads while answering. Treat indirect injection as an open question until Salesforce confirms how grounding data is screened. Ask whether retrieved content is scanned, which data sources are in scope, and how the agent separates retrieved text from its instructions. Your defenses then sit in the design: limit which fields and sources ground the agent, restrict actions that write data, and require approval for consequential steps. Testing your own agents with planted instructions inside the data they read will show how the platform behaves in your setup.

What must our team configure to limit the impact of prompt injection?

Salesforce's shared responsibility article states that Salesforce provides the Einstein Trust Layer and that customers remain responsible for configuring their agents. The customer-side controls it names are:

  • Restricting agent topics so the agent answers only within approved scope.
  • Limiting agents to approved actions, with each agent user holding only the permissions it needs.
  • Enabling human-in-the-loop approval for custom actions that change data or trigger outside systems.

Also review field-level security on grounding data. An injected instruction can only cause harm through the data and actions the agent can reach, so narrower access shrinks the damage a successful attempt can do. Document each control, its owner and the review cycle, because auditors and security reviewers will ask for that evidence.

What would an outside security test of our Agentforce agents cover?

DeployOpen runs security testing for AI systems and agents, including red teaming, so an engagement would test agents against injection attempts and misuse paths within a scope agreed in writing before work starts. For illustration only, a scope could include agent topics and actions, agent user permissions, grounding data sources, custom actions that write data, and the logs produced when an attack is attempted. Effort rises with the number of agents, topics, actions, data sources and integrations, and with the number of approval paths that must be tested. Ask for the deliverables, retest rights, and whether testing uses a sandbox or production org. DeployOpen does not issue audit reports or certifications, so the output is evidence for your own review and for any independent auditor you engage.

Can our own team configure prompt injection controls without outside help?

Yes. The configuration work sits with the customer under Salesforce's shared responsibility model, so an internal Salesforce admin and security team can set topics, agent user permissions and approvals directly. Outside help is optional and most useful for verification, meaning an independent check that the configuration holds up against injection attempts. DeployOpen is not a Salesforce partner or reseller, and its security testing covers AI systems and agents, so it would test your setup and report on it, which is separate from administering your org. Internally, check your skills in the Salesforce permission model, access to Data 360 logs, incident response for flagged conversations, and change control for topic and action edits. Ask Salesforce for admin documentation for your edition before you commit to a plan.

How DeployOpen tests and governs Agentforce agents

DeployOpen plans, implements, tests and documents the controls around Agentforce prompt injection detection inside the client's own environment. Salesforce supplies the Einstein Trust Layer, so our work focuses on the customer-side settings that decide how an agent behaves when someone tries to override its instructions.

How we scope

  • Written scope lists which agents, topics, actions and custom prompts are in the review for injection exposure.
  • We confirm which Einstein Trust Layer audit records and safety scores the client will review and who owns them.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work begins.

How we build

  • We configure restricted topics, approved actions and human-in-the-loop steps that the customer must own under Salesforce's shared responsibility model.
  • We run security testing against agents, including scripted prompt injection attempts, and record which attempts were flagged, deflected or missed.
  • We document the test cases, configuration keys and any gaps that remain in Salesforce's built-in detection for the client's risk review.

How we hand over

  • Handover includes configuration records, test evidence and a written list of defenses the customer still needs to operate.
  • We provide runbooks for reviewing safety and toxicity scores in the audit trail stored in Data 360.
  • Findings are tied to the client's own permissions and agent user setup so reviewers can trace each control to an owner.

How we support

  • Ongoing support, re-testing after agent changes and continuous testing are available as retainers.
  • Retainer scope is set in writing and can cover new topics, actions or Agentforce feature releases the client adopts.
  • Quotes follow from the written scope, so the client can ask us to itemize testing, documentation and support effort separately.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.