relay
An interface-independent task router for AI agents that selects the cheapest capable backend model via MCP, runs tasks headless, verifies results, and escalates on failure.
README
relay
The interface-independent task router for AI agents.
Hand relay a task in plain English — from your terminal, or from any agent that speaks MCP
(Cursor, Claude Code, Codex). A shareable directive (router.yaml) picks the
cheapest-and-fastest capable backend + model, relay runs it headless in your repo, verifies
the result, escalates only when verification fails, and prints a receipt for what it saved you.
relay "fix the flaky retry test in src/api"
# → lane: quickfix · grok-4.5 · verify: lint+test ✓ · changes staged
# → relay: ~$1.84 saved (grok-4.5 vs fable-5-high) [estimated]
60-second install
# Homebrew (recommended)
brew install yoreai/tap/relay
# or curl
curl -fsSL https://raw.githubusercontent.com/yoreai/relay/main/scripts/install.sh | bash
From source (Bun required):
git clone git@github.com:yoreai/relay.git && cd relay
bun install
bun run src/cli.ts doctor
Quick use
relay setup # register relay as an MCP tool in Cursor/Claude Code
relay init # write ~/.config/relay/router.yaml
relay doctor # backends found? tier resolution on this machine?
relay "fix the flaky retry test" # route → run → verify → receipt
relay --dry-run "review auth.ts" # see routing without running
relay -i # interactive REPL
relay savings --by-lane
relay update # refresh the model catalog (facts, not policy)
relay advise # cheaper same-class models for your tiers
relay advise --apply # accept the suggestions into router.yaml
MCP (Cursor / Claude Code)
relay mcp serve
Cursor — add to .cursor/mcp.json (or global MCP config):
{
"mcpServers": {
"relay": {
"command": "relay",
"args": ["mcp", "serve"]
}
}
}
Claude Code — add to MCP settings:
{
"mcpServers": {
"relay": {
"command": "relay",
"args": ["mcp", "serve"]
}
}
}
Tools: relay_run, relay_status, relay_savings.
Make your agent actually delegate. Registering the tool isn't enough — agents keep doing
everything themselves unless told otherwise. Add this to your repo's AGENTS.md (or
CLAUDE.md):
## Delegation policy
For mechanical subtasks — bulk edits, renames, test fixes, log/status summaries,
lint cleanups — call the `relay_run` MCP tool with a curated brief instead of
doing them inline. Reserve your own context for design, review, and hard debugging.
That single paragraph is where most of the savings come from.
How it works
- Directive — versioned
router.yamlmaps lanes → capability tiers → concrete models. Each tier is an ordered fallback list: the first candidate whose backend CLI is installed wins, so a claude-only (or cursor-only) machine routes every tier with zero config.relay doctorshows exactly where each tier lands on your machine. - Route — rules-first (verbs, file hints, walkaway); default lane if unsure
- Run — headless
cursor-agent,claude, orcodexin your working tree (experimental adapters:gemini,grok,kimi) - Verify → widen → escalate — thin briefs that self-heal before spending frontier tokens
- Receipt — honest savings vs your baseline (measured when the backend reports usage, estimated from bytes for Cursor until its CLI emits tokens)
Git is the review surface: edits land staged by default (or in a worktree → draft PR for walkaway/build lanes). Relay never commits unless a lane says so.
The directive
Repo ./router.yaml or .relay/router.yaml overrides ~/.config/relay/router.yaml.
People share directives, not tribal knowledge. See defaults/router.yaml
and PLAN.md for the full schema.
Staying current (facts vs policy)
The model market moves; a routing table nobody looks at silently overpays. Relay splits this:
- Facts —
defaults/catalog.yaml: which models exist, prices, and a quality class per model (nano → cheap → workhorse → opus-class → frontier).relay updatefetches the latest catalog; a scheduled CI job keeps the repo copy honest (it fails red when the catalog goes 45 days without review). - Policy — your
router.yaml. Relay never rewrites it behind your back.relay advisediffs your tiers against the catalog and proposes swaps within the same quality class (e.g. a frontier-class model at a tenth the price), citing your own local verify-success rates as evidence.relay advise --applyaccepts — as a visible, git-diffable edit.
Roadmap
- Verify gemini/grok/kimi adapter flags against real installs (codex is verified)
- Success-rate-aware advise (already logs verify results per model)
- Frankie adapter as a separate plugin package
- Windows, npm SDK
Status
v0.3.0 — CLI + MCP + cursor/claude backends with per-tier fallback + verify/escalate + receipts + model catalog with update/advise + one-command agent setup.
Not v1 yet: Windows, npm SDK, Codex backend, Frankie adapter (planned as a separate plugin).
License
Apache-2.0 © YoreAI / yoreai
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.