How to Set Up a Network Proxy for Restricted Environments in Agent Reach

Agent Reach stores proxy settings in ~/.agent-reach/config.yaml and automatically exports them as HTTP_PROXY and HTTPS_PROXY environment variables for all downstream network calls.

Agent Reach is an open-source automation framework that routes traffic through external command-line tools like twitter-cli, rdt-cli, and yt-dlp. According to the source code in Panniantong/Agent-Reach, you can configure a network proxy that the agent transparently applies to all outbound HTTP(S) requests when operating behind corporate firewalls or regional restrictions.

How Proxy Configuration Works in Agent Reach

Configuration Storage

All user-defined settings are managed by the Config class in agent_reach/config.py. The proxy URL is persisted to the per-user YAML file located at ~/.agent-reach/config.yaml under the proxy key (and the legacy bilibili_proxy key for backward compatibility).

Runtime Environment Injection

During runtime, each channel that needs outbound HTTP(S) traffic reads the proxy entry via Config.get() and exports it as the environment variables HTTP_PROXY and HTTPS_PROXY. This makes the proxy transparent to the agent: downstream binaries automatically pick up these variables without requiring extra flags.

Command-Line Configuration Methods

Install with Proxy

When installing Agent Reach in a restricted environment, pass the proxy URL directly to the installer. The CLI parses the --proxy argument in agent_reach/cli.py (lines 68-70) and persists it using config.set("proxy", args.proxy) and config.set("bilibili_proxy", args.proxy) (lines 228-236):

agent-reach install --proxy http://user:pass@203.0.113.10:3128

Update Existing Configuration

If Agent Reach is already installed, use the dedicated configuration command. This triggers the same persistence logic located in agent_reach/cli.py (lines 1040-1046), writing the value to the configuration file without requiring a full reinstall:

agent-reach configure proxy http://user:pass@203.0.113.10:3128

Verifying Your Proxy Setup

Check the Configuration File

Confirm the proxy was saved correctly by inspecting the YAML file:

cat ~/.agent-reach/config.yaml

You should see output similar to:

proxy: http://user:pass@203.0.113.10:3128
bilibili_proxy: http://user:pass@203.0.113.10:3128

Programmatic Access

For custom scripts or debugging, access the proxy setting directly through the Python API. The Config.get() method (lines 69-77 in agent_reach/config.py) first checks the in-memory dictionary, then falls back to environment variables:

from agent_reach.config import Config
import os

cfg = Config()
proxy = cfg.get("proxy")

if proxy:
    os.environ["HTTP_PROXY"] = proxy
    os.environ["HTTPS_PROXY"] = proxy

# Downstream tools will now route through the configured proxy.

Summary

  • Agent Reach stores proxy settings in ~/.agent-reach/config.yaml under the proxy key.
  • The Config class in agent_reach/config.py manages loading and retrieval, with fallback support for HTTP_PROXY and HTTPS_PROXY environment variables.
  • Use agent-reach install --proxy <URL> during setup or agent-reach configure proxy <URL> to update existing installations.
  • The proxy automatically exports as HTTP_PROXY and HTTPS_PROXY for all channel operations, ensuring tools like yt-dlp and twitter-cli route through your restricted network gateway.

Frequently Asked Questions

How does Agent Reach handle proxy authentication?

Agent Reach stores the full proxy URL including credentials in ~/.agent-reach/config.yaml. When the Config class retrieves this value, it exports the complete URL (e.g., http://user:pass@ip:port) to the HTTP_PROXY and HTTPS_PROXY environment variables, which standard HTTP libraries and CLI tools parse automatically for basic authentication.

Can I override the proxy setting with environment variables?

Yes. The Config.get() method in agent_reach/config.py checks for uppercase environment variables as fallbacks. If you set HTTP_PROXY or HTTPS_PROXY in your shell before running Agent Reach, those values take precedence over the configuration file entries.

Why is there both a proxy and bilibili_proxy key in the config?

The bilibili_proxy key exists for backward compatibility with earlier versions of Agent Reach. As implemented in agent_reach/cli.py, the CLI writes the proxy URL to both keys to ensure legacy channel implementations still recognize the setting, while new code uses the standardized proxy key.

Does the proxy configuration apply to all channels?

Yes. The proxy is exported as global environment variables before any upstream tool is invoked. This ensures that all channels—including Reddit (rdt-cli), Twitter (twitter-cli), and YouTube (yt-dlp)—automatically route their traffic through the configured proxy without individual channel modifications.

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 →