If you've spent any time with OpenClaw agents, you've probably hit this wall: your agent is great at doing things for you, but the moment you want it to coordinate with another agent — even one you also control — there's no obvious way to make that happen. Chat interfaces are built for humans talking to one agent, not agents talking to each other.
So how do you actually make two OpenClaw agents talk to each other? Not "wire up a shared database" or "have them both hit the same webhook" — an actual conversation, initiated by one agent, received by the other, with a real reply.
This post walks through the simplest version of that: one skill install on each side, a handshake, and a first message exchanged. No custom server, no webhook relay, no polling loop you have to babysit.
Why this is harder than it sounds
Two agents talking to each other sounds like it should be trivial — it's just messaging, right? In practice you run into three separate problems at once:
- Addressing. Where does agent B even live? If it's running on your laptop today and a cloud VM tomorrow, "where" keeps changing.
- Reachability. Even if you know where it is, if it's behind a home router or a corporate NAT, nothing can just connect to it. This is the same problem VPNs solve for humans — but most agent setups don't have a VPN, they have a webhook and a prayer.
- Trust. You don't want every random process on the internet to be able to message your agent just because it found the address. You want an explicit approval step.
Most people solve this ad hoc: expose an HTTP endpoint, poke a hole in the firewall, hope the IP doesn't change. It works until it doesn't — the tunnel breaks, the port changes, or you've accidentally built an unauthenticated inbox.
The overlay network approach
An overlay network solves all three problems at the protocol layer instead of app-by-app. Pilot Protocol is one implementation built specifically with AI agents in mind: every agent gets a permanent virtual address that doesn't change when the underlying IP does, encrypted UDP tunnels with NAT traversal handle the reachability problem, and an explicit per-peer handshake means nobody talks to your agent unless you (or it) approved them first. Membership on the network and trust with a specific peer are two different things — being "on" Pilot doesn't mean every other agent on Pilot can message you.
That's the piece that maps cleanly onto "make two OpenClaw agents talk to each other": each agent becomes a node with its own address, and the two nodes handshake once before exchanging anything.
Step 1: Install the skill on each agent
Each OpenClaw agent needs the same one-time setup — installing the daemon that gives it a network identity. On each machine (or each agent's environment):
curl -fsSL https://pilotprotocol.network/install.sh | sh
This installs pilotctl (the CLI) and starts the daemon in the background. Confirm each one registered successfully:
pilotctl daemon status
pilotctl info # shows this agent's node ID and virtual address
Do this on both agents. At this point you have two independent nodes on the network, but they don't know about each other yet — that's the next step.
Step 2: Handshake between the two agents
Pick a hostname or address for agent B (whatever it registered as, or its node ID from pilotctl info). From agent A:
pilotctl handshake <agent-b-hostname-or-id> "let's coordinate on the weekly report"
This sends a signed handshake request — it does not automatically grant access. Agent B needs to approve it:
pilotctl pending # see the incoming request
pilotctl approve <node_id> # accept it
Trust propagates through the registry, which can take a few seconds. If a message right after approval doesn't land immediately, that's normal — retry once after a brief pause. Once trust is mutual, it holds in both directions and survives restarts on either side.
Step 3: Send the first message
With trust established, either agent can message the other directly:
pilotctl send-message <agent-b> --data 'status check: are you done with the ingestion job?'
Agent B reads it from its own inbox:
ls -1t ~/.pilot/inbox/ | head -1
jq -r '.data' ~/.pilot/inbox/<latest-file>.json
And replies the same way, back to agent A. That's the whole loop — two agents, one address each, one approved trust relationship, and a message that actually reached the other side without either of you standing up a server.
What this unlocks beyond "hello world"
Once the tunnel exists, it's just a transport — you can build actual coordination logic on top of it: one agent hands off a completed task to another, two agents split a workload and check in, or a supervisor agent pings worker agents for status. The interesting part isn't the message format, it's that the connection is durable and addressable regardless of where each agent happens to be running that day.
Pilot Protocol also ships an app store of installable capability apps that any node can call locally (pilotctl appstore catalogue), which is worth knowing about once you're past the two-agent stage — but the A2A messaging loop above doesn't depend on any of that. It's the minimum viable version.
FAQ
Do both agents need to be on the same network or same machine?
No — that's the point of the overlay network. NAT traversal handles the case where one or both agents are behind a home router or corporate firewall.
What happens if I never approve the handshake?
Nothing gets through. The handshake step is opt-in for the receiving side; a pending request is not a trusted relationship, and no messages flow until it's approved.
Is this specific to OpenClaw?
No — the underlying mechanism is agent-agnostic. Any process that can run pilotctl can join the network and message any other node it's handshaked with, whether it's an OpenClaw agent, a custom script, or something else entirely.
Do I need to write any networking code myself?
No. pilotctl handles the tunnel, encryption, and NAT traversal; you're just calling send-message and reading a JSON file. If you want to script this into an agent's own workflow, wrap those same CLI calls.
Try it
curl -fsSL https://pilotprotocol.network/install.sh | sh
Full setup and the broader skills ecosystem for agents — including how to package this kind of A2A coordination as a reusable skill — is documented at pilotprotocol.network/docs.
Top comments (0)