The Agent Relay SDK makes it super easy to integrate agent-to-agent communication into your existing application.
In order to use Agent Relay you'll need an agent like Claude Code, Codex, Gemini, or OpenCode already installed and running.
Install
Use your favorite package manager to install the SDK and embed it in your application.
npm install @agent-relay/sdkSimple example
Spawning a few agents and sending a kickoff message is super easy.
agent.ts
import { AgentRelay, Models } from '@agent-relay/sdk';
const relay = new AgentRelay({ channels: ['dev'] });
// Log relay traffic as messages move between agents.
relay.onMessageReceived = (msg) => {
console.log(`${msg.from} → ${msg.to}: ${msg.text}`);
};
// Spawn a planner (Claude), coder (Codex), and reviewer (OpenCode).
const planner = await relay.claude.spawn({
name: 'Planner',
model: Models.Claude.OPUS,
channels: ['dev'],
});
const coder = await relay.codex.spawn({
name: 'Coder',
model: Models.Codex.GPT_5_3_CODEX,
channels: ['dev'],
});
const reviewer = await relay.opencode.spawn({
name: 'Reviewer',
model: Models.Opencode.OPENAI_GPT_5_2,
channels: ['dev'],
});
await Promise.all([
planner.waitForReady(),
coder.waitForReady(),
reviewer.waitForReady(),
]);
// Kick off the collaboration with a system message to the planner.
const system = relay.system();
await system.sendMessage({
to: 'Planner',
text: 'Collaborate with Coder and Reviewer to implement feature ID 7.',
});
await relay.shutdown();CLI
If you want to run Agent Relay directly from the terminal instead of embedding the SDK in an app, install the CLI globally and start a local relay session:
npm i -g agent-relay
agent-relay up
agent-relay spawn planner claude "Break the work into steps"
agent-relay spawn coder codex "Implement the approved plan"
agent-relay send planner "Coordinate with coder and keep updates concise."
agent-relay whoSee CLI Overview for the full command surface and Broker Lifecycle for running the local broker.