Skip to main content

Overview

AgentCtrl provides a unified API that works across multiple CLI-based code agents. This enables typed runtime selection between Claude Code, OpenCode, Codex, Pi, and Gemini without changing the calling code. The default example verifies factory selection offline; set AGENT_CTRL_LIVE=1 to execute one selected backend with a bounded timeout. Key concepts:
  • AgentType enum: Specify which agent backend to use
  • Unified API: Same methods work across all agent types
  • Runtime selection: Choose agent dynamically based on configuration or logic
  • Optional live execution: Explicitly opt in to one CLI call

Example

Expected Output

Key Points

  • Unified API: Every backend is selected through AgentCtrl::make()
  • Typed selection: AgentType::tryFrom() rejects unknown configured values
  • Deterministic default: Factory selection is verified without launching external processes
  • Explicit live mode: AGENT_CTRL_LIVE=1 launches only the selected backend
  • Bounded execution: Live mode has a 30-second timeout