Someone proposes an AI agent that answers questions from Salesforce data. The first technical question is simple to say and rarely answered: what can that agent actually read?

I wrote today, in Spanish, about companies buying agents before they know who owns their data. This is the technical side of one of those questions. An agent that talks to Salesforce does it as a user, usually an integration user. What it can read is what that user's profile and permission sets allow. So the first step is to list that, not to guess it.

Step 1: which permission sets does the user have?

SELECT PermissionSet.Label, PermissionSet.IsOwnedByProfile, PermissionSet.Profile.Name FROM PermissionSetAssignment WHERE AssigneeId = '005XXXXXXXXXXXXXXX' 

The profile shows up here as a permission set owned by the profile. The user's access is the sum of all the rows.

Step 2: object-level access

SELECT SobjectType, PermissionsRead, PermissionsCreate, PermissionsEdit, PermissionsDelete, PermissionsViewAllRecords, PermissionsModifyAllRecords FROM ObjectPermissions WHERE ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = '005XXXXXXXXXXXXXXX') AND SobjectType IN ('Account', 'Contact', 'Opportunity') 

Look at PermissionsViewAllRecords and PermissionsModifyAllRecords. If either is true for an object, record sharing no longer limits the agent on that object.

Step 3: field-level access

SELECT SobjectType, Field, PermissionsRead, PermissionsEdit FROM FieldPermissions WHERE SobjectType = 'Contact' AND PermissionsRead = true AND ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = '005XXXXXXXXXXXXXXX') 

Every field in the result is a field the agent can read. Check it against what you would not hand to a new employee: personal identifiers, salary data, anything under a regulation.

Step 4: the two big switches

SELECT Label, PermissionsViewAllData, PermissionsModifyAllData FROM PermissionSet WHERE Id IN (SELECT PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = '005XXXXXXXXXXXXXXX') 

If PermissionsViewAllData is true on any row, the honest answer to "what can the agent read?" is "everything". An integration user that was cloned from an admin profile to make a demo work is a common way to end up here.

What this does not cover

  • Field permissions and object permissions are only half of access. Record visibility also depends on sharing: org-wide defaults, role hierarchy, sharing rules.
  • If the agent runs Apex that you control, WITH USER_MODE in SOQL, or Database.query(query, AccessLevel.USER_MODE), enforces the running user's object and field permissions. Code in system mode ignores them.
  • None of this tells you who validates the agent's answers. That is a process question for the business, and it needs a named person.

Checklist for the integration user

  1. Create a dedicated user for the agent. Do not reuse a person's login.
  2. Give it a minimal permission set for the objects and fields the use case needs, read-only to start.
  3. Run the four queries above and save the output with the project documents.
  4. Re-run them after every permission change.

At Vantegrate, the AI agents company I cofounded with Francisco Morales, we start from this kind of review. At EGA Futura we build a native ERP on Salesforce for mid-sized companies. The longer piece on data, owners and what AI amplifies, in Spanish, is on EGA Futura Discover.