A specialized AgentDriver that invokes the Google gemini CLI
tool. This is the preferred driver for workflows requiring local tool use
and filesystem interaction via the Google-native MCP bridge.
Details
Setup: Requires the gemini CLI to be installed and in your
PATH. You can override the binary path using:
options(HydraR.gemini_path = "/path/to/gemini") or by setting the
HYDRAR_GEMINI_PATH environment variable in your .Renviron.
Super class
HydraR::AgentDriver -> GeminiCLIDriver
Methods
Method new()
Initialize GeminiCLIDriver
Usage
GeminiCLIDriver$new(
id = "gemini_cli",
model = "gemini-2.5-flash",
validation_mode = "warning",
working_dir = NULL,
repo_root = NULL
)Arguments
idString. Unique identifier for this driver.
modelString. The Gemini model ID (e.g.,
"gemini-1.5-flash").validation_modeString. Either
"warning"or"strict".working_dirString. Optional. Path to an isolated git worktree where the CLI will execute.
repo_rootString. Optional. Path to the main repository to enable cross-worktree context. Call the LLM
Method call()
Usage
GeminiCLIDriver$call(
prompt,
model = NULL,
system_prompt = NULL,
cli_opts = list(),
...
)Examples
if (FALSE) { # \dontrun{
# 1. Standard CLI-based agent with model selection
driver <- GeminiCLIDriver$new(model = "gemini-1.5-pro")
# 2. Advanced call with MCP tool discovery and 'YOLO' mode enabled
# This allows the agent to execute tools without interactive confirmation.
response <- driver$call(
prompt = "Analyze the R scripts in this directory and suggest performance fixes.",
cli_opts = list(
allowed_tools = "ls,grep,read_file",
allowed_mcp_server_names = "filesystem,github",
yolo = TRUE,
include_directories = c("R", "tests")
)
)
} # }