Relay
An open-source, terminal-based AI coding agent that reads your code, calls tools, and helps you build.
Features
Interactive TUI
Full-screen terminal interface with streaming responses and real-time tool calls.
Single-Shot Mode
Pass a prompt directly for quick, non-interactive runs.
Built-in Tool Set
Read, write, edit, grep, glob, and run shell commands. Includes a todo plan tool.
Web Search & Fetch
Search the web via DuckDuckGo and fetch URL content.
Persistent Memory
Store and retrieve key-value memories across sessions.
MCP Support
Connect to MCP servers for custom tools and data sources.
Sub-Agents
Specialized agents for codebase investigation, code review, architecture, testing, and debugging.
Approval Flow
Six approval modes, from strict read-only to full autonomy.
Session Management
Save sessions, create checkpoints, and resume right where you left off.
OpenRouter
Built on OpenRouter. Authenticate once with relay login.
Approval Modes
Every mutating tool call passes through the approval flow first. The mode decides how much Relay asks about, from strictest to most permissive.
read-only
SafeRejects anything that is not known safe.
ask
Default SafeConfirms every mutating tool call.
auto-edit
SafeEdits freely, confirms shell commands.
on fail
CautionRuns freely and only asks after a failure.
auto
CautionRuns everything except dangerous commands.
yolo
DangerousApproves everything, including dangerous commands.
Set it with approval in .relay/config.toml, or switch mid-session with /approval <mode>.
Getting Started
-
Install Relay
pip install relay-code -
Log in
Authorize with OpenRouter in your browser (or paste an API key manually).
relay loginUse
relay login --pasteto enter an API key directly. -
Run it
relay # interactive moderelay "your prompt" # single-shot moderelay --cwd /path # run against a different directory
Usage
Interactive TUI
Launch the full-screen terminal UI for an interactive session.
relay
Single-Shot Mode
Run a single prompt without the interactive interface.
relay "Refactor the auth module"
Custom Working Directory
Point Relay at a different directory than your current one.
relay --cwd /path/to/project
Account Management
Log out to remove your saved API key.
relay logout
Tooling Architecture
Core
read: Read file contents with line numberswrite: Create or overwrite filesedit: Surgical text replacementgrep: Regex search across filesglob: Find files by patternshell: Execute shell commandslist_directories: List directory contentsplan: Todo list for task tracking
Sub-Agents
codebase_investigator: Explore code structurecode_reviewer: Review code for bugs and qualitysoftware_architect: Write and maintain clean codetest_writer: Write tests for edge casesdebugger: Find and fix bugs
Network
search: Web search via DuckDuckGofetch: Fetch URL content
Memory
memory: Store and retrieve persistent key-value data
MCP
- Connect to external MCP servers for custom tools and data
Commands
Slash Commands
/help: Show help/exitor/quit: Exit the agent/clear: Clear conversation history/config: Show current configuration/model <name>: Change the model/approval <mode>: Change approval mode/stats: Show session statistics/tools: List available tools/mcp: Show MCP server status
Session Management
/save: Save the current session/checkpoint [name]: Create a checkpoint/checkpoints: List available checkpoints/restore <checkpoint_id>: Restore a checkpoint/sessions: List saved sessions/resume <session_id>: Resume a saved session
License
Relay is licensed under the GNU General Public License v3.0.