Skip to content

Commit 3a58f7d

Browse files
khaliqgantclaude
andcommitted
feat: add relay-broker Rust binary from PR #404
Pull relay-broker directory from relay-broker-integration branch as the foundation for the hybrid approach. Will apply bug fixes from PR #412 on top. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 85c0b70 commit 3a58f7d

34 files changed

Lines changed: 13282 additions & 0 deletions

relay-broker/Cargo.lock

Lines changed: 3448 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

relay-broker/Cargo.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[package]
2+
name = "relay-broker"
3+
version = "0.1.0"
4+
edition = "2021"
5+
autobins = false
6+
7+
[lib]
8+
name = "relay_broker"
9+
path = "src/lib.rs"
10+
11+
[[bin]]
12+
name = "agent-relay"
13+
path = "src/main.rs"
14+
15+
[dependencies]
16+
anyhow = "1.0"
17+
axum = "0.8"
18+
chrono = { version = "0.4", features = ["serde", "clock"] }
19+
clap = { version = "4.5", features = ["derive"] }
20+
dirs = "6.0"
21+
futures = "0.3"
22+
parking_lot = "0.12"
23+
portable-pty = "0.8"
24+
rand = "0.8"
25+
regex = "1.11"
26+
reqwest = { version = "0.12", features = ["json", "rustls-tls"] }
27+
serde = { version = "1.0", features = ["derive"] }
28+
serde_json = "1.0"
29+
thiserror = "2.0"
30+
tokio = { version = "1.44", features = ["full"] }
31+
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-native-roots"] }
32+
tracing = "0.1"
33+
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
34+
uuid = { version = "1.15", features = ["v4", "serde"] }
35+
36+
[target.'cfg(unix)'.dependencies]
37+
nix = { version = "0.30", features = ["signal", "process", "term"] }
38+
39+
[dev-dependencies]
40+
httpmock = "0.7"
41+
tempfile = "3.19"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Agent Relay Protocol
2+
3+
IMPORTANT: Do NOT use built-in agent tools (Task, SendMessage, TeamCreate, or any native agent spawning) for agent communication. ALWAYS use the relay protocol described below. This applies to spawning agents, sending messages, and all inter-agent coordination. The relay protocol is the ONLY supported method for agent-to-agent communication in this environment.
4+
5+
When you receive a line like `Relay message from <agent> [<id>]: ...`, treat it as an inbound relay message and reply using one of the methods below instead of plain terminal text.
6+
7+
## Sending Messages
8+
9+
### Option 1: MCP tools (preferred)
10+
11+
Use the Relaycast MCP tools to send messages. First call `set_workspace_key` with the value of your `RELAY_API_KEY` environment variable, then `register` as an agent, then send:
12+
13+
- `post_message(channel, text)` — post to a channel
14+
- `send_dm(to, text)` — DM an agent
15+
- `check_inbox()` — check for unread messages
16+
- `list_agents()` — list agents in the workspace
17+
18+
### Option 2: CLI (fallback)
19+
20+
`relay_send` is a shell command available on PATH:
21+
22+
```bash
23+
relay_send <agent-name> "your message" # DM to an agent
24+
relay_send '#channel' "your message" # post to a channel
25+
```
26+
27+
Note: the CLI may fail in sandboxed environments that block network access.
28+
29+
To control the broker daemon, send JSON command messages to the lead agent:
30+
31+
```json
32+
{"broker":"agent-relay","kind":"spawn","name":"Worker1","cli":"codex"}
33+
```
34+
35+
```json
36+
{"broker":"agent-relay","kind":"release","name":"Worker1"}
37+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"mcpServers": {
3+
"relaycast": {
4+
"args": [
5+
"-y",
6+
"@relaycast/mcp"
7+
],
8+
"command": "npx",
9+
"env": {
10+
"RELAY_AGENT_NAME": "broker",
11+
"RELAY_API_KEY": "rk_live_b00fd0ddeca96468d72140c9c4b3a910",
12+
"RELAY_BASE_URL": "https://api.relaycast.dev"
13+
}
14+
}
15+
}
16+
}

relay-broker/scripts/multi-review/package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "multi-review",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"start": "node review.mjs"
7+
},
8+
"dependencies": {
9+
"@agent-relay/sdk-ts": "file:../../packages/sdk-ts"
10+
}
11+
}

0 commit comments

Comments
 (0)