Sub topic 1
How Agentforce Limits What an Agent Can Do
Prerequisites
Assume you know Salesforce users, permission sets, objects, fields, and record sharing. You should also know that an Agentforce agent uses topics and actions to complete tasks.
How Agentforce Limits What an Agent Can Do
An agent's capabilities come from several controls working together:
- Run-as context determines whose permissions the agent uses.
- Permission sets grant object, field, and action access.
- Sharing determines which records the agent can access.
- Topics and instructions restrict the requests it should handle.
- Actions define the operations it can perform.
These controls are separate. A topic instruction cannot safely replace a missing permission, and a permission does not require the agent to use that access.
Agent Types and Who the Agent Runs As
The key distinction is whether the agent runs as a dedicated agent user or as the logged-in user.
| Run-as model | Access comes from | Typical use |
|---|---|---|
| Dedicated agent user | The agent user's permissions and sharing | Customer-facing service automation |
| Logged-in user | The current user's permissions and sharing | Employee assistance with user-specific data |
A dedicated agent has consistent access, which makes review and testing easier. A logged-in-user agent naturally limits results to each user's access, but its behavior can vary between users.
> callout note > Treat run-as context as a security boundary. Do not assume that an instruction alone prevents access to data. >```
The Agent User
An agent user is a Salesforce user record that represents the agent. Administrators assign permission sets to this user, configure its access, and review its activity. The agent should receive only the permissions needed for its topics and actions.
For example, an order-status agent may need read access to Order.Status, but it should not receive edit, delete, or “view all” permissions.
Applying Least Privilege to an Agent
Least privilege means granting only the minimum access required for a task.
Start with the agent's supported tasks. Map each task to its objects, fields, records, and actions. Grant read access before write access. Avoid broad permissions such as “Modify All Data” or “View All Records.” Test both allowed and denied cases, including records belonging to another customer.
Exercise
An order-status agent can read orders but must never change them. What permission model should you choose?
Show answer
Use a dedicated agent user with a permission set that grants read access only to the required Order fields. Do not grant create, edit, delete, or view-all permissions.