[`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)
Module Contents
Section titled “Module Contents”Classes
Section titled “Classes”LocalCLIConfig | Configuration for a CLI-based coding agent. |
|---|---|
LocalCLIRunner | Universal 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.
command : str
Section titled “command : str”None
task_flag : str
Section titled “task_flag : str”None
subcommand : str | None
Section titled “subcommand : str | None”None
auth_env : list[str]
Section titled “auth_env : list[str]”‘field(…)’
auto_approve : str | None
Section titled “auto_approve : str | None”None
structured_output : str | None
Section titled “structured_output : str | None”None
model_flag : str | None
Section titled “model_flag : str | None”None
default_model : str | None
Section titled “default_model : str | None”None
working_dir_flag : str | None
Section titled “working_dir_flag : str | None”None
additional_flags : list[str]
Section titled “additional_flags : list[str]”‘field(…)’
timeout : int
Section titled “timeout : int”300
name : str =
Section titled “name : str = ”description : str =
Section titled “description : str = ”install_cmd : str =
Section titled “install_cmd : str = ”docs_url : str =
Section titled “docs_url : str = ”notes : str =
Section titled “notes : str = ”class agentic_crew.runners.local_cli_runner.LocalCLIRunner(profile: str | agentic_crew.runners.local_cli_runner.LocalCLIConfig | dict[str, Any], model: str | None = None)
Section titled “class agentic_crew.runners.local_cli_runner.LocalCLIRunner(profile: str | agentic_crew.runners.local_cli_runner.LocalCLIConfig | dict[str, Any], model: str | None = None)”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:
Use built-in profile
Section titled “Use built-in profile”runner = LocalCLIRunner(“aider”) result = runner.run(“Add error handling to auth.py”)
# Use custom configconfig = LocalCLIConfig( command="my-tool", task_flag="--task", auto_approve="--yes",)runner = LocalCLIRunner(config)result = runner.run("Fix the bug")Initialization
Section titled “Initialization”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).
_profiles_cache : dict[str, agentic_crew.runners.local_cli_runner.LocalCLIConfig] | None
Section titled “_profiles_cache : dict[str, agentic_crew.runners.local_cli_runner.LocalCLIConfig] | None”None
classmethod _load_profiles() → dict[str, agentic_crew.runners.local_cli_runner.LocalCLIConfig]
Section titled “classmethod _load_profiles() → dict[str, agentic_crew.runners.local_cli_runner.LocalCLIConfig]”Load CLI profiles from local_cli_profiles.yaml.
Returns: Dict mapping profile names to LocalCLIConfig objects.
classmethod get_available_profiles() → list[str]
Section titled “classmethod get_available_profiles() → list[str]”Get list of available profile names.
Returns: List of profile names that can be used.
is_available() → bool
Section titled “is_available() → bool”Check if the CLI tool is available (installed and accessible).
Returns: True if the command exists in PATH.
get_required_env_vars() → list[str]
Section titled “get_required_env_vars() → list[str]”Get list of required environment variables.
Returns: List of environment variable names from config.auth_env.
run(task: str, working_dir: str | None = None, auto_approve: bool = True, structured_output: bool = False, model: str | None = None, **kwargs: Any) → str
Section titled “run(task: str, working_dir: str | None = None, auto_approve: bool = True, structured_output: bool = False, model: str | None = None, **kwargs: Any) → str”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_command(task: str, working_dir: str | None, auto_approve: bool, structured_output: bool, model: str | None) → list[str]
Section titled “_build_command(task: str, working_dir: str | None, auto_approve: bool, structured_output: bool, model: str | None) → list[str]”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.