Salesforce architecture is entering its biggest shift since the move from Classic to Lightning. We’re moving past isolated, reactive chatbots, often little more than search tools, and into the era of the Agentic Swarm.
In this model, architecture is built on Agent-to-Agent (A2A) collaboration, powered by the Atlas Reasoning Engine. With Agent Builder and Data 360 (formerly Data Cloud), organizations can deploy a hierarchy of agents: a central Orchestrator that interprets intent and delegates work to specialized agents across industries.
Using collaboration patterns like Swarm for parallel work and Sequential for handoffs, enterprises can automate complex, cross-domain workflows with unprecedented autonomy. All of this operates within Einstein Trust Layer guardrails and Human-in-the-Loop controls, ensuring intelligence scales without compromising compliance or ethics.
The “Generalist-Specialist” Model
The modern Salesforce stack treats AI agents as first-class citizens of the metadata layer. To understand A2A, we must first look at the two roles an agent can play.
1. The Orchestrator (The Planner)
The Orchestrator is a generalist agent configured via GenAiPlanner metadata. It does not possess deep domain knowledge; instead, it possesses “Reasoning Knowledge.” When a user submits a prompt like “Prepare a renewal quote for Acme Corp, but check if their recent support issues impact our discount policy,” the Orchestrator performs a semantic breakdown.
It identifies that it needs:
- Service Data (Support cases)
- Sales Data (Renewal opportunity)
- Finance Logic (Discounting thresholds)
The Orchestrator then looks for Specialists that have registered these capabilities.
2. Specialist Agents (The Domain Experts)
Specialists are narrow-focus Function Agents. They are grounded in Data 360 using Retrieval-Augmented Generation (RAG). A Specialist does not see the whole enterprise; it sees its specific Data Model Objects (DMOs). For example, a Billing_Specialist might only have access to invoice records and payment gateways.
By using Zero Copy technology, these agents reason over live data from external lakes (Snowflake, AWS) without data duplication. This ensures the handoff between the Orchestrator and the Specialist is grounded in a single source of truth.
Technical Collaboration Patterns
Effective A2A design requires the architect to choose a collaboration pattern that matches the business logic.
The Swarm Pattern (Parallel Orchestration)
The Swarm pattern is used when a request requires simultaneous validation or data retrieval from multiple domains to reach a conclusion.
Use Case: Comprehensive Risk Assessment
When a new high-value contract is being drafted, the Orchestrator swarms the task:
- The
Legal_Agentreviews contract clauses. - The
Credit_Agentchecks the customer’s latest payment history in Data 360. - The
Supply_Chain_Agentchecks inventory availability for the quoted items.

Apex Implementation: The Artifact Collector
In a Swarm, Specialists need a way to report back findings. We use a service class to collect these artifacts into a shared session context.
/**
* @description Invocable action for Specialist Agents to report findings to a Swarm.
* Pattern: Swarm (Parallel)
*/
public with sharing class SwarmArtifactService {
public class SwarmInput {
@InvocableVariable(label='Orchestration Session ID' required=true)
public String sessionId,
@InvocableVariable(label='Agent Name' required=true)
public String agentName,
@InvocableVariable(label='Finding Payload (JSON)' required=true)
public String payload,
}
@InvocableMethod(label='Post Swarm Artifact' description='Specialists use this to report domain data back to the Orchestrator.')
public static void postArtifact(List<SwarmInput> inputs) {
List<Agent_Artifact__c> artifacts = new List<Agent_Artifact__c>(),
for (SwarmInput input : inputs) {
artifacts.add(new Agent_Artifact__c(
Session_ID__c = input.sessionId,
Source_Agent__c = input.agentName,
Data_Payload__c = input.payload,
Created_Date_Time__c = DateTime.now()
)),
}
insert artifacts,
}
}
The Sequential Pattern (Linear Handoffs)
The Sequential Pattern mimics an assembly line. The output of the Pricing_Agent is the mandatory input for the Approval_Agent.
Use Case: Automated Order Provisioning
- Agent A (Sales): Finalizes the product list.
- Agent B (Finance): Applies taxes and regional discounts.
- Agent C (Provisioning): Triggers the ERP integration to ship the goods.

Apex Implementation: The Sequence Validator
To prevent “hallucination propagation,” we use Apex guardrails to validate the data being passed between agents.
/**
* @description Logic-based guardrail for Sequential handoffs.
* Pattern: Sequential (Linear)
*/
public with sharing class SequenceGuardrail {
public class ValidationRequest {
@InvocableVariable(label='Source Agent' required=true)
public String sourceAgent,
@InvocableVariable(label='Proposed Discount')
public Decimal discountValue,
}
public class ValidationResult {
@InvocableVariable(label='Status')
public String status, // 'Approved', 'Rejected', 'Escalated'
@InvocableVariable(label='Next Agent Override')
public String nextAgent,
}
@InvocableMethod(label='Validate Sequential Handoff' description='Ensures data integrity between agent transitions.')
public static List<ValidationResult> validate(List<ValidationRequest> reqs) {
List<ValidationResult> results = new List<ValidationResult>(),
for (ValidationRequest req : reqs) {
ValidationResult res = new ValidationResult(),
// Hard Rule: If discount > 30%, reroute from 'Standard_Processor' to 'VP_Agent'
if (req.sourceAgent == 'Pricing_Agent' && req.discountValue > 30) {
res.status = 'Escalated',
res.nextAgent = 'VP_Finance_Agent',
} else {
res.status = 'Approved',
res.nextAgent = 'Order_Provisioning_Agent',
}
results.add(res),
}
return results,
}
}
Managing Failure Modes
In A2A systems, we must account for specific agentic risks that can impact system stability.
1. The Token Storm (Recursive Loops)
If two agents have overlapping scopes (e.g., both think they are responsible for “shipping”), they may pass the task back and forth indefinitely, consuming API limits and tokens.
Mitigation: Implement a Max Hop Count metadata attribute on the Orchestrator to terminate any session exceeding five agent transfers.
2. Hallucination Propagation
In a Sequential Pattern, if the first agent incorrectly identifies a customer as “platinum,” every subsequent agent will apply incorrect logic based on that false premise.
Mitigation: Grounding Specialists in Data 360 DMOs rather than allowing them to pass unstructured text strings. Always pass the RecordId as the primary key between agents, never just the Name or Status.
3. Agent Deadlock
This occurs when Agent A is waiting for data that only Agent B can provide, but Agent B is waiting for validation from Agent A.
Mitigation: Orchestrator-led timeouts. If a Specialist does not return an observation within a set window, the Orchestrator must trigger a human-in-the-loop escalation.
Compliance, Trust, and HITL
As agents gain the ability to call other agents, the risk of recursive loops or unauthorized data exposure increases. Salesforce architects must implement a multi-layered governance strategy.
1. The Einstein Trust Layer
Every A2A call is intercepted by the Trust Layer. This layer performs:
- PII Masking: Ensuring sensitive customer data isn’t sent to the LLM.
- Audit Logging: Recording the “Reasoning Path” so architects can trace why the Orchestrator chose a specific Specialist.
2. Semantic Guardrails
Within Agent Builder, you define “Instructions.” However, for architects, instructions are not enough. We use GenAiPlanner rules to enforce logic. For example: “If the User Persona is ‘Junior Sales’, do not allow the Orchestrator to call the ‘Deep_Discount_Agent’.”
3. Human-in-the-Loop (HITL)
High-stakes actions (e.g. deleting data, approving million-dollar refunds) must trigger a SUSPEND state.
Apex Implementation: The HITL Bridge
This code pauses the agent and creates a task for a human supervisor, utilizing Platform Events for real-time notification.
/**
* @description Bridges the AI Swarm with Human oversight.
*/
public with sharing class HumanInTheLoopService {
@InvocableMethod(label='Request Human Approval' description='Pauses agent flow for manual sign-off.')
public static void requestApproval(List<ApprovalRequest> requests) {
for (ApprovalRequest req : requests) {
// Create a record requiring human action
Agent_Approval_Task__c task = new Agent_Approval_Task__c(
Agent_Context__c = req.context,
Proposed_Action__c = req.action,
Status__c = 'Pending'
),
insert task,
// Notify via Platform Event (consumable by Slack or Flow)
Agent_Alert__e event = new Agent_Alert__e(
Task_ID__c = task.Id,
Message__c = 'Urgent: Agent Swarm requires approval for ' + req.action
),
EventBus.publish(event),
}
}
public class ApprovalRequest {
@InvocableVariable public String action,
@InvocableVariable public String context,
}
}
Designing for Scale: Best Practices for Architects
- Atomic Specialists: Keep your Specialist agents narrow. A
Shipping_Agentshould not try to solve billing problems. This reduces the token cost and increases reasoning accuracy. - State Management: Always use a
sessionIdorcorrelationIdin your custom Apex objects. In an A2A environment, multiple agents may be writing to the same record simultaneously, implementing robust locking mechanisms. - Monitor the Token Budget: Orchestrators that loop through too many Specialists can become expensive. Implement a Turn Limit guardrail (e.g. no more than five agent handoffs per request).
- Zero Copy Over ETL: Whenever possible, use Data 360’s Zero Copy to access external data. Agents perform significantly better when they have a direct window into the data lake rather than waiting for scheduled ETL syncs.
Final Thoughts: The Symphony of Agents
The transition to Agent-to-Agent architecture represents the ultimate maturation of the Salesforce platform. We are no longer building individual tools – we are conducting a digital symphony.
From a leadership perspective, this is about operational scale. From an architectural perspective, it is about maintaining a Single Source of Truth while enabling decentralized execution. The successful architect in this era must focus on the interfaces, the handoffs, the guardrails, and the data grounding.
By mastering the Swarm and Sequential Patterns and enforcing strict governance through Apex and the Einstein Trust Layer, you can create an autonomous enterprise that is not only faster and more efficient but also more reliable and compliant than any manual process.
The future is not one bot that does everything – it is a swarm of specialists working in perfect, orchestrated harmony.
Resources
- Salesforce Architects: Enterprise Agentic Design Patterns
- Developer Guide: GenAiPlanner and Function Metadata
- Salesforce Engineering: Building Trust into A2A Protocols
- Data Cloud: Zero Copy Architecture Deep Dive
- Data Cloud’s Zero Copy
- Retrieval-Augmented Generation (RAG)
- Einstein Trust Layer