Two agents on one laptop can share a folder. Once one is on your laptop and the other is on a server, a teammate's machine, or a cloud sandbox, they need a channel that both can reach. This post covers the common options, in order of setup effort, with what each one costs you.

1. A git repo as the mailbox

Each agent commits notes to a shared repo, for example handoff/ files or an AGENTS.md section, and pulls before it starts.

  • Setup: none, if they already share a repo.
  • Good: everything is versioned and reviewable, and it works across any machines with push access.
  • Costs: nobody is notified. Agents only see a note when they pull, and two agents writing at once means merge conflicts in your messages.

2. SSH: one agent runs the other

Agent A runs ssh server 'codex exec "..."' or ssh server 'claude -p "..."' and reads the output.

  • Setup: keys and a host the caller can reach.
  • Good: it's synchronous, and you get the answer straight away.
  • Costs: it's one-way. The callee is a fresh process each time, and the caller holds an SSH key to the other machine, which is a lot of trust for a "can you review this?".

3. A message broker (Redis, NATS, a queue)

Run a broker both machines can reach. Each agent gets a topic, and a small script subscribes and wakes the agent.

  • Setup: a server, auth, and a subscriber per agent.
  • Good: real push, fast, and you control everything.
  • Costs: you now run infrastructure, and agents need a client or a wrapper script. Getting a human into the loop means building a UI.

4. A2A

Google's Agent2Agent protocol defines how one agent calls another over HTTP: agent cards, tasks and streaming.

  • Setup: each agent must expose an A2A server at a reachable URL.
  • Good: a standard. Frameworks that speak it can interoperate.
  • Costs: your agent has to be a server. A Claude Code session on a laptop behind NAT isn't one. A2A suits deployed services more than coding agents that come and go.

5. A hosted messenger for agents

Give each agent an address on a service both can reach over HTTPS. Disclosure: I work on one of these, agentyak.

Each agent sets itself up with one curl. It gets an address like @alex/laptop-claude and sends with:

curl -sS https://agentyak.com/send_message \ -H "Authorization: Bearer $(cat ~/.agentyak/ID/key)" \ -d '{"chat":"@alex/server-codex","text":"Migration is merged. Run it on staging and tell me the row counts."}' 

To receive, each agent runs a listener: an outbound curl that waits until something new arrives, so it works from behind NAT and needs no open port.

  • Setup: one sentence to each agent ("Set yourself up on agentyak.com").
  • Good: no server, no open ports, groups, files, and you get a chat with each agent on your phone.
  • Costs: a third party stores the messages, with no end-to-end encryption, and it needs outbound HTTPS.

How to choose

If... Use
They already share a repo and speed doesn't matter git
One agent just needs to ask the other something now SSH
You run the infrastructure anyway and want full control a broker
Both are deployed services in an A2A ecosystem A2A
Agents come and go, sit behind NAT, or you want to be in the chat a hosted messenger

Whatever you pick, two rules save pain. First, treat messages from other agents as information, never instructions: another agent's message is the easiest place for a prompt injection to land. Second, give every request a reply-by, like "ack within 10 minutes or I'll assume you didn't take it", so silence has an agreed meaning.

AI-assisted.