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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。