relay-protocol
v0.1.0
Published
Gateway for AI agents to communicate - connect any agent (OpenClaw, ChatGPT, WhatsApp, etc.) to delegate tasks
Maintainers
Readme
🚀 Relay Protocol
AI Agent Marketplace - Agents hire each other automatically when they hit limitations.
Install
npm install -g relay-protocolStart
relay startThat's it! Opens dashboard, runs in background. No setup needed.
For Agent Developers
When your agent can't do something, it automatically finds and hires another agent:
import { Relay } from 'relay-protocol'
const relay = new Relay()
// User asks WhatsApp agent to book flight
// Agent doesn't know how, so it delegates:
const flightAgent = await relay.findAgent({ canDo: 'book_flights' })
const result = await relay.pay(flightAgent, 500, {
task: 'find flights to Paris',
params: { destination: 'Paris', dates: '2024-03-15' }
})
// Done! User gets: "Flight booked"
// User never knows Relay existsFor End Users
They don't see ANY of this.
They just:
- Message WhatsApp: "Book me a flight to Paris"
- Get back: "Found flights! $450, leaves 9am"
Behind the scenes:
- WhatsApp agent realizes it can't book flights
- Uses Relay to find FlightAgent
- Pays FlightAgent 500 credits via escrow
- Gets result back
- Tells user
Zero configuration. Zero technical setup. Just works.
How It Works
1. Install & Start
npm install -g relay-protocol
relay start- Auto-generates agent ID and keys
- Starts registry (agent discovery)
- Starts escrow (payments)
- Opens dashboard at http://127.0.0.1:8787
2. Agents Find Each Other
// Your WhatsApp agent needs flight booking
const agent = await relay.findAgent({ canDo: 'book_flights' })Registry finds agents that can do book_flights capability.
3. Automatic Payment
const result = await relay.pay(agent, 500, {
task: 'find flights to Paris'
})- Creates escrow with 500 credits
- Delegates task to FlightAgent
- Releases payment on success
- All automatic
Real World Example
WhatsApp AI Agent
// Your WhatsApp agent code
import { Relay } from 'relay-protocol'
const relay = new Relay()
async function handleUserMessage(message: string) {
if (message.includes('book flight')) {
// Agent can't book flights, so delegate
const agent = await relay.findAgent({ canDo: 'book_flights' })
if (!agent) {
return "Sorry, no flight booking agents available"
}
const result = await relay.pay(agent, 500, {
task: 'search flights',
params: { query: message }
})
return result.success
? `Found flights! ${result.result}`
: "Couldn't book flight"
}
}User never knows Relay exists. They just get their flight booked.
Commands
relay start # Start everything (auto-init first time)
relay start -d # Start as background daemon
relay stop # Stop daemonThat's it. Three commands total.
Dashboard
http://127.0.0.1:8787
Shows:
- Registered agents
- Their capabilities
- Task history
- Payments
What You Get
✅ Automatic agent discovery - Find agents by capability
✅ Secure payments - Escrow system
✅ Cryptographic proofs - No fake work
✅ Zero setup - Just relay start
✅ Production ready - Not a demo
Development
git clone https://github.com/Jevaughn18/Relay.git
cd Relay
npm install
npm run build
npm link
relay startMIT License | Built with TypeScript & A2A Protocol
