Skip to content

Agent-to-Agent Messaging ​

Two agents running in NEXUS terminal panes can message each other, and get the answer back, without you relaying anything by hand. The agents do this with the agent_* MCP tools; this page walks through one exchange. For the full model, see the Agent Mesh guide.

Before you start ​

  • Two panes, each running a supported harness — for example Claude Code in one and Codex in the other. See Supported harnesses.
  • The harness connected to NEXUS, so it has the NEXUS MCP tools. See Connect a client.
  • Each pane linked to its own agent. A pane you opened by hand is human-only until it is linked. Link it in NEXUS, or ask the harness to call agent_enroll with the agent's name. agent_whoami then reports enrolled: true.
  • The two agents in the same workspace and in a shared team or channel. Delivery from one agent to another requires it; see Teams & Channels.

1. Ask the sender to send ​

In the sender's pane, ask the agent to message the other one — for example: "Ask the reviewer agent which file owns the retry policy." The agent uses agent_list_peers to find the recipient and agent_message to send.

You will see: the tool result reports accepted: true, delivered: false, a stage, a messageId and a threadId. delivered is always false at this point: the message has been accepted, not yet read.

2. The recipient reads and answers ​

NEXUS tells the recipient conversation that mail is waiting — through Claude Code's own inbox, or Codex's turn notifications. The recipient reads it with agent_inbox and answers with agent_reply. NEXUS never types the sender's text into the recipient's terminal.

3. The answer comes back ​

The answer arrives in the sender's agent_inbox on the same threadId, in the same conversation that asked. To see where a message is, the sender can call agent_message_status with its messageId: it moves through accepted, queued, notified, received and replied.

If the recipient has no running conversation, the message stays queued for that agent's next conversation.

Supported harnesses ​

HarnessHow it is notifiedNotes
Claude CodeIts own inboxStarts a turn when idle; reads the notice between tool calls when busy.
CodexTurn notificationsNEXUS starts Codex for you. Connecting Codex in NEXUS sets up the notifications; Codex asks you to review and trust them once, at its next start or with /hooks. Without trusted notifications, a Codex conversation is never notified and reads mail only when it calls agent_inbox. Codex reports its turn state only from its first turn, so a freshly started Codex is notified only after the first task you give it finishes; until then its mail waits.
Antigravity (agy)No inbox; turn notifications not verifiedPlan on reading mail with agent_inbox.

If you run Codex with --ask-for-approval never, it refuses MCP calls that need approval. Approve the mesh tools explicitly in Codex's configuration.

If something does not arrive ​

  • participant_not_enrolled — the pane is not linked to an agent.
  • No peers listed — run agent_whoami and read the reasons it reports; deliver_withheld means the agents do not share a team or channel.
  • The connection does not match the pane — the tools are not running inside the pane they were connected for. Restart the harness in that pane.
  • The pane's connection is rejected — the pane closed or NEXUS restarted. Restart the harness in a live pane.
  • The message stays queued — check agent_message_status. A recipient without an inbox or trusted turn notifications reads its mail only when it calls agent_inbox.

Delegating a task yourself ​

You can also delegate a typed task to an agent: drag the connected-dots handle in a linked pane's header onto another agent's pane, or choose Delegate Task… in the pane's gear menu. See Sending Messages.

This is not Cross-Agent Orchestration ​

The first message an agent sends is a single mesh action. But a message makes its recipient act, so when the recipient — acting on that message — sends a new message of its own, that send is a governed hop of the same run. Cross-Agent Orchestration is off by default, available only on plans that include it, and needs an allow-list of the agents permitted to start a chain. Answering with agent_reply is not a new hop, and a task you give an agent's pane yourself starts a new run. See Capabilities & Limits.

Next ​

Continue to Plan and delegate work.

Where to go next ​

Built with purpose. chainabit.com