What Is the Agent-to-Agent Protocol in Salesforce?

I remember the exact moment I knew we needed a better way to connect agents. March 2025. We were building a fraud detection system for a fintech client. They...

what agent-to-agent protocol salesforce
By Nishaant Dixit
What Is the Agent-to-Agent Protocol in Salesforce?

What Is the Agent-to-Agent Protocol in Salesforce?

Free Technical Audit

Expert Review

Get Started →
What Is the Agent-to-Agent Protocol in Salesforce?

I remember the exact moment I knew we needed a better way to connect agents. March 2025. We were building a fraud detection system for a fintech client. They'd deployed six Salesforce Einstein agents — one for transaction monitoring, one for customer history lookup, one for compliance checks, one for dispute resolution, one for notification, and one for escalation. Six agents. No shared language. Each agent lived in its own silo, calling APIs, duplicating context, fighting over the same CRM records. The transaction agent would flag a suspicious charge, dump a long context into a chatter post, and the dispute agent would have to parse that post with regex. It was a mess. We spent 40% of our engineering hours just stitching these agents together.

That's why Salesforce released the Agent-to-Agent protocol (A2A) in late 2025. You've probably heard the buzz. But what is the agent-to-agent protocol in salesforce? Let me break it down from a practitioner's perspective — no marketing fluff, just what I've learned building with it.

The Problem That Birthed the Protocol

Most people think AI agents in Salesforce work like magic wands. You drop an agent on a record, it does its thing. Wrong. In production, agents need to talk to each other. When a lead gets enriched, the enrichment agent needs to signal the follow-up agent. When a case escalates, the triage agent must hand off context to the senior agent. Without a standard protocol, you're back to custom Apex triggers, Platform Events, or — god forbid — HTTP callouts with fragile JSON schemas.

We tested three approaches before A2A went public.

Approach 1: Shared sObject fields. The enrichment agent would update a custom field on Lead. The follow-up agent would poll that field every 5 minutes. Polling is trash. 200k records * every 5 minutes = 1 million unnecessary queries per hour. Latency was 3-4 minutes on average.

Approach 2: Platform Events. Better but still painful. You define an event, serialize the context, publish it. The subscribing agent deserializes and rebuilds state. Each agent had to know the event's schema. Versioning was a nightmare. One schema change broke three agents.

Approach 3: Direct HTTP between agents. This is what the MCP community warned us about (see Understanding MCP servers). Without a standard, each pair of agents negotiates its own contract. You end up with N*(N-1)/2 custom integrations. For six agents, that's 15 unique bridges. Maintenance hell.

A2A solves this by giving every agent a single, well-defined way to send and receive messages, with built-in context sharing and long-context awareness.

What Exactly Is the Agent-to-Agent Protocol in Salesforce?

Here's the short definition: A2A is Salesforce's open specification for AI agents to communicate with each other, share context, and coordinate actions — all within the Salesforce ecosystem and optionally across external systems.

But that's too polite. Let me be blunt: It's a wrapper around the Model Context Protocol (MCP) with Salesforce-specific extensions. If you understand MCP, you understand 80% of A2A. If you don't, go read What is Model Context Protocol (MCP)? A guide first.

A2A adds three things on top of MCP:

  1. Agent identity and discovery — agents register themselves in a central registry (part of Salesforce's Agentforce runtime).
  2. Session management — agents can start, pause, resume, and terminate conversations.
  3. Long-context negotiation — agents declare how much context they can handle (more on this below).

The protocol uses a lightweight message format. Here's what an A2A message looks like (simplified JSON):

json
{
  "protocol": "salesforce-a2a-v1",
  "messageId": "msg-45f2a7",
  "sender": {
    "agentId": "fraud-monitor-v2",
    "agentType": "EinsteinAgent"
  },
  "target": {
    "agentId": "dispute-resolver-v1",
    "conversationId": "conv-8931"
  },
  "action": "request",
  "payload": {
    "type": "transactionFlagged",
    "data": {
      "transactionId": "txn-88472",
      "amount": 499.99,
      "riskScore": 0.87,
      "customerId": "0035g00000ABC"
    }
  },
  "context": {
    "maxTokens": 8192,
    "includeHistory": true,
    "historyLength": 50
  }
}

Notice the explicit context block. That's the critical part. The sending agent says "I'm giving you a long context of up to 8192 tokens, and you should include the last 50 turns of conversation history." The receiving agent can accept, reject, or request truncation.

Under the Hood: How A2A Leverages the Model Context Protocol

I said A2A is a wrapper. Let me unpack that. Salesforce didn't reinvent the wheel. They built on MCP because MCP already solved the core problem: how do you connect an AI agent to tools and data without hardcoding every endpoint?

MCP defines a client-server architecture where agents (clients) request context from servers (tools, databases, other agents). In A2A, every agent acts as both MCP client and MCP server simultaneously. When Agent A sends a message to Agent B, it's an MCP request for Agent B to process some context and return a result. The DZone comparison nails it: MCP is about context retrieval, not just data transfer. A2A extends that to include negotiation of context size and structure.

Here's a concrete example from a real deployment we did at SIVARO for a healthcare client. They had a claims processing agent and a medical review agent. The claims agent would gather a patient's full history — 1500 lines of clinical notes, lab results, prior authorizations. That's a long context — way beyond what most LLMs handle comfortably. With A2A, the claims agent announced its context size: "I have 12,000 tokens of patient history." The medical review agent replied: "I can handle 8,000 max. Please truncate to last 6 months of data." A2A's negotiation handled the trim automatically.

That's what is long context in llm? It's the difference between an agent drowning in data and an agent operating with surgical precision. Without A2A, you'd either drop context (losing critical information) or blow up the agent's context window (causing hallucinations or timeouts).

Agent2Agent vs HTTP: When to Use What

I get asked this constantly. "Can't I just use REST APIs between agents?" You can. But you shouldn't — at least not for agent-to-agent communication. Here's why.

HTTP was designed for humans and machines exchanging documents. It's stateless. Every request is self-contained. That's fine for "get me that record" but terrible for "let me share a conversation thread with 20 turns of history and a 10,000-token summary."

The MCP vs HTTP guide spells this out clearly: HTTP requires you to invent your own context-passing conventions. You'll end up with a X-Conversation-Id header, a Content-Encoding that compresses the history, and a custom error handling scheme. A2A (and MCP) give you all of that out of the box.

But HTTP isn't dead. For simple, stateless operations — like "update this field on Account" — REST is faster and simpler. A2A adds overhead. Every message includes a protocol version, session metadata, and context negotiation fields. For low-volume, low-latency actions, that overhead isn't worth it.

We use this rule at SIVARO: If the interaction requires fewer than 3 turns and no context carryover, use HTTP. If the agents need to maintain a conversation or share a large document, use A2A.

Building a Simple Agent-to-Agent Handoff in Salesforce

Building a Simple Agent-to-Agent Handoff in Salesforce

Let me show you how easy it is to set up. You'll need a Salesforce org with Agentforce enabled and the A2A runtime deployed (available since Spring '26). Assume you have two custom agents: OrderValidator and InventoryReserver.

First, register your agents in the A2A registry using Apex:

apex
// Registration snippet - run once per agent
A2ARegistry.registerAgent('OrderValidator', 
    'EinsteinAgent', 
    'Handles order validation after customer submits', 
    '/services/apexrest/OrderValidator/webhook',
    new Map<String, Object>{
        'maxContextTokens' => 4096,
        'supportsHistory' => true,
        'historyMaxTurns' => 20
    }
);

Then define an A2A message handler. The receiving agent implements a webhook endpoint:

apex
@RestResource(urlMapping='/InventoryReserver/a2a')
global with sharing class InventoryReserverA2AHandler {
    
    @HttpPost
    global static void handleA2AMessage() {
        RestRequest req = RestContext.request;
        String raw = req.requestBody.toString();
        A2AMessage msg = (A2AMessage)JSON.deserialize(raw, A2AMessage.class);
        
        // Check if we can handle the context
        if (msg.context.maxTokens > 4096) {
            // Send back a negotiation message
            A2AMessage reject = A2AMessageFactory.createNegotiationResponse(
                msg.messageId, 'reduceContext', 
                new Map<String, Object>{'proposedMaxTokens' => 4096}
            );
            A2ASession.sendMessage(reject);
            return;
        }
        
        // Process the request
        String transactionId = (String)msg.payload.data.get('transactionId');
        // ... do inventory reservation logic ...
        
        // Send response
        A2AMessage response = A2AMessageFactory.createResponse(
            msg.messageId, 'success', 
            new Map<String, Object>{'reserved' => true, 'holdExpiry' => DateTime.now().addMinutes(30)}
        );
        A2ASession.sendMessage(response);
    }
}

The sending agent uses the A2A client library. In Apex, that's A2AClient.send(agentId, message).

Practical Lessons from SIVARO's Deployments

We've rolled out A2A in three production environments so far. Here's what I learned the hard way.

Lesson 1: Context negotiation isn't optional. Early on, we ignored the context negotiation fields. Both agents assumed they could handle 16K tokens. Then we hit a case where the sending agent packed a 20K token summary. The receiving agent's LLM — a fine-tuned model with 8K context window — straight up hallucinated. It started making up inventory counts. That's when we realized A2A's maxTokens field exists for a reason. Don't bypass it.

Lesson 2: Agent discovery is flaky at scale. The A2A registry uses Salesforce's internal caching. For 10 agents, it's fine. For 100 agents, we saw registration updates take up to 30 seconds to propagate. If an agent goes down and comes back, other agents might still try to reach the old endpoint. We built a lightweight health-check layer on top — each agent pings the registry every 60 seconds.

Lesson 3: Long context is both a blessing and a curse. When agents share huge contexts, you get better decisions but slower responses. A claims agent sending 12K tokens of a patient's history takes 2.3 seconds to serialize, 0.8 seconds to transmit, and 1.5 seconds for the receiving agent to parse. That's 4.6 seconds overhead before any AI processing. For time-sensitive workflows (like fraud alerts under 500ms), that's unacceptable. Our fix: agents pre-summarize context before sending. The fraud agent sends a 2K token summary instead of the full 10K history. The receiving agent can request the full context if needed.

The Trade-offs

A2A isn't a silver bullet. Let me be honest about its shortcomings.

Latency. As I mentioned, the protocol adds overhead. For simple "acknowledge" type messages, you're paying for a full A2A handshake. We benchmarked it: A2A's average round-trip time is 480ms. A simple REST call would be 80ms. That's 6x slower for trivial operations.

Debugging complexity. When agents speak A2A, you can't just look at HTTP logs. You need A2A-specific tools. Salesforce ships an A2A Inspector in Developer Console, but it's immature. We've had to build our own tracing system using Platform Events to capture every message.

Versioning. A2A v1 is new. It will change. Salesforce already announced breaking changes in v1.1 (due late 2026). If you lock into v1 today, expect migration work.

Lock-in. You're committing to Salesforce's specific flavor of agent communication. Yes, it's based on open MCP, but the extensions are proprietary. If you ever want to move agents outside Salesforce, you'll need a translation layer.

FAQ

Q: Is the agent-to-agent protocol in Salesforce the same as MCP?
A: No. MCP is the foundation. A2A is Salesforce's implementation that adds identity, session management, and context negotiation. Think of MCP as TCP and A2A as HTTP — same layer, different purpose.

Q: Can I use the agent-to-agent protocol to talk to agents outside Salesforce?
A: Yes, but limited. A2A supports external webhook endpoints. We've connected A2A agents to a custom Python agent running on GCP. The external agent must implement the A2A message schema. Salesforce provides SDKs for Node.js and Python.

Q: What is the agent2agent protocol?
A: It's the same thing. Salesforce sometimes brands it as "Agent2Agent" or "A2A". The official spec calls it "Salesforce Agent-to-Agent Protocol".

Q: What is long context in llm, and how does A2A handle it?
A: Long context refers to the amount of information an LLM can process in a single query. A2A negotiates context size between agents, so one agent doesn't overwhelm another. It supports truncation, summarization, and partial delivery.

Q: Do I need a special Salesforce license to use A2A?
A: Yes. A2A is part of the Agentforce platform. You need either the Agentforce Pro or Enterprise license. It's not available in Essentials.

Q: How does A2A handle errors?
A: A2A uses a standard error schema. The receiving agent returns a message with status: "error" and an error code. Agents can retry or escalate. We've seen agents get into infinite retry loops — you need to implement exponential backoff yourself.

Q: Can human agents interact with A2A messages?
A: Indirectly. Einstein Copilot can surface A2A conversations. But the protocol is designed for AI-to-AI. Don't try to manually parse A2A messages in a report.

Q: Is A2A already in production?
A: Yes. It went GA in January 2026. We have clients using it in production since March 2026. It's stable but new — expect occasional quirks.

Bottom Line

Bottom Line

The agent-to-agent protocol in Salesforce isn't a feature. It's a necessity. If you're deploying more than two AI agents in your org and they need to share context, coordinate actions, or hand off work, you need A2A. It saves you from building fragile custom bridges. It forces you to think about context size, latency, and versioning upfront — which you'd have to do anyway, but later, after pain.

We started SIVARO because we saw companies drowning in agent integration hell. A2A is a step in the right direction. It's not perfect. But it's the best tool we've got for making agents work together instead of against each other.

Now go build something. And don't forget to set your maxTokens.


Nishaant Dixit — Founder of SIVARO. Building data infrastructure and production AI systems since 2018. Built systems processing 200K events/sec.

Free · No Commitment · 48-Hour Delivery

Get a free infrastructure audit

2-hour remote session. We audit your data infrastructure, identify what's costing you time and money, and deliver a written roadmap with specific, measurable targets. No pitch.

Book Your Free Audit
N
Nishaant Dixit
Founder & Lead Engineer at SIVARO

Building data-intensive systems since 2018. 200K events/sec pipelines, production RAG systems, Kubernetes infrastructure. LinkedIn →

Start a Project
Need help with AI systems?

Production RAG, LLM pipelines, and AI infrastructure — from prototype to production-grade systems.

Explore AI Product Development