# How to Configure a Proxy for Restricted Network Environments in Agent Reach

> Easily configure proxy settings for restricted network environments in Agent Reach. Learn how to use config files and CLI commands to export HTTP/HTTPS proxy variables for seamless tool integration.

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

---

**Agent Reach supports HTTP and HTTPS proxies via a user-specific configuration file and CLI commands that export `HTTP_PROXY` and `HTTPS_PROXY` environment variables to downstream tools.**

Agent Reach, an open-source automation framework hosted at `Panniantong/Agent-Reach`, enables agents to interact with external services like YouTube, Twitter, and Reddit. When operating behind corporate firewalls or restricted networks, you must configure proxy settings so these agents can reach external APIs successfully.

## Where Agent Reach Stores Proxy Settings

Agent Reach persists runtime configuration in a per-user YAML file located at `~/.agent-reach/config.yaml`. The **`Config`** class in [`agent_reach/config.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py) manages this file, providing generic `set()` and `get()` methods that handle the `proxy` key and the legacy `bilibili_proxy` key for backward compatibility.

When you set a proxy value, the `Config.set(key, value)` method updates the in-memory dictionary and immediately persists the change via `Config.save()`.

## CLI Methods to Configure the Proxy

The [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py) module exposes two entry points for setting proxy values depending on whether you are performing initial setup or updating an existing configuration.

### Method 1: Configure During Installation

Use the **`--proxy`** flag with the `install` sub-command to bake the proxy setting into your initial configuration. The parser defines this flag at lines 68-71, and the `_cmd_install` handler (lines 36-44) writes the supplied string to both the `proxy` and `bilibili_proxy` keys.

```bash
agent-reach install --proxy "http://user:pass@proxy.example.com:8080"

```

### Method 2: Configure After Installation

If you need to add or update a proxy on an existing installation, use the **`configure`** sub-command. The `_cmd_configure` handler (lines 62-70) accepts a key-value pair and stores the proxy string under the same dual-key scheme without requiring a full reinstall.

```bash
agent-reach configure proxy "http://user:pass@proxy.example.com:8080"

```

## How Downstream Tools Consume the Proxy

Agent Reach does not perform network operations directly; instead, it acts as a configuration broker for external utilities. When agents spawn processes for channels such as `youtube`, `twitter`, or `reddit`, they retrieve the proxy value via `Config.get("proxy")` and export it as the **`HTTP_PROXY`** and **`HTTPS_PROXY`** environment variables. This lightweight design avoids hard-coding proxy libraries while ensuring that curl-based and request-based tools respect your network restrictions.

## Verifying Your Proxy Configuration

After configuration, inspect the YAML file to confirm the values are stored correctly:

```bash
cat ~/.agent-reach/config.yaml

```

Expected output:

```yaml
proxy: http://user:pass@proxy.example.com:8080
bilibili_proxy: http://user:pass@proxy.example.com:8080

```

## Summary

- Agent Reach stores proxy settings in `~/.agent-reach/config.yaml` managed by the **`Config`** class in [`agent_reach/config.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py).
- Use `agent-reach install --proxy <url>` during initial setup or `agent-reach configure proxy <url>` afterward.
- The proxy string is treated as opaque configuration and passed to downstream tools via `HTTP_PROXY` and `HTTPS_PROXY` environment variables.
- Both modern (`proxy`) and legacy (`bilibili_proxy`) keys are maintained for backward compatibility.

## Frequently Asked Questions

### Where does Agent Reach store proxy configuration?

Agent Reach writes proxy settings to `~/.agent-reach/config.yaml` in the user's home directory. The `Config` class in [`agent_reach/config.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py) handles all reads and writes to this file, updating both the `proxy` and `bilibili_proxy` keys simultaneously.

### Does Agent Reach support authenticated proxies?

Yes. The proxy string is treated as opaque text, so you can include authentication credentials in the standard URL format `http://user:pass@host:port`. Agent Reach passes this string directly to downstream tools without parsing or modifying it.

### Which external tools respect the Agent Reach proxy settings?

The `youtube`, `twitter`, and `reddit` channels (and other external utilities spawned by Agent Reach) automatically receive the `HTTP_PROXY` and `HTTPS_PROXY` environment variables. Any tool that respects standard proxy environment variables will route traffic through your configured proxy.

### Can I configure the proxy without using the CLI?

Yes. You can manually edit `~/.agent-reach/config.yaml` and add the `proxy` key with your desired URL, or use the `Config` class programmatically in Python by importing from [`agent_reach/config.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py) and calling `Config.set("proxy", "your-url")` followed by `Config.save()`.