Quickstart

Launch your first agents in 2 minutes.

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/sdk

Simple 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();

// Log messages as they flow between agents.
relay.onMessageReceived = (msg) => {
  if (msg.text) {
    console.log(`${msg.from} → ${msg.to}: ${msg.text}`);
  }
};

// Spawn three agents.
const planner = await relay.claude.spawn({
  name: 'Planner',
  model: Models.Claude.OPUS,
});
const coder = await relay.codex.spawn({
  name: 'Coder',
  model: Models.Codex.GPT_5_3_CODEX,
});
const reviewer = await relay.opencode.spawn({
  name: 'Reviewer',
  model: Models.Opencode.OPENAI_GPT_5_2,
});

await Promise.all([
  planner.waitForReady(),
  coder.waitForReady(),
  reviewer.waitForReady(),
]);

// Kick off the collaboration.
await relay.system().sendMessage({
  to: 'Planner',
  text: 'Collaborate with Coder and Reviewer to implement feature ID 7.',
});

// Wait for everyone to finish, then shut down.
await Promise.all([
  planner.waitForIdle(),
  coder.waitForIdle(),
  reviewer.waitForIdle(),
]);
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 who

See CLI Overview for the full command surface and Broker Lifecycle for running the local broker.