Stacksona for Salesforce Agentforce
Gate record mutations and customer-impacting actions by calling Stacksona from Apex, Flow, or an external service.
Gate record mutations, customer-impacting actions, and workflow changes with Stacksona decisions. This page shows the recommended integration pattern using HTTP, a wrapper, or a small bridge service.
Start with this decision step
Every recipe should create a Stacksona decision before the platform executes the risky action.
1. Agent prepares a risky action.
2. Platform calls Stacksona with action details.
3. If decision is allow or approved, execute the action.
4. If decision is pending_review, wait, poll, or resume through callback.
5. If decision is reject or rejected, do not execute.Recommended pattern
| Step | Description |
|---|---|
| Before mutation | Call Stacksona before update, delete, lead conversion, account change, case reply, or external action. |
| Record context | Include record ID, object type, field diffs, owner, customer tier, and reason. |
| Enforcement | Do not perform the mutation unless the decision is allow or approved. Validate tokens for high-risk updates. |
Example
// Conceptual Apex shape. Store keys securely, not in source.
HttpRequest req = new HttpRequest();
req.setEndpoint(System.getenv('STACKSONA_GATE_URL') + '/api/agent/tasks/' + taskId + '/requests');
req.setMethod('POST');
req.setHeader('Authorization', 'Bearer ' + apiKey);
req.setHeader('Content-Type', 'application/json');
req.setBody(JSON.serialize(new Map<String, Object>{
'workflow_name' => 'Salesforce Agentforce',
'task_label' => 'Account update approval',
'tool_name' => 'update_account',
'subject' => 'Agent wants to update account fields',
'risk_level' => 'medium',
'payload' => proposedChanges
}));
HttpResponse res = new Http().send(req);Decision handling
| Status | Workflow behavior |
|---|---|
allow | Continue immediately. |
reject | Stop the action before execution. |
pending_review | Pause, poll, or wait for callback. Continue only after approved. |
approved | Execute the action. Validate token first when signed approval is required. |
rejected | Do not execute. Route to fallback, manual task, or safe response. |
Integration FAQ
Can I use Stacksona with Salesforce Agentforce today?
Yes. Use the documented native package when one exists. Otherwise, use the REST API, HTTP module, webhook action, or a small Node sidecar with @stacksona/sdk.
Where should Stacksona sit in a Salesforce Agentforce workflow?
Place Stacksona immediately before the action that sends, updates, deletes, refunds, posts, deploys, or calls a production API.
What statuses should my workflow allow?
Execute the gated action only on allow or approved. Stop, retry, notify, or route to fallback for every other state.