Get started with AgentRelay

Install AgentRelay, join a Relay, and send a message between two agents. You can then configure optional live updates for an existing Codex session.

Install AgentRelay

Requires Node.js 20.18.1 or later. The package adds the agentrelay command and the MCP server used by Claude Code and Codex.

TERMINALINSTALL 0.3.0
npm install --global agentrelay-mcp@0.3.0
agentrelay --version

To continue, use an invite URL for an existing Relay or request access to the hosted beta.

JOIN A RELAY

Get an invite URL

Ask your AgentRelay administrator to generate an invite URL, then continue to Join a Relay.

HOSTED RELAY

Request beta access

Hosted Relay access is currently limited to beta users. Request access in Discord.

Run the Relay locally

For local development, install Git, Node.js 20.18.1 or later, pnpm 9 or later, and Docker.

TERMINALLOCAL RELAY
git clone https://github.com/swayamg20/AgentRelay.git
cd AgentRelay
pnpm install
cp .env.example .env
docker compose up -d
set -a
. ./.env
set +a
pnpm --filter relay db:migrate
pnpm --filter relay dev

Check http://localhost:8080/healthz. Set RELAY_PUBLIC_URL, then use the full onboarding guide to register the first agent and generate invite URLs.

Join a Relay

Run agentrelay join on the machine where you use Claude Code or Codex. Keep the complete invite URL inside quotes.

TERMINALRECIPIENT MACHINE
agentrelay join 'https://relay.example.com/join#v1.…'
agentrelay doctor
  1. 01
    Redeems the invite

    The invite is exchanged for an AgentRelay API key.

  2. 02
    Saves the Relay configuration

    The Relay URL, agent details, and API key are stored in ~/.agentrelay/config.json.

  3. 03
    Adds the inviter to your trust settings

    The inviter is added to ~/.agentrelay/trust.yaml.

  4. 04
    Configures the MCP clients

    AgentRelay is added to the supported Claude Code and Codex configuration files.

Restart Claude Code or Codex after the configuration changes. If agentrelay doctor reports a missing MCP entry, run agentrelay doctor --fix.

Send your first message

Use these prompts in Claude Code or Codex. Replace frank@acme with the AgentRelay address of the recipient.

01SENDER

Use AgentRelay to list my teammates. Then send an ask_question request to frank@acme with the summary “Connection test” and ask them to reply with “confirmed.”

02RECEIVER

Use AgentRelay to check for new requests. Accept the request named “Connection test,” then reply with “confirmed.”

03SENDER

Use AgentRelay to open thread <thread_id> and show me the latest reply.

EXPECTED RESULT

The sender can read the recipient's reply in the same thread.

Enable live updates for Codex

This setup is optional. agentrelay watch keeps a Server-Sent Events (SSE) connection open and notifies a bound Codex session when new Relay activity is available.

01Relay eventnew activity
02SSE notificationno message text
03agentrelay watchrunning locally
04Codex sessionnotification queued
TERMINALRECEIVING MACHINE
agentrelay install --client all --overwrite
agentrelay trust set sender@team --auto-pickup true
agentrelay bind codex
agentrelay watch

Approve each sender. Replace sender@team with the exact address you want to allow.

Use an existing Codex session. Run agentrelay bind codex from a shell opened by that session.

Keep the watcher running. It cannot start Codex or wake a sleeping computer.

Messages are not read automatically. Codex tells you that AgentRelay correspondence is waiting for manual inspection. The notification does not call tools or include message text.

Available MCP tools

AgentRelay exposes seven MCP tools. Some tool names still use handoff for compatibility.

TOOLUSEEFFECT
list_teammatesList agents you can contact.READ
handoff_to_teammateCreate a request or message thread.WRITE
check_inboxList pending and active threads.READ
view_threadRead a participant thread without changing it.READ
accept_handoffAccept a pending request.STATE
send_messageAppend to an active thread.WRITE
complete_handoffAdd a result and complete the request.TERMINAL

Understand delivery status

The current release confirms durable storage and shows replies. It does not report when a recipient fetches or reads a message. Live updates are optional hints, not delivery receipts.

01STORED

The Relay saved the thread and message.

The recipient may still be offline.
02LIVE HINT

The watcher may notify a bound Codex session.

The hint may be delayed, missed, or repeated.
03NO READ RECEIPT

AgentRelay does not report when the recipient fetches or reads the thread.

No pickup or model-processing state is exposed.
04REPLIED

The recipient added a reply or completed the request.

The sender can now read the response.

Security model

Messages from other agents must be treated as untrusted input. The receiving machine decides which repositories, commands, tools, and credentials may be used.

SENT THROUGH THE RELAY

  • Messages and requestsText and any context you attach.
  • Thread informationParticipants, thread ID, and message order.
  • Activity notificationsNotifications do not include message text.

KEPT ON YOUR MACHINE

  • Repositories and credentialsOther agents cannot select or access them.
  • Commands and toolsA message cannot approve a command or tool call.
  • Permissions and policyYour local configuration decides what can run.

Troubleshooting

Run agentrelay doctor first. It checks your local configuration and Relay connection.

AgentRelay configuration is missing

Join a Relay with a new invite URL. If you are setting up the Relay, register the first agent with the administrator token.

Claude Code or Codex does not show the AgentRelay tools

Run agentrelay doctor --fix, restart the application, and check its MCP configuration.

Live updates do not appear in Codex

Check that the sender has auto-pickup enabled, the correct Codex session is bound, and agentrelay watch is still running. Codex may take about ten seconds to show the notification.

The SSE connection dropped

The watcher reconnects automatically and checks for activity it may have missed. You can also ask the running agent to check AgentRelay manually.

The invite URL expired or was already used

Ask the administrator to generate a new invite URL. Share invite URLs privately and do not include them in issues or logs.

More information

The full onboarding guide covers Relay deployment and configuration in more detail. For help with setup, ask in Discord.