Writing

Introducing Relay

Fix it once, never twice. Relay is a gateway for coding agents that learns the fixes your model makes and applies them itself the next time the same failure shows up, with no model call.

Every coding agent pays its model to rediscover fixes it has already made. The same off-by-one, the same missing null check, the same wrong import path: each copy costs a fresh round of reading, reasoning and tokens, as if the model had never seen it before.

A frontier model is the right tool for a failure nobody has seen. It is an expensive way to fix the fiftieth copy of one you already have.

Today we are opening a private beta of Relay, an OpenAI-compatible gateway that remembers verified fixes and hands them back for free. In a replay of 50 real agent tasks, Relay wrote 43 of the fixes itself, cutting model calls by about 70%, and not one of its fixes failed.

One line to integrate

Relay sits between your agent and its model provider. You change base_url, use a Relay key, and keep your own provider key, which Relay stores encrypted and uses only to forward your requests.

It speaks Chat Completions and the Responses API, streaming included. We have tested it end to end with the Codex CLI, the OpenAI SDK, Claude (forwarded with your Anthropic key), Gemini, and open models on any OpenAI-compatible host.

coding agentCodex, SDK, any clientbase_urlRelayhas a verified fix?Relay fixes itagent's tools, 0 model callsyesyour provideryour key, unchangedno
Relay is a drop-in OpenAI-compatible gateway. A known failure is fixed by Relay; everything else goes to your model exactly as before.

Capability transfer, not caching

Relay never replays a stored response. A cache only helps when the exact same request comes back, and in a codebase it almost never does: the variable is named differently, the loop lives in another file, the language is different.

Instead Relay learns capabilities. It watches the conversation, and when it sees a failing test, then an edit by the model, then the same test passing, it has evidence of a verified fix. The engine parses the before and after with tree-sitter, generalizes the edit past names and layout, and keeps it only if it transfers to renamed and restructured variants with zero regressions. It works across 12 languages: JavaScript, TypeScript, TSX, Python, Go, Java, Rust, Ruby, PHP, C#, C/C++ and Bash.

01

Watch

Read each conversation: files read and edited, test runs, pass or fail.

02

Learn

Failing run, model edit, same run passing: a verified fix, compiled into a capability.

03

Transfer

Same kind of failure again: Relay reads the code, writes the fix, re-runs the test.

04

Fail safe

Re-run fails: the model takes over with the failure in context.

Relay learns only from fixes the model made and the tests confirmed, and acts only by emitting the agent's own tool calls.

When a later conversation reaches a failure Relay has a capability for, Relay acts for the model. It reads the failing code, writes the fix with the agent's own edit tool, and re-runs the same test, all as ordinary tool calls in the agent's loop. It never touches your machine directly; your agent executes every step, and your tests are the judge.

Two rules keep this honest:

  • Learn only from the model. Relay compiles fixes the model made and the tests confirmed. Fixes Relay wrote itself are never re-learned, so it cannot reinforce its own mistakes.
  • Fail open. If Relay's re-run fails, the model takes over with the failure already in context. Repeated failures pause that capability, and any Relay error is treated as a miss, so your agent's normal path always runs.

What we measured

Replay: 150 real agent tasks

We recorded a real agent working through 50 bug-fixing tasks with three different models, then streamed those tasks through the gateway in arrival order, starting from an empty library. Each task is a real agent loop with real files and real test runs: run the tests, read the source, write the fix, re-run.

Task 1: fixed by the modelTask 2: fixed by RelayTask 3: fixed by RelayTask 4: fixed by the modelTask 5: fixed by the modelTask 6: fixed by RelayTask 7: fixed by RelayTask 8: fixed by RelayTask 9: fixed by RelayTask 10: fixed by the modelTask 11: fixed by RelayTask 12: fixed by RelayTask 13: fixed by RelayTask 14: fixed by the modelTask 15: fixed by RelayTask 16: fixed by RelayTask 17: fixed by RelayTask 18: fixed by RelayTask 19: fixed by RelayTask 20: fixed by RelayTask 21: fixed by RelayTask 22: fixed by RelayTask 23: fixed by RelayTask 24: fixed by RelayTask 25: fixed by RelayTask 26: fixed by the modelTask 27: fixed by RelayTask 28: fixed by the modelTask 29: fixed by RelayTask 30: fixed by RelayTask 31: fixed by RelayTask 32: fixed by RelayTask 33: fixed by RelayTask 34: fixed by RelayTask 35: fixed by RelayTask 36: fixed by RelayTask 37: fixed by RelayTask 38: fixed by RelayTask 39: fixed by RelayTask 40: fixed by RelayTask 41: fixed by RelayTask 42: fixed by RelayTask 43: fixed by RelayTask 44: fixed by RelayTask 45: fixed by RelayTask 46: fixed by RelayTask 47: fixed by RelayTask 48: fixed by RelayTask 49: fixed by RelayTask 50: fixed by Relaytask 1task 50

Model wrote the fix (7)Relay wrote the fix (43)

One replay run, in the order tasks arrived. Relay starts knowing nothing; the model pays for the first fix of each kind, and Relay handles the repeats.

The model pays for the first fix of each kind. After that, Relay handles the repeats. Across all three models, 42 to 43 of 50 tasks were fixed by Relay, all 50 were solved, and none of Relay's fixes failed and fell back to the model.

Saved by Relay, recorded real-agent stream (50 tasks per model)

ModelModel callsTokens
GPT70.4%69.6%
Gemini71.6%69.5%
Open-weight71.6%71.8%
Reduction against the same tasks without Relay. For Gemini: 250 model calls became 71, and 6.4M tokens became 2.0M. All 150 tasks solved, 0 failed Relay fixes.

Live: a real model behind Relay

The replay reuses recorded answers, so we also put a live model, gpt-oss-120b on Groq, behind Relay in a real agent loop on 12 small Python and JavaScript tasks. Every step was the model's own decision. We ran each task twice: once with Relay active, and once in shadow mode, where Relay never changes a response, as the model-only baseline.

Live run, 12 tasks: model calls

Without Relay
76
With Relay
37
Model calls fell 51%, and tokens fell 52% (40.9k to 19.7k). On tasks whose kind of bug had already been seen, tokens fell 80%. All 24 runs (12 tasks, twice) solved.

Real code: Claude Code and Codex

The numbers above are from the gateway. Since launch we have also built the Relay CLI, a terminal agent that runs on your installed, unmodified Claude Code or Codex, signed in with your own plan. Relay never sees those credentials, and your code never leaves your machine.

Before handing a task to your agent, the CLI tries a cheaper route. Renames are done with no model at all. A change with a failing check first goes to one call on a small model (Claude Haiku, or Codex's fast model) with only the files that matter and how similar tasks were done before in the project. That edit is kept only if the failing check turns green and nothing else breaks. Otherwise the workspace is restored exactly and your agent does the task as usual.

We measured it on real code: Relay's own repository.

  • Planted bugs. 17 realistic one-line bugs (a flipped comparison, an off-by-one, && for ||), each kept only if the repo's real tests catch it.
  • Real bugs. 9 bugs that actually happened while building Relay, put back over their fixes, each caught by the regression test written at the time.

Each task ran in a fresh copy of the repo, once through Relay and once with the agent alone. A task counts as solved only if the named test passes and a hidden check, every test file in the package, still passes.

Saved by the Relay CLI on Relay's own codebase

BenchmarkCostTokens
17 planted bugs, Claude Code80.5%62.5%
9 real bugs, Claude Code70.3%55.1%
9 real bugs, Codex—54.7%
Reduction against the same tasks with the agent alone. Planted bugs: $3.77 became $0.73, and 2.81M tokens became 1.06M. Real bugs on Claude Code: $2.22 became $0.66. Codex runs on a ChatGPT plan, so it reports tokens, not dollars.

The small-model fast path finished 15 of the 17 planted bugs and 7 of the 9 real ones on Claude Code; the rest fell through to the full agent. With Relay, every task passed its visible test and the hidden check, on both agents. The Codex agent alone left one of the nine real bugs unsolved.

Safe by default

Relay is built for teams that cannot afford a clever gateway breaking their agents:

  • Shadow mode first. Point your traffic at Relay and it only records what it would have done. Nothing is served, and shadow decisions are free.
  • Yours only. Capabilities learned in a project are only ever used in that project.
  • Reversible. Every promotion is logged. Retire one capability, or stop everything, in a click.
  • Pay per verified fix. Relay never resells model tokens. You pay only when Relay delivered a fix and the re-run tests passed. Misses cost nothing.

Join the beta

We are onboarding a handful of teams running coding agents in production, in small batches so we can watch every rollout closely. The path is three steps: point your base_url at Relay, run in shadow mode, then switch to active when the numbers make sense.

The CLI is in the same private beta and installs in one line with an invite.

Read more about Relay, or get in touch to join the waitlist.

Research

Introducing RAZOR

Occam's razor, turned into a price: a model pays for every write to long-term memory, and when it declines to pay, memory stays exactly as it was.

6 min read