Gemini Agent
Integrate Google's Gemini CLI with Ralph TUI for AI-assisted coding.
Gemini Agent
The Gemini agent plugin integrates with Google's gemini-cli CLI to execute AI coding tasks. It supports YOLO mode for autonomous operation and streaming JSONL output for subagent tracing.
Gemini supports subagent tracing via stream-json output - Ralph TUI can show tool calls in real-time as Gemini works.
Prerequisites
Install Gemini CLI:
Verify installation:
Basic Usage
Run with Gemini
Use the --agent gemini flag:
Select a Model
Override the model with --model:
Enable YOLO Mode
Configure auto-approve in config:
Configuration
Shorthand Config
The simplest configuration:
Full Config
For advanced control:
Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
model | string | - | Gemini model: gemini-2.5-pro, gemini-2.5-flash |
yoloMode | boolean | true | Skip approval prompts for autonomous operation |
timeout | number | 0 | Execution timeout in ms (0 = no timeout) |
command | string | "gemini-cli" | Path to Gemini CLI executable |
Models
Gemini CLI supports these model variants:
| Model | Description | Use Case |
|---|---|---|
gemini-2.5-pro | Most capable | Complex tasks, architecture decisions |
gemini-2.5-flash | Fast and efficient | Quick tasks, rapid iteration |
Select via CLI or config:
YOLO Mode
When yoloMode is enabled (default), Gemini will skip approval prompts and auto-approve all actions. This is required for Ralph TUI's autonomous operation since it cannot relay interactive prompts.
YOLO mode is named after Gemini CLI's --yolo flag. Despite the name, it's essential for automated workflows.
Subagent Tracing
Gemini emits structured JSONL via --output-format stream-json (always enabled). Ralph TUI parses this to display:
- Tool invocations and their output
- Duration and status of each operation
- Nested operations and their hierarchy
Enabling Tracing
Or toggle in TUI:
- Press
tto cycle through detail levels - Press
T(Shift+T) to toggle the subagent tree panel
How It Works
When Ralph TUI executes a task with Gemini:
- Build command: Constructs
gemini-cli [options] - Pass prompt via stdin: Avoids shell escaping issues with special characters
- Stream output: Captures stdout/stderr in real-time
- Parse JSONL: Extracts structured tool call data (always enabled)
- Detect completion: Watches for completion token
- Handle exit: Reports success, failure, or timeout
CLI Arguments
Ralph TUI builds these arguments:
Model Validation
Gemini agent validates that model names start with gemini-:
Troubleshooting
"Gemini CLI not found"
Ensure Gemini is installed and in your PATH:
If you still use a legacy gemini binary, Ralph TUI accepts it as a fallback alias.
"Invalid model"
Ensure your model name starts with gemini-:
"Execution timeout"
Increase the timeout for complex tasks:
Next Steps
- Claude Agent - Anthropic's Claude Code
- Codex Agent - OpenAI's Codex CLI
- Configuration - Full options reference