How Agent Reach's Multi-Backend Routing Keeps Your AI Agent's Internet Access Working
Problem
Platform access tools break frequently. APIs change, anti-scraping measures evolve, CLI tools get abandoned. When I used yt-dlp to read Bilibili video subtitles, it worked for months — until Bilibili’s risk control system 412-blocked it.
I didn’t want to manually track which tool works for which platform. I wanted the system to handle it.
How Multi-Backend Routing Works
Agent Reach solves this with ordered backend lists. Each platform channel defines multiple backends in priority order:
class Channel(ABC): name: str = "" backends: List[str] = [] active_backend: Optional[str] = None
def ordered_backends(self, config=None) -> List[str]: candidates = list(self.backends) override = config.get(f"{self.name}_backend") if config else None if override: for i, b in enumerate(candidates): if b == override or b.startswith(override): candidates.insert(0, candidates.pop(i)) break return candidatesThe check() method doesn’t just check if a binary exists via shutil.which(). It really probes each backend by running commands and parsing output. The first backend returning “ok” becomes active.
Real-World Example: Bilibili
Here’s the Bilibili channel’s backend configuration:
backends = ["bili-cli", "OpenCLI", "B站搜索 API"]When Bilibili 412-blocked yt-dlp in June 2026, yt-dlp was removed from the backend list entirely (documented in a comment at the top of the file). The new primary bili-cli was already in position. Users experienced zero disruption — the system had already switched.
Bilibili backends (June 2026):┌──────────┐ ┌──────────┐ ┌──────────┐│ bili-cli │ → │ OpenCLI │ → │Search API││ (active) │ │ (fallback)│ │(last resort)└──────────┘ └──────────┘ └──────────┘Twitter’s Backend Chain
backends = ["twitter-cli", "OpenCLI", "bird CLI (legacy)"]Twitter’s probe has a two-stage check: it collects all candidates first, then prefers “ok” over “warn”. This prevents an installed-but-not-logged-in twitter-cli from blocking a working OpenCLI.
Environment-Aware Routing: XiaoHongShu
backends = ["OpenCLI", "xiaohongshu-mcp", "xhs-cli (xiaohongshu-cli)"]On desktop, OpenCLI reuses your Chrome browser session — zero friction. On a server, OpenCLI naturally fails the probe (no desktop Chrome), so xiaohongshu-mcp (headless browser) takes over. The routing is environment-aware without hardcoding environment checks.
Backend Override
If you need to force a specific backend:
agent-reach configure twitter_backend "OpenCLI"agent-reach doctor --jsonUnknown override values are ignored. This prevents stale configs from hiding working backends.
Summary
In this post, I explained how Agent Reach’s multi-backend routing keeps your AI agent’s internet access working even when individual tools break. The key point is that each platform has an ordered list of backends, and check() probes each one by real command execution. Platform changes are handled at the routing layer — no reconfiguration needed, no disruption, zero user action.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 Agent Reach GitHub Repository
- 👨💻 Agent Reach Channel Base Class
- 👨💻 Agent Reach Bilibili Channel
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments