---
schema_version: "1"
id: 3413d6780a15c5d0a0443a585475f97ee9f12a87fa886b61139c5d9254a01274
title: Agent Execution Context and Data Access by Type
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/agent_execution_data.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.agent_execution_data.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 8f56000f83a263513daffc8220cb74e005e6476465b7ab29d42ba1b73c65c76d
description: Learn how Agentforce Employee, Lead Nurturing (Sales), and Service agents run actions and how data access is controlled for each agent type.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Agent Execution Context and Data Access by Type

Learn how Agentforce Employee, Lead Nurturing (Sales), and Service agents run actions and how data access is controlled for each agent type.

## Execution Context by Agent Type

Execution context varies by agent type, channel, and whether [credential-based user verification](https://help.salesforce.com/s/articleView?id=service.miaw_credential_user_verification_setup.htm&type=5&language=en_US) is enabled (available for agents connected to Enhanced Chat v1 and deployed to Experience Cloud sites only).

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col>
          <col>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d152945e52">&nbsp;</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d152945e54"><a href="https://help.salesforce.com/s/articleView?id=ai.agent_execution_data.htm&amp;release=264.0.0&amp;type=5">Employee Agents</a></th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d152945e59"><a href="https://help.salesforce.com/s/articleView?id=ai.agent_execution_data.htm&amp;release=264.0.0&amp;type=5">Lead
                Nurturing Agents</a></th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d152945e64"><a href="https://help.salesforce.com/s/articleView?id=ai.agent_execution_data.htm&amp;release=264.0.0&amp;type=5">Service Agents</a></th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e52 ">Primary Use Case</td>

            <td data-label="Employee Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e54 ">Internal employees</td>

            <td data-label="Lead Nurturing Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e59 ">Automated outreach to external leads, prospects, and
              customers</td>

            <td data-label="Service Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e64 ">External customers and partners</td>

          </tr>
          <tr class="">
            <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e52 ">Supported Channels</td>

            <td data-label="Employee Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e54 ">Lightning Experience, the Salesforce mobile app, Slack, and
              Enhanced Web Chat v1 (Experience Cloud sites only)</td>

            <td data-label="Lead Nurturing Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e59 ">Outbound email</td>

            <td data-label="Service Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e64 ">Enhanced messaging channels, including Enhanced Chat v1 and
              Enhanced Chat v2</td>

          </tr>
          <tr class="">
            <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e52 ">Runs As</td>

            <td data-label="Employee Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e54 ">Logged-in end user</td>

            <td data-label="Lead Nurturing Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e59 ">Agent User (EinsteinSDRAgent User)</td>

            <td data-label="Service Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e64 ">
              <p>Without credential-based user verification: Agent User
                (EinsteinServiceAgent User) </p>
              <p style="margin-bottom:0;">With credential-based user verification: Logged-in site user
                (Enhanced Chat v1 and Experience Cloud sites only)</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e52 ">Data Access Governed By</td>

            <td data-label="Employee Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e54 ">End user’s profile, permissions, field-level security, and
              sharing rules</td>

            <td data-label="Lead Nurturing Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e59 ">Agent user profile, permissions, field-level security, and
              sharing rules</td>

            <td data-label="Service Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e64 ">
              <p>Without credential-based user verification: Agent user profile,
                permissions, field-level security, and sharing rules</p>
              <p style="margin-bottom:0;">With credential-based user verification: Logged-in site user’s
                profile, permissions, field-level security, and sharing rules
                (Enhanced Chat v1 and Experience Cloud sites only)</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e52 ">User Identified By</td>

            <td data-label="Employee Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e54 ">Logged-in end user</td>

            <td data-label="Lead Nurturing Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e59 ">Lead or contact context</td>

            <td data-label="Service Agents" class="slds-cell-wrap" style="vertical-align:top;" headers="d152945e64 ">
              <p>Without credential-based user verification: Context variables
                (for example, <code>MessagingSesson.ContactId</code>).
                Context variables tell the agent who the user is but don’t
                control data access.</p>
              <p style="margin-bottom:0;">With credential-based user verification: Logged-in site user
                (Enhanced Chat v1 and Experience Cloud sites only)</p>
            </td>

          </tr>
        </tbody>
      </table>

## Flow Run Context and Agent Execution

Flows run in user context or system context. When an agent action runs a flow, both the flow’s run context and the agent’s execution context apply. [Learn more about flow run context.](https://help.salesforce.com/s/articleView?id=platform.flow_distribute_context.htm&type=5&language=en_US)

   
| Flow Run Context | Common Use | Object and Field Access | Sharing Rules |
| --- | --- | --- | --- |
| User | Standard interactive flows | Governed by running user’s permissions and field-level access | Running user’s sharing rules |
| System context with sharing | Elevated access that respects data visibility | All objects and fields | Running user’s sharing rules |
| System context without sharing | Background automation that requires full access | All objects and fields | N/A |

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/images/icon_note.png)

Note When a Service agent runs in the agent user context (in other words, without credential-based user verification enabled), the running user of the flow is the agent user (EinsteinServiceAgent User), not the customer or end user.

## Employee Agent Execution Context Details

Agentforce Employee agents are intended for internal users accessing the system via Lightning Experience, the Salesforce mobile app, an Experience Cloud portal, or Slack—not unauthenticated external customers. Employee agents operate under the logged-in user's execution context. The user's profile, permission sets, and sharing rules/role determine the agent's actions and responses. It’s not necessary to explicitly scope queries and actions to user-specific data. User access to Employee agents is managed through permission sets or profiles.

[Get started with an Agentforce Employee agent.](https://help.salesforce.com/s/articleView?id=ai.agent_employee_agent_setup.htm&release=264.0.0&type=5 "Agentforce Employee agents help employees find information, complete tasks, and access personalized support across channels. Use Agentforce Employee agent templates to build agents that serve specific departmental needs, support role-based access, and scale securely across the organization. Unlike other agent templates, Employee agents are designed for internal employees, run in the logged-in user context, and you can assign each Employee agent to specific profiles or users.")

## Lead Nurturing Agent Execution Context Details

Agentforce Lead Nurturing agents are intended for top-of-funnel autonomous lead engagement. They can operate 24/7, sending customized emails, booking meetings, and answering prospect questions. Lead Nurturing agents run as a dedicated EinsteinSDRAgent User, which is created and assigned [system-level permissions](https://help.salesforce.com/s/articleView?id=sales.sales_agent_sdr_permissions.htm&type=5&language=en_US) during agent setup. Prospects are assigned to the agent by assignment rules, automated actions, or individual sales users.

[Get started with an Agentforce Lead Nurturing agent.](https://help.salesforce.com/s/articleView?id=sales.einstein_sdr_setup.htm&type=5&language=en_US)

## Service Agent Execution Context Details

Agentforce Service agents are intended for customer-facing use cases and connect to enhanced Messaging channels, which support authenticated and unauthenticated external users. The agent’s data access and execution context depend on the channel and whether credential-based user verification is enabled.

- Generally, the agent’s data access and execution context is determined by [an agent user](https://help.salesforce.com/s/articleView?id=ai.agent_user.htm&release=264.0.0&type=5 "Learn how Agentforce Service agents control data access. Set up an agent user for your Agentforce Service agent and assign permissions, so your agent has everything it needs to do its job.")—a unique user record for the agent with all of the permissions that the agent needs to do its job. The agent runs in the context of the agent user and respects the agent user’s profile, permissions, field-level security, and sharing rules.
- If you’re using Enhanced Chat v1 or Enhanced Chat v2 to deploy a Service agent to an Experience Cloud site, you can turn on [credential-based user verification](https://help.salesforce.com/s/articleView?id=service.miaw_credential_user_verification_setup.htm&type=5&language=en_US). When credential-based user verification is enabled, the agent runs in the context of the logged-in site user and respects the user’s profile, permissions, field-level security, and sharing rules.

When a Service agent runs in the context of the agent user, [context variables](https://help.salesforce.com/s/articleView?id=ai.agent_builder_variables.htm&release=264.0.0&type=5 "To improve security and ensure consistent agent behavior, use variables throughout your agent’s reasoning and interactions, such as in filters, instructions, and logical expressions.") (for example, `MessagingSesson.ContactId`) are used to pass the customer’s identity to the agent, but they don’t control data access. Without additional configuration, the customer has access to all of the records that the agent user has access to. You must proactively limit data access.

- **Pass verified customer IDs into the custom VerifiedCustomerId variable.**
    
    If you use the standard [Customer Verification or Service Customer Verification](https://help.salesforce.com/s/articleView?id=ai.service_agentforce_customer_verification.htm&release=264.0.0&type=5 "Before an Agentforce Service agent takes a private action on a user’s behalf, Salesforce recommends verifying the identity of the person the agent is interacting with. To verify the identity of an unverified user in an agent session, configure your agent to use the Customer Verification subagent or the Service Customer Verification subagent and limit access to subagents and actions that you specify. You can require different levels of verification for different subagents and actions, based on your business’s security requirements.") subagents for user verification in your agent, the actions are configured to store the user’s ID in the `VerifiedCustomerId` variable after their identity is successfully verified. If you don’t, you can create a custom agent action and an Apex class or flow to pass the verified ID to your agent and store it in the `VerifiedCustomerId` variable.
- **Explicitly scope Apex classes and flows called by standard and custom agent actions to customer records (`WHERE ContactId = VerifiedCustomerId`).**
    
    Some standard actions support customer verification out of the box—for example, the [Get Cases for Verified Contact](https://help.salesforce.com/s/articleView?id=ai.copilot_action_get_cases_verified_contact.htm&release=264.0.0&type=5 "Returns a list of cases related to a given verified contact ID.") action calls a flow that looks up the customer’s contact ID, checks it against the `VerifiedCustomerId` variable, and uses the verified customer ID to scope its queries. However, you should carefully test and customize each action to meet your security needs.
- **Create filters (`VerifiedCustomerId is not None`) to restrict access to subagents and actions to verified customers.**

[Get started with an Agentforce Service agent.](https://help.salesforce.com/s/articleView?id=ai.service_agent_setup.htm&release=264.0.0&type=5 "Agentforce Service agents intelligently support your customers by connecting to messaging and other channels and escalating to reps when necessary. Use the default Agentforce Service Agent template to create an agent designed to resolve common support cases and requests. Or select from more specialized templates to fit your use case.")

#### See Also

- [Agent Types and Considerations](https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&release=264.0.0&type=5 "Learn about agent types and default templates for specific clouds and common use cases.")