Skip to main content

Overview

AgentCtrl provides a unified API that works across multiple CLI-based code agents. This enables runtime switching between different backends (Claude Code, OpenCode, Codex, Pi) without changing your application code. Useful for comparing agent performance, failover scenarios, or A/B testing. 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
  • AgentCtrlConsoleLogger: Shared logger works across all agent types

Example

Expected Output

Key Points

  • Unified API: Same interface across all agent backends
  • Shared logger: One AgentCtrlConsoleLogger works across all agent types, prefixing output with [opencode], [claude-code], etc.
  • Runtime selection: Choose agent dynamically based on requirements
  • Agent comparison: Run the same prompt across multiple agents to compare
  • Failover capability: Try alternative agents if primary fails
  • Agent-specific tuning: Apply configuration based on agent characteristics
  • Performance comparison: Measure response time and cost across agents
  • Use cases: A/B testing, load balancing, fallback strategies, feature parity testing