Skip to content

[`agentic_crew.runners.local_cli_runner`](#module-agentic_crew.runners.local_cli_runner)

Universal local CLI runner for single-agent coding tools.

This runner provides a universal interface for any CLI-based coding agent, eliminating the need to write custom runners for each tool. Just define the CLI flags in local_cli_profiles.yaml and it works.

Supported tools (via profiles):

  • Aider: AI pair programming
  • Claude Code: Anthropic’s coding agent
  • OpenAI Codex: OpenAI’s local agent
  • Ollama: Free local LLMs (codellama, deepseek-coder, etc.)
  • Custom: Define your own tool’s CLI flags

Benefits:

  • Zero code to add new agents
  • Consistent interface across all tools
  • Automatic auth env var handling
  • Configurable modes (auto-approve, structured output)
LocalCLIConfigConfiguration for a CLI-based coding agent.
LocalCLIRunnerUniversal runner for CLI-based coding agents.

class agentic_crew.runners.local_cli_runner.LocalCLIConfig

Section titled “class agentic_crew.runners.local_cli_runner.LocalCLIConfig”

Configuration for a CLI-based coding agent.

This defines how to invoke any CLI tool that can execute coding tasks. All fields map to the tool’s command-line interface.

None

None

None

‘field(…)’

None

None

None

None

None

‘field(…)’

300

Bases: agentic_crew.runners.single_agent_runner.SingleAgentRunner

Universal runner for CLI-based coding agents.

This runner can invoke any CLI tool that accepts a task/prompt and executes it. Configuration is done via profiles (built-in or custom).

Examples:

runner = LocalCLIRunner(“aider”) result = runner.run(“Add error handling to auth.py”)

# Use custom config
config = LocalCLIConfig(
command="my-tool",
task_flag="--task",
auto_approve="--yes",
)
runner = LocalCLIRunner(config)
result = runner.run("Fix the bug")

Initialize the runner with a profile or custom config.

Args: profile: Profile name (e.g., “aider”), LocalCLIConfig object, or dict of config parameters. model: Optional model override (if tool supports model selection).

None

Load CLI profiles from local_cli_profiles.yaml.

Returns: Dict mapping profile names to LocalCLIConfig objects.

Get list of available profile names.

Returns: List of profile names that can be used.

Check if the CLI tool is available (installed and accessible).

Returns: True if the command exists in PATH.

Get list of required environment variables.

Returns: List of environment variable names from config.auth_env.

Execute a task using the configured CLI tool.

Args: task: The task to execute (e.g., “Add error handling”). working_dir: Optional working directory for execution. auto_approve: Whether to auto-approve changes (if supported). structured_output: Whether to request JSON output (if supported). model: Optional model override. **kwargs: Additional tool-specific arguments.

Returns: Tool output as a string.

Raises: RuntimeError: If tool execution fails or required env vars missing. subprocess.TimeoutExpired: If execution exceeds timeout.

Build the command array for subprocess.run.

Args: task: The task to execute. working_dir: Optional working directory. auto_approve: Whether to include auto-approve flag. structured_output: Whether to include structured output flag. model: Optional model to use.

Returns: Command as list of strings.