Skip to content

Agent Overview

Ralph supports multiple AI coding agents through a provider abstraction. Each provider maps ralph’s needs onto the agent’s CLI interface, so the loop works identically regardless of which agent you choose.

AgentBinaryPrint ModeJSON OutputMax Turns
Claude Codeclaude-p--output-format stream-json--max-turns N
Gemini CLIgemini-p--output-format stream-jsonN/A
Codex CLIcodexexec subcommand--jsonN/A
Continuecn-p--output-format stream-json--max-turns N
Cursorcursor-p--output-format stream-jsonN/A

Every provider supplies:

CapabilityDescription
binaryCLI executable name
buildArgs(prompt, options)Construct the argument array for a headless invocation
outputFormatHow to request structured output
supportsMaxTurnsWhether the agent accepts a max-turns limit
supportsSystemPromptWhether the agent accepts a system prompt via CLI
parseOutput(stream)Normalize output into ralph’s internal event format

Set the agent in ralph.config.json:

{
"agent": "claude"
}

Or override per-run:

Terminal window
pnpm dlx @smplcty/ralph loop --agent gemini

During ralph init, the agent is auto-detected based on which CLIs are installed (preference: claude → gemini → codex → continue → cursor).

For agents that don’t support --max-turns, ralph relies on its timeout mechanism to bound iteration length. The complexity scaling tiers still apply to timeout values.