Expand description
§ralph-adapters
Agent adapters for the Ralph Orchestrator framework.
This crate provides implementations for various AI agent backends:
- Claude (Anthropic)
- Gemini (Google)
- Codex (OpenAI)
- Amp
- Custom commands
Each adapter implements the common CLI executor interface.
§Auto-Detection
When config specifies agent: auto, the auto_detect module handles
detecting which backends are available in the system PATH.
§PTY Mode
The pty_executor module provides PTY-based execution for Claude CLI,
preserving rich terminal UI features (colors, spinners, animations) while
allowing Ralph to orchestrate iterations. Supports interactive mode (user
input forwarded) and observe mode (output-only).
Re-exports§
pub use pty_handle::ControlCommand;pub use pty_handle::PtyHandle;
Modules§
- pty_
handle - PTY handle abstraction for TUI integration.
Structs§
- Assistant
Message - Message content from Claude’s assistant responses.
- Claude
Stream Parser - Parses NDJSON lines from Claude’s stream output.
- CliBackend
- A CLI backend configuration for executing prompts.
- CliExecutor
- Executor for running prompts through CLI backends.
- Console
Stream Handler - Writes streaming output to stdout/stderr.
- CtrlC
State - State machine for double Ctrl+C detection.
- Custom
Backend Error - Error when creating a custom backend without a command.
- Execution
Result - Result of a CLI execution.
- NoBackend
Error - Error returned when no backends are available.
- Pretty
Stream Handler - Renders streaming output with colors and markdown.
- PtyConfig
- Configuration for PTY execution.
- PtyExecution
Result - Result of a PTY execution.
- PtyExecutor
- Executor for running prompts in a pseudo-terminal.
- Quiet
Stream Handler - Suppresses all streaming output (for CI/silent mode).
- Session
Result - Session completion result data.
- TuiStream
Handler - Renders streaming output as ratatui Lines for TUI display.
- Usage
- Token usage statistics.
- User
Message - Message content from tool results (user turn).
Enums§
- Claude
Stream Event - Events emitted by Claude’s
--output-format stream-json. - Content
Block - Content blocks in assistant messages.
- CtrlC
Action - Action to take after handling Ctrl+C.
- Output
Format - Output format supported by a CLI backend.
- Prompt
Mode - How to pass prompts to the CLI tool.
- Termination
Type - How the PTY process was terminated.
- User
Content Block - Content blocks in user messages (tool results).
Constants§
- DEFAULT_
PRIORITY - Default priority order for backend detection.
Traits§
- Stream
Handler - Handler for streaming output events from Claude.
Functions§
- detect_
backend - Detects the first available backend from a priority list.
- detect_
backend_ default - Detects a backend using default priority and all adapters enabled.
- is_
backend_ available - Checks if a backend is available by running its version command.