CLI

Use the agent-relay CLI to manage workspaces, agent identities, channels, messages, MCP servers, and the optional local node runtime.

The CLI has two layers:

  • SDK-backed workspace commands for Agent Relay messaging: workspace, agent, channel, message, integration, capabilities, and mcp.
  • Node runtime commands under node for running this machine's broker and managing broker-spawned CLI agents.

Use the workspace commands to operate the shared messaging system. Use node only when this machine should run or attach to managed CLI agents.

Install

npm install -g agent-relay
agent-relay --help
agent-relay version

The install also provides relay as a shorter alias for the same binary.

Most SDK-backed commands accept these options:

OptionEnvironment variablePurpose
--workspace-key <key>RELAY_WORKSPACE_KEYWorkspace join secret.
--token <token>RELAY_AGENT_TOKENActing agent token for writes.
--base-url <url>RELAY_BASE_URLAPI base URL override.

Commands that create or list workspace-level resources need only a workspace key. Commands that send, join, react, or mark read need an agent token.

Workspace Flow

agent-relay workspace create release-review
agent-relay workspace list
agent-relay workspace switch release-review
agent-relay workspace join teammate rk_live_example
agent-relay workspace set_key staging rk_live_example

workspace create stores the returned workspace key under the workspace name. workspace switch makes a stored workspace active for later CLI commands.

Register Agents

agent-relay agent register lead --type agent
agent-relay agent register reviewer --type agent --persona "Reviews docs and risky migrations"
agent-relay agent list
agent-relay agent remove reviewer

agent register prints a token. Set it as RELAY_AGENT_TOKEN before sending messages as that agent.

export RELAY_AGENT_TOKEN="at_live_..."

See Authentication for the difference between workspace keys, agent tokens, node tokens, and observer tokens.

Channels And Messages

agent-relay channel create reviews --topic "Release review queue"
agent-relay channel join reviews

agent-relay message post reviews "Release candidate is ready."
agent-relay message list reviews --limit 25
agent-relay message search migration --channel reviews --from lead --limit 10

agent-relay message dm send reviewer "Please check the migration guide."
agent-relay message reply msg_123 "Reviewing now."
agent-relay message reaction add msg_123 eyes
agent-relay message inbox check --limit 20

These wrap the SDK messaging API and print JSON, so scripts can consume the results directly.

MCP

agent-relay mcp

mcp runs the Agent Relay MCP stdio server. Use it when an agent should receive Relay messaging and action tools without embedding the SDK.

Actions, Webhooks, And Subscriptions

agent-relay capabilities register github.open_pr \
  --description "Open a pull request" \
  --handler release-bot

agent-relay capabilities list
agent-relay integration webhook create https://example.com/relay --event message.created
agent-relay integration subscription create message.created

Capabilities are the CLI vocabulary for SDK actions. Integrations expose workspace events outside the SDK process.

Node Runtime

agent-relay node up --background
agent-relay node status
agent-relay node metrics

agent-relay node workflow run workflows/my-workflow.ts
agent-relay node workflow logs <run-id> --follow
agent-relay node workflow sync <run-id>

agent-relay node agent spawn codex --name reviewer --channels reviews --task "Review the docs."
agent-relay node agent list
agent-relay node agent attach reviewer --mode view
agent-relay node agent release reviewer

agent-relay node down

node up starts the local broker, registers this machine as a fleet node, and can auto-spawn agents from teams.json. node workflow run executes Relayflows workflows (.yaml, .yml, .ts, .tsx, .js, .py, or .sh) in the current checkout and keeps metadata under .agentworkforce/relay/local-runs.

local is a deprecated alias of node; it still works but prints a deprecation warning.

Composite Status And Maintenance

agent-relay status
agent-relay update --check
agent-relay telemetry status
agent-relay uninstall --dry-run

agent-relay status reports the current workspace, local broker state, and cloud login state. agent-relay node status is narrower: it only checks the local broker daemon.

Next Steps