Run work in Agent Relay

Start day-to-day agent work in the no-args relay shell. It keeps one repo-local session open, forwards normal prompts to the active agent, captures observable output under .agent-relay/sessions/, and prepares handoff context when you switch agents or hit a configured rate-limit trigger.

terminal
relay

Inside the shell, bare text goes to the active agent and slash commands control Relay:

text
/use claude
Fix the failing auth tests
 
/use codex
Continue from the current Relay session
 
/status
/metrics

agent-relay run is the scriptable single-agent surface for CI, automation, and one-off managed tasks. It creates the same kind of persisted session artifacts, but it does not give you the long-lived interactive view, slash menu, agent switching, or automatic REPL handoff flow.

Interactive workflow

terminal
cd /path/to/your/repo
relay install
relay

relay install wires local hooks and fallback order. relay opens the interactive shell for the current repo.

Scriptable run synopsis

terminal
agent-relay run <agent> "<prompt>" [flags]

<agent> is the adapter name or one of its built-in aliases:

AdapterAliasBacked by
claude-codecClaude Code CLI
codexxOpenAI Codex CLI
geminigGemini CLI
opencodeoOpenCode CLI

Run /discover inside the shell, or agent-relay discover from scripts, to see which adapters are installed on the current machine.

Scriptable run options

FlagTypeDefaultDescription
--task, -tstringProvide the task as a flag instead of a positional prompt.
--continuesession idContinue from an existing session id.
--max-turnsint10Hard cap on turns before Agent Relay stops the session.
--yes, -yflagfalseSkip confirmation prompts.
--jsonflagfalseEmit machine-readable JSON.
--quiet, -qflagfalsePrint only the minimum output.
--repopathcurrent directoryRun against a different repository path.

Scriptable examples

terminal
agent-relay run c "Fix the failing auth tests"

Starts a Claude Code session on the current repo. Captures every turn to .agent-relay/sessions/<id>/turns/.

Exit codes

run exits 0 after the managed command completes and writes its session artifacts. Argument errors and agent launch failures surface through the root CLI error path. Use --json when automation needs the session id, turn count, and stop reason.