How to Check Channel Availability in the Doctor Module of Agent-Reach

The doctor module aggregates channel health by calling check_all() to return a dictionary of status codes, then renders a human-readable report with format_report().

The doctor module serves as the central health-checking component in the Panniantong/Agent-Reach repository. When you need to check channel availability in the doctor module, you invoke a lightweight diagnostic system that iterates over registered channels without performing any network calls itself. This architecture delegates actual connectivity tests to individual channel classes while providing a unified interface for monitoring system status.

Understanding the Doctor Module Architecture

The doctor module operates as a diagnostic aggregator located in agent_reach/doctor.py. It does not perform network calls directly; instead, it relies on each channel implementation (Twitter, Reddit, YouTube, etc.) to expose a check(config) method that returns a tuple of (status, message).

According to the source code, the module imports channel definitions from agent_reach/channels/ and config management from agent_reach/config.py. Each concrete channel inherits from BaseChannel defined in agent_reach/channels/base.py and implements its own validation logic.

How to Check Channel Availability Programmatically

Using check_all() to Retrieve Status Data

The check_all() function in agent_reach/doctor.py (lines 12-24) walks through every channel returned by get_all_channels(), invokes their check method, and aggregates results into a dictionary keyed by channel name.

from agent_reach.config import Config
from agent_reach.doctor import check_all, format_report

# Load the user's configuration (reads ~/.agent-reach/config.yaml)

cfg = Config.load()

# Get raw availability data for every channel

availability = check_all(cfg)

# Print the raw dict (useful for scripting)

print(availability)

The function signature returns Dict[str, dict] containing fields for status, description, message, tier, and backends for each channel.

Rendering Reports with format_report()

The format_report() function in agent_reach/doctor.py (lines 27-110) transforms the raw dictionary into a color-coded Rich markup string suitable for terminal display.

from agent_reach.config import Config
from agent_reach.doctor import check_all, format_report
from rich.console import Console

cfg = Config.load()
results = check_all(cfg)          # ← dict with status per channel

report = format_report(results)   # ← Rich-markup string

console = Console()
console.print(report)             # Shows a colour-coded status overview

This output groups channels by tier, displays status icons, and highlights security warnings when present.

Interpreting Channel Status Codes

When you check channel availability in the doctor module, each channel returns one of three status strings:

  • "ok" — Channel is fully functional and properly configured
  • "warn" — Channel is installed but requires configuration or login credentials
  • "off" or "error" — Channel is missing dependencies or misconfigured

The aggregation logic in check_all() stores these codes alongside descriptive messages to help diagnose specific configuration issues.

CLI Usage for Quick Diagnostics

For immediate terminal output without writing Python code, use the built-in CLI entry point:

python -m agent_reach.cli doctor

The CLI internally executes the same logic as the programmatic example:

from agent_reach.config import Config
from agent_reach.doctor import check_all, format_report
from rich.console import Console

cfg = Config.load()
Console().print(format_report(check_all(cfg)))

Running this command produces a formatted report showing available channels, configuration warnings, and optional channels that can be unlocked.

Summary

  • The doctor module in agent_reach/doctor.py provides centralized health checking without performing network calls itself
  • check_all() iterates through registered channels and returns a dictionary with status codes and metadata
  • format_report() converts the raw dictionary into a human-readable, color-coded terminal report
  • Status codes follow a three-tier system: "ok" (ready), "warn" (needs config), and "off"/"error" (unavailable)
  • Both programmatic APIs and CLI commands (python -m agent_reach.cli doctor) leverage the same underlying functions

Frequently Asked Questions

How does the doctor module check channel availability without making network calls?

The doctor module delegates all connectivity validation to individual channel classes. When check_all() runs, it calls the check(config) method on each channel instance located in agent_reach/channels/. Each channel implementation handles its own validation logic, allowing the doctor to remain a lightweight aggregator that simply collects and formats results.

What information does the check_all() function return?

The function returns a dictionary mapping channel names to dictionaries containing five fields: status (the availability code), description (human-readable channel info), message (specific error or success text), tier (classification group), and backends (supported platform identifiers). This structure enables both programmatic filtering and detailed reporting.

Can I check channel availability for a specific subset of channels?

The current implementation in agent_reach/doctor.py checks all registered channels via get_all_channels(). To check specific channels, you would filter the resulting dictionary after calling check_all(), or import individual channel classes directly from agent_reach/channels/ and call their check() methods with a Config instance.

Where does the doctor module load configuration from?

The module relies on Config.load() from agent_reach/config.py, which reads the user configuration file located at ~/.agent-reach/config.yaml. This configuration object passes credentials and settings to each channel's check() method during the availability verification process.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →