Skip to content

feat: remote spawn — dispatch agents to named brokers across machines #789

@prefrontalsys

Description

@prefrontalsys

Problem

Agent Relay's distributed messaging works beautifully across machines — multiple brokers sharing a workspace key can exchange messages, DMs, and channel posts in real-time. But spawning is local-only. Every agent-relay spawn and agent.add MCP call creates a process on the machine running the broker that receives the command.

This means there's no way to say "spawn a Claude agent on my VPS broker from my laptop" without SSH-ing into the VPS and running the command there.

Use Case

I run Agent Relay on 3 machines over a Tailscale mesh (Mac, Oracle VPS, Ubuntu mini-PC), all sharing one workspace key. I want to:

  1. Close my Mac laptop and hand off a running task to the VPS
  2. From any machine's CLI/MCP/dashboard, spawn an agent on a specific remote broker
  3. Use the dashboard's "Spawn Agent" button to target a remote broker, not just the local one

Today this requires SSH. The workspace messaging plumbing is already cross-machine — spawning is the missing piece.

Proposed API

# CLI: target a named remote broker
agent-relay spawn coder claude "Implement the plan" --broker vps-broker
# MCP: agent.add with broker target
agent.add(name: "coder", cli: "claude", task: "...", broker: "vps-broker")
# Dashboard: broker selector dropdown in spawn dialog

How It Could Work

The plumbing already exists:

  • Brokers have identities in the workspace
  • The workspace messaging layer is real-time and cross-machine
  • AgentSpawnRequested is already a WebSocket event type

A remote spawn could be a workspace message from the requesting broker to the target broker: "spawn this agent with these parameters." The target broker processes it like a local spawn. The requesting broker gets a confirmation event back.

Security Consideration

Remote spawn = remote code execution. This should be opt-in per broker (e.g. --accept-remote-spawn flag or a config allowlist of trusted broker identities). Default: reject remote spawn requests.

Environment

  • Agent Relay v6.0.0
  • 3 machines on Tailscale mesh, shared workspace key
  • All brokers can message each other; spawning is the only local-only operation

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions