惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
A
About on SuperTechFans
J
Java Code Geeks
量子位
博客园 - 三生石上(FineUI控件)
博客园 - Franky
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I Built a CLI Tool That Auto-Switches Between AI Agents W...
AiAgentCreat · 2026-04-28 · via DEV Community

AiAgentCreater

I Built a CLI Tool That Auto-Switches Between AI Agents When One Fails

Stop manually switching between Claude, OpenCode, Copilot, Codex, and Gemini. Let your CLI handle it.

The Problem

I was copy-pasting the same prompt into 5 different AI chat windows.

Claude was great for architecture, but when it hit rate limits, I had to switch to OpenCode. Then OpenCode had an outage, so I tried Copilot. Each switch meant:

  • Re-authenticating
  • Losing context
  • Wasting 2-3 minutes per switch
  • Getting frustrated

Sound familiar?

The Solution

I built agent-delegator — a Python CLI that monitors all your AI agents and automatically routes to the best available one.

No more manual switching. No more downtime. Just describe what you want and let the delegator pick the best agent.


What It Actually Does

1. Health Checks Every Agent

$ python -m agent_delegator health

[OK] claude: available=True, cli_found=True
[OK] opencode: available=True, cli_found=True
[OK] copilot: available=True, cli_found=True
[OK] codex: available=True, cli_found=True
[OK] antigravity: available=True, cli_found=True

Enter fullscreen mode Exit fullscreen mode

Every 30 seconds, it pings all agents. If one goes down, it's marked unhealthy and skipped.

2. Smart Routing Based on Task Type

$ python -m agent_delegator routes

subagent-driven/implementation -> opencode:federated-coding
subagent-driven/testing -> opencode:federated-coding
subagent-driven/code_review -> opencode:federated-coding
subagent-driven/research -> claude:federated-sonnet
brainstorming/requirements -> claude:claude-sonnet-4-6
brainstorming/architecture -> claude:federated-sonnet
brainstorming/design -> claude:claude-sonnet-4-6
verification/testing -> opencode:federated-coding
verification/linting -> opencode:federated-free
verification/security_audit -> claude:claude-sonnet-4-6

Enter fullscreen mode Exit fullscreen mode

Code review → Claude. Implementation → OpenCode. Testing → OpenCode. You define the routing matrix, the delegator follows it.

3. Automatic Failover

$ python -m agent_delegator status

=== delegator status ===
Agents: ['claude', 'opencode', 'copilot', 'codex', 'antigravity']
Active cooldowns: 0
Recent delegations: 5
  [OK] opencode:minimax-m2.5-free - implementation
  [OK] opencode:minimax-m2.5-free - implementation
  [OK] opencode:minimax-m2.5-free - implementation
  [OK] opencode:minimax-m2.5-free - implementation
  [FAIL] opencode:minimax-m2.5-free - implementation
7-day success rate: 80.0%

Enter fullscreen mode Exit fullscreen mode

When OpenCode fails (see that [FAIL]?), it instantly falls back to the next agent in the priority list. No manual intervention.


Features

Feature What It Does
Federated Failover Auto-switches to next best agent on failure
Intelligent Routing Different tasks → different agents based on config
Health Monitoring Continuously checks if agents are online
Circuit Breaker Temporarily disables failing agents (cooldowns)
Auto-Learning Optimizes agent rankings based on success rates
Real-Time Dashboard Local web UI at http://127.0.0.1:8765
Metrics Tracking Success rates, duration, fallback counts per agent
Zero Cloud 100% local — no data leaves your machine

How to Use It

Install

pip install agent-delegator

Enter fullscreen mode Exit fullscreen mode

Configure (one-time)

python -m agent_delegator init

Enter fullscreen mode Exit fullscreen mode

This creates .agent-delegator.json in your project:

{
  "agents": ["claude", "opencode", "copilot", "codex", "antigravity"],
  "routes": {
    "implementation": ["opencode", "claude"],
    "code_review": ["claude", "opencode"],
    "testing": ["opencode"]
  }
}

Enter fullscreen mode Exit fullscreen mode

Run a Task

python -m agent_delegator exec "Write a Python function to parse JSONL files"

Enter fullscreen mode Exit fullscreen mode

The delegator will:

  1. Check which agents are healthy
  2. Pick the best one for "implementation" tasks
  3. Run the task
  4. Track success/failure
  5. Show results

Launch Dashboard

python -m agent_delegator dashboard

Enter fullscreen mode Exit fullscreen mode

Opens Mission Control at http://127.0.0.1:8765:

  • Live task monitor
  • Agent health cards with success rates
  • Delegation history with replay
  • Cost tracking
  • A/B model comparison

Supported Agents

Agent CLI Command Best For
Claude claude Architecture, security reviews
OpenCode opencode Implementation, testing
GitHub Copilot copilot Inline code completion
Codex codex Quick prototyping
Gemini antigravity Research, exploration

Adding a new agent takes 2 lines in the config.


Why I Built This

I was tired of:

  • Rate limits interrupting my flow
  • Downtime breaking my CI/CD pipeline
  • Manual switching wasting 10-15 minutes per session
  • Losing context when changing agents

Now I just run one command and the delegator handles everything.


Try It

pip install agent-delegator
python -m agent_delegator init
python -m agent_delegator exec "Your task here"

Enter fullscreen mode Exit fullscreen mode

GitHub: https://github.com/amardeep434/agent-delegator

PyPI: https://pypi.org/project/agent-delegator/


What's Next

  • [ ] Webhook notifications (Slack, Telegram)
  • [ ] Cost optimization (pick cheapest capable agent)
  • [ ] Multi-modal support (images, documents)
  • [ ] Team sharing (shared routing configs)

Built with Python and too much coffee ☕

What's your agent switching workflow? Do you use multiple AI agents or stick to one?