Picture a government agency receiving a FOIA request and having an AI agent assist with processing it. The request is retrieved, the records are searched, the necessary actions are carried out, and the response is prepared, all within minutes.
But the question that matters just as much as getting the work done is: Can the agency show exactly what happened?
It is not sufficient for AI agents to merely carry out a task when they are involved in government procedures; the agencies must know which agent dealt with the request, what actions were carried out, what information was accessed, when each action took place, and whether the process can afterwards be reviewed.
That is where an Agentforce audit trail for FOIA compliance becomes important. By combining Agentforce Session Tracing with a custom audit log and Salesforce automation, agencies can create a clear, traceable record of AI-driven activity.
This blog shows how to develop that approach in Salesforce, starting with the data model and agent configuration and going on to audit logging, session tracing, and automated FOIA exports.
Build an Agentforce-based FOIA Compliance solution that records AI agent activities, maintains an auditable history of agent interactions, and supports automated FOIA compliance reporting and export. This approach makes FOIA compliance with Salesforce fully traceable and audit-ready.
The solution will demonstrate how Agentforce audit trail activities can be traced from the initial user request through agent/subagent execution, actions, audit logging, and final FOIA export.
This FOIA compliance solution for government agencies using AI consists of the following components:
The FOIA Request object represents an individual FOIA request.
| Field | Purpose |
|---|---|
| Request Number | Unique FOIA request identifier |
| Requester | Person who submitted the request |
| Request Date | Date request was received |
| Status | Current FOIA request status |
| Due Date | FOIA response deadline |
| Agent Session ID | Links request to Agentforce session |
| Export Status | Tracks export preparation |
| Export Date | Date/time export was generated |
| Compliance Status | Compliance review status |
The Agent Audit Log stores business-level information about Agentforce activity.
| Field | Purpose |
|---|---|
| Session ID | Identifies the Agentforce session |
| Agent Name | Agent that processed the request |
| Subagent Name | FOIA subagent used |
| User | User who initiated the request |
| Request | User's request |
| Action Name | Agent action executed |
| Action Status | Success/Failed |
| Action Input | Input provided to the action |
| Action Output | Result returned by the action |
| Error Message | Error information |
| Timestamp | Date/time of execution |
| Related Record | Salesforce record involved |
| FOIA Request | Related FOIA request |
Agent Name:
FOIA Compliance Agent
The main agent receives user requests and routes Agentforce FOIA compliance requests to the appropriate subagent.
Purpose
The FOIA Compliance Subagent handles:
The subagent should:
Three actions will be created for the demonstration.
Input
Processing
Search FOIA_Request__c using the request number.
Output
Example
User:
Find FOIA-1001
Agent:
Get FOIA Request
Result:
FOIA-1001
Status: In Progress
Input
Processing
Retrieve related Agent_Audit_Log__c records.
Output
Example
FOIA-1001
↓
Agent Audit Logs
├── Get FOIA Request → Success
├── Search Records → Success
└── Prepare Export → Success
Input
Processing
Output
Native Agentforce Session Tracing will be enabled to capture agent execution information.
The session trace provides visibility into the Agentforce interaction and execution lifecycle.
The demonstration will show:
The native session trace provides the technical execution trail, while the custom Agent_Audit_Log__c provides the business-specific FOIA compliance audit trail.
An Autolaunched Flow will be created for FOIA export preparation.
Input
FOIA_Request__c Id
Flow Steps
Flow
User Request
Get FOIA record of Request Number: FOIA-1001.
Agent Execution
Audit Trail
The system records:
Session ID: SESSION-DEMO-001
Action:
Get FOIA Request
Status: Success
Action:
Search FOIA Records
Status: Success
Export Request
User asks:
Prepare the FOIA export for FOIA-1001.
Agent executes:
As AI becomes part of government workflows, agencies must build transparency and traceability into the process, not add them later. An Agentforce audit trail for FOIA compliance gives agencies a structured way to understand, review, and export AI-driven activity.
Agencies will be able to develop a more accountable and audit-ready method of adopting AI by using Agentforce Session Tracing, custom audit logs, Salesforce Flow, and FOIA request records.
If your organization is exploring how to make AI workflows more transparent and compliant.