agentic_fabric.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¶
Classes¶
Configuration for a CLI-based coding agent. |
|
Universal runner for CLI-based coding agents. |
API¶
- class agentic_fabric.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 = None¶
- task_flag: str = None¶
- subcommand: str | None = None¶
- auth_env: list[str] = 'field(...)'¶
- auto_approve: str | None = None¶
- structured_output: str | None = None¶
- model_flag: str | None = None¶
- default_model: str | None = None¶
- working_dir_flag: str | None = None¶
- additional_flags: list[str] = 'field(...)'¶
- timeout: int = 300¶
- name: str = <Multiline-String>¶
- description: str = <Multiline-String>¶
- install_cmd: str = <Multiline-String>¶
- docs_url: str = <Multiline-String>¶
- notes: str = <Multiline-String>¶
- class agentic_fabric.runners.local_cli_runner.LocalCLIRunner(profile: str | agentic_fabric.runners.local_cli_runner.LocalCLIConfig | dict[str, Any], model: str | None = None)¶
Bases:
agentic_fabric.runners.single_agent_runner.SingleAgentRunnerUniversal 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 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")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).
- classmethod get_available_profiles() list[str]¶
Get list of available profile names.
Returns: List of profile names that can be used.
- 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]¶
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¶
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.
- runner_name: str = 'single_agent'¶
- agent_capabilities: ClassVar[collections.abc.Mapping[str, agentic_fabric.capabilities.AgentCapabilitySpec]] = None¶
- agent_capability_methods: ClassVar[collections.abc.Mapping[str, str]] = None¶
- classmethod list_capabilities(*, kind: str | None = None) tuple[agentic_fabric.capabilities.AgentCapabilitySpec, ...]¶
- call_capability(name: str, *args: Any, **kwargs: Any) Any¶
- capability_map() collections.abc.Mapping[str, agentic_fabric.capabilities.AgentCapabilitySpec]¶