# How to Perform Channel-Specific Installation in Agent-Reach Using the `--channels` Flag

> Learn how to perform channel-specific installation in Agent-Reach using the --channels flag. Install only the platform back-ends you need and avoid unnecessary dependencies.

- Repository: [Pnant/Agent-Reach](https://github.com/Panniantong/Agent-Reach)
- Tags: how-to-guide
- Published: 2026-07-13

---

**The `--channels` flag in `agent-reach install` lets you select exactly which platform back-ends (such as Twitter, Reddit, or Bilibili) to install, avoiding unnecessary dependencies by mapping each channel name to a specific installer function defined in [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py).**

Agent-Reach is an open-source automation framework that supports multiple social media platforms through modular channel back-ends. Instead of installing every dependency by default, you can use **channel-specific installation** to deploy only the components you need. This guide explains how the `--channels` flag works according to the Panniantong/Agent-Reach source code.

## Understanding the `--channels` Flag Syntax

The CLI accepts a comma-separated list of channel identifiers that are parsed, stripped, and lower-cased at runtime. In [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py), the argument parsing occurs at **lines 75-78**, where the raw string is split into individual channel names before processing.

### Using the `all` Keyword

If you pass `--channels=all`, the installer automatically expands this keyword to every supported channel defined in the `CHANNEL_INSTALLERS` dictionary. This expansion logic is implemented at **lines 13-18** of [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py), ensuring you receive the complete set of available platform back-ends without manually listing each one.

## How Channel Installation Works Internally

The installation process follows a four-stage pipeline defined in the CLI source code.

### 1. Channel-to-Installer Mapping

At **lines 96-104** of [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py), the `CHANNEL_INSTALLERS` dictionary maps each valid channel name to its corresponding installer function. For example, `twitter` maps to the Twitter CLI installer (lines 102-122), while `bilibili` maps to its dedicated installer (lines 255-268).

### 2. Environment-Aware Filtering

When running on a server or VPS (detected via `--env=server` or automatic detection), the installer skips channels that require a desktop Chrome session. **Lines 30-35** of [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py) contain the logic that automatically removes `opencli`, `facebook`, and `instagram` from the installation list in headless environments to prevent execution errors.

### 3. Duplicate Removal and Execution

The installation loop at **lines 68-78** iterates over the requested channels, removes duplicates, and invokes each mapped installer function exactly once. This ensures idempotent installations even if you accidentally list the same channel twice in your command.

### 4. Automatic Cookie Import

For channels requiring browser authentication (Twitter, Bilibili, Xueqiu), the CLI automatically triggers cookie import routines after installation completes. This cleanup logic is located at **lines 84-90** of [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py).

## Practical Examples for Channel-Specific Installation

```bash

# Install only Twitter and Reddit (desktop environment)

agent-reach install --channels=twitter,reddit

# Install every supported channel (including OpenCLI-only ones)

agent-reach install --channels=all

# Install a subset on a server (OpenCLI-only channels will be auto-skipped)

agent-reach install --env=server --channels=twitter,facebook,instagram

```

**Explanation of the commands:**

- **`--channels=twitter,reddit`** – Installs the Twitter CLI and Reddit back-end. On desktop, Reddit uses `opencli`; on servers, it uses `rdt-cli`.
- **`--channels=all`** – Expands to all keys in `CHANNEL_INSTALLERS` plus cookie-only platforms like `xueqiu` and `linkedin`.
- **`--env=server`** – Triggers the environment detection logic at lines 30-35, which silently removes `facebook`, `instagram`, and `opencli` from the install list because they require a graphical Chrome session.

## Supported Channels and Their Implementation

The following channel names are valid arguments for the `--channels` flag:

- **`twitter`** – Installs `twitter-cli` (lines 102-122)
- **`reddit`** – Installs `rdt-cli` on servers or `opencli` on desktop (lines 197-215)
- **`xiaohongshu`** – Installs the Xiaohongshu back-end (lines 221-247)
- **`bilibili`** – Installs the Bilibili dependencies (lines 255-268)
- **`facebook`** – OpenCLI-only; requires desktop Chrome
- **`instagram`** – OpenCLI-only; requires desktop Chrome

## Summary

- **The `--channels` flag** accepts comma-separated values that are parsed at lines 75-78 of [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py).
- **The `all` keyword** expands to every supported channel via the auto-expand logic at lines 13-18.
- **Server environments** automatically skip OpenCLI-only channels (`facebook`, `instagram`, `opencli`) as implemented at lines 30-35.
- **Cookie handling** is automatic for browser-based channels (lines 84-90).
- **The `CHANNEL_INSTALLERS` dictionary** at lines 96-104 maps names to specific installer functions.

## Frequently Asked Questions

### What happens if I specify an invalid channel name?

The installation loop at lines 68-78 validates channel names against the `CHANNEL_INSTALLERS` dictionary defined at lines 96-104. Invalid or unsupported channels are ignored during processing, though the specific error handling depends on the validation logic implemented in your version of the CLI.

### Can I install OpenCLI-only channels on a headless server?

No. Channels marked as OpenCLI-only (`facebook`, `instagram`, `opencli`) require a desktop Chrome session. When `agent-reach install` detects a server environment (via `--env=server` or auto-detection), it automatically skips these channels at lines 30-35 of [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py) to prevent installation failures.

### Does the order of channels in the flag affect installation?

No. The installation loop processes channels sequentially but removes duplicates before execution (lines 68-78). The order does not affect the final installation state, though cookie import (lines 84-90) runs only after all installers complete successfully.

### How do I verify which channels installed correctly?

The [`agent_reach/doctor.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/doctor.py) module provides a `check_all` function that validates each installed channel after the installation completes, verifying that channel-specific dependencies are correctly configured and accessible in your environment.