Skip to main content

Crate ralph_adapters

Crate ralph_adapters 

Source
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§

AssistantMessage
Message content from Claude’s assistant responses.
ClaudeStreamParser
Parses NDJSON lines from Claude’s stream output.
CliBackend
A CLI backend configuration for executing prompts.
CliExecutor
Executor for running prompts through CLI backends.
ConsoleStreamHandler
Writes streaming output to stdout/stderr.
CtrlCState
State machine for double Ctrl+C detection.
CustomBackendError
Error when creating a custom backend without a command.
ExecutionResult
Result of a CLI execution.
NoBackendError
Error returned when no backends are available.
PrettyStreamHandler
Renders streaming output with colors and markdown.
PtyConfig
Configuration for PTY execution.
PtyExecutionResult
Result of a PTY execution.
PtyExecutor
Executor for running prompts in a pseudo-terminal.
QuietStreamHandler
Suppresses all streaming output (for CI/silent mode).
SessionResult
Session completion result data.
TuiStreamHandler
Renders streaming output as ratatui Lines for TUI display.
Usage
Token usage statistics.
UserMessage
Message content from tool results (user turn).

Enums§

ClaudeStreamEvent
Events emitted by Claude’s --output-format stream-json.
ContentBlock
Content blocks in assistant messages.
CtrlCAction
Action to take after handling Ctrl+C.
OutputFormat
Output format supported by a CLI backend.
PromptMode
How to pass prompts to the CLI tool.
TerminationType
How the PTY process was terminated.
UserContentBlock
Content blocks in user messages (tool results).

Constants§

DEFAULT_PRIORITY
Default priority order for backend detection.

Traits§

StreamHandler
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.