---
title: "How AI agents talk to each other — MCP, A2A & shared state · Cork"
description: "The three real patterns for AI agents communicating over the internet: direct messaging (A2A), shared tools (MCP), and shared state. What each solves, where each breaks, and which one coding agents actually need."
canonical: "https://corkcli.com/guides/how-ai-agents-talk-to-each-other"
last_updated: "2026-09-30"
---

# How AI agents talk to each other

“Agents talking to each other” sounds like one thing. In practice it is three different patterns, solving three different problems — and picking the wrong one is how multi-agent projects stall. Here is what actually exists, over the actual internet, in 2026.

## Pattern 1 — Direct messaging (A2A)

Google's A2A protocol gives agents a way to send each other structured messages: agent A discovers agent B through a published “agent card,” opens a task, and exchanges results. This is the right shape when one agent *delegates* to another — a travel agent handing a booking to a payments agent. It requires both sides to implement the protocol, handle each other's auth, and stay online for the conversation.

## Pattern 2 — Shared tools (MCP)

MCP — the Model Context Protocol, created by Anthropic and now stewarded by the Linux Foundation — standardizes how an agent connects to tools and data. Two agents that connect to the same MCP server aren't messaging each other, but they are acting on the same world: one writes a record, the other reads it. Because nearly every serious harness ships MCP support — Claude Code, ChatGPT, Cursor, Gemini CLI, Codex — this is the only channel that works *across vendors* today without custom glue.

## Pattern 3 — Shared state (coordination servers)

The oldest pattern in distributed systems, and the one most production multi-agent setups quietly converge on: agents don't converse, they read and write a common record and adapt. A task board is shared state. A git repo is shared state — but a slow one, because nothing is visible until commit. The interesting question for parallel work is how *fresh* the shared state is: state that updates at commit time tells you about a conflict after you've written it.

## What coding agents actually need

Two agents editing one repo don't need a conversation. Agent A doesn't want to interview agent B; it wants to know, at the moment it writes a file, that B renamed the function it's about to call. That is shared state with tool-call freshness — pattern 3 delivered over pattern 2's wire.

That combination is what [Cork](https://corkcli.com/) is. Every agent — any vendor, any machine, anywhere on the internet — connects to one MCP server per repo and reports edits as it makes them, down to the symbol level. Every response an agent gets back carries `since_your_last_call`: what teammates changed while it worked, renames it must adapt to, collisions with its declared intent. Agents that have never heard of each other stay coherent because the ledger is the conversation. When two edits genuinely collide, the colliding agents get the bundle — both intents, both changes — and resolve it additively instead of clobbering each other.

## Common questions

How do AI agents talk to each other?
:   Three patterns exist in practice. Direct messaging: agents send each other structured messages (Google's A2A protocol). Shared tools: agents connect to the same servers over MCP and coordinate through what those servers expose. Shared state: agents read and write a common record — a task board, a ledger, a coordination server — and each agent adapts to what the others have done. Most production multi-agent systems use shared state, because it works across vendors without every agent implementing a messaging protocol.

Can agents from different vendors talk to each other?
:   Yes, if they meet on neutral ground. Claude Code, Codex, Cursor, and Gemini CLI don't share a messaging protocol, but they all speak MCP. Point them at the same MCP server and they coordinate through it: one agent reports an edit, the next agent's tool call carries that change in its response. Neither agent knows what harness the other runs.

Do agents need to talk in real time?
:   For coding work, what matters is awareness at the moment of writing, not conversation. An agent doesn't need to chat with its teammate; it needs to know — before it writes a file — that the teammate renamed the function it's about to call. Responses that piggyback cross-agent changes onto every tool call deliver that without any live session between the agents.

What is the difference between MCP and A2A?
:   MCP (Model Context Protocol, created by Anthropic, now under the Linux Foundation) standardizes how one agent connects to tools and data. A2A (created by Google) standardizes how two agents message each other directly. They compose: an agent can use MCP for its tools and A2A to delegate to another agent. For parallel coding work, MCP plus a shared coordination server covers the need without A2A.

How does Cork let agents talk to each other?
:   Cork is a shared-state coordinator over MCP. Every agent connects to one server per repo and reports edits as it makes them. Every response — to a heartbeat, a collision check, an edit report — carries what changed since that agent's last call: other agents' edits, in-flight intents, renames to adapt to, and active collisions. Agents never open a channel to each other; the ledger is the conversation.

[Next: multiple agents, one codebase](https://corkcli.com/guides/multiple-ai-coding-agents-one-codebase)[Read the docs](https://corkcli.com/docs)

Team is free for 14 days, no card needed. Invite a teammate and you both get it.

This page in HTML: https://corkcli.com/guides/how-ai-agents-talk-to-each-other
