How to Configure Twitter Cookies for Agent Access Using Cookie-Editor in Agent Reach
Agent Reach authenticates to Twitter (now x.com) by extracting the auth_token and ct0 cookies via the Cookie-Editor extension and persisting them to ~/.agent-reach/config.yaml through the CLI or Python API.
Agent Reach is an open-source automation framework that lets agents interact with Twitter without official API credentials. Configuring Twitter cookies for agent access using Cookie-Editor is the recommended workflow, though the repository also supports automatic extraction directly from Chrome, Edge, or Firefox. This article walks through both approaches using the exact CLI commands and source files from the Panniantong/Agent-Reach repository.
Understanding the Required Cookies
Agent Reach requires two specific session cookies from Twitter (now x.com): auth_token and ct0. According to [agent_reach/cookie_extract.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cookie_extract.py), the extraction logic defines a PLATFORM_SPECS entry for Twitter that targets the domains .x.com and .twitter.com to locate these values. The configuration layer in [agent_reach/config.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py) maps them to the internal keys twitter_auth_token and twitter_ct0 inside ~/.agent-reach/config.yaml.
Method 1: Manual Configuration Using Cookie-Editor
This is the recommended workflow documented in [docs/setup-twitter.md](https://github.com/Panniantong/Agent-Reach/blob/main/docs/setup-twitter.md) and the main [README.md](https://github.com/Panniantong/Agent-Reach/blob/main/README.md).
-
Install Cookie-Editor from the Chrome Web Store or your browser’s extension marketplace, as recommended in [
docs/install.md](https://github.com/Panniantong/Agent-Reach/blob/main/docs/install.md). -
Log in to Twitter at
https://x.comorhttps://twitter.comand verify you are fully authenticated. -
Export the session cookies by clicking the Cookie-Editor icon, selecting Export, then choosing Header String (JSON is also supported). The exported value will look like this:
auth_token=AAA…; ct0=BBB… -
Pass the header string to the Agent Reach CLI:
agent-reach configure twitter-cookies "auth_token=AAA…; ct0=BBB…"The CLI parses the string, extracts the two target cookies, and persists them via
Config.set()in [agent_reach/config.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py).
Method 2: Automatic Extraction from a Local Browser
If you prefer not to use Cookie-Editor, Agent Reach can read cookies directly from an open browser.
agent-reach configure --from-browser chrome
In [agent_reach/cookie_extract.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cookie_extract.py), the helper opens the browser’s cookie store, retrieves auth_token and ct0 for .x.com and .twitter.com, and updates the configuration file automatically. Substitute chrome with edge or firefox if your session lives in another browser.
Programmatic Configuration via Python
You can also set the cookies directly in code without invoking the CLI:
from agent_reach.config import Config
cfg = Config()
cfg.set("twitter_auth_token", "AAA…") # value from auth_token cookie
cfg.set("twitter_ct0", "BBB…") # value from ct0 cookie
This calls the same Config.set() method used by the CLI, writing the credentials to ~/.agent-reach/config.yaml as implemented in [agent_reach/config.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py).
Configuration Storage and Security
Once set, the cookies live in ~/.agent-reach/config.yaml under the keys twitter_auth_token and twitter_ct0. The repository does not exfiltrate these values; they are consumed only by your local agent to make authenticated requests to Twitter. Because the agent uses these session cookies instead of an official API key, it can perform searches and other actions directly through Twitter’s web endpoints.
Summary
- Agent Reach authenticates to Twitter using only
auth_tokenandct0session cookies. - The preferred path is to export a Header String from Cookie-Editor and run
agent-reach configure twitter-cookies. - For hands-off setup, use
agent-reach configure --from-browser chrometo let [agent_reach/cookie_extract.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cookie_extract.py) handle extraction. - The [
agent_reach/config.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py) module persists both approaches to~/.agent-reach/config.yamlviaConfig.set(). - You can also configure credentials programmatically through the Python
ConfigAPI.
Frequently Asked Questions
What specific cookies does Agent Reach require from Twitter?
Agent Reach requires auth_token and ct0. These two session cookies are defined in the Twitter PLATFORM_SPECS inside [agent_reach/cookie_extract.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cookie_extract.py) and are sufficient for the agent to interact with Twitter without an API key.
Can I use Cookie-Editor with browsers other than Chrome?
Yes. Cookie-Editor supports multiple browsers, and the Header String format is universal. As long as the exported string contains auth_token and ct0, the Agent Reach CLI will accept it regardless of the browser source.
Does Agent Reach store my Twitter cookies securely?
The CLI writes the cookies only to your local file at ~/.agent-reach/config.yaml. The repository does not transmit them to remote servers during configuration; they remain on your machine for local agent use.
What happens if the exported cookie string contains extra cookies?
Agent Reach parses the header string and extracts only the auth_token and ct0 values. Additional cookies present in the export are ignored by the parser in [agent_reach/config.py](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py).
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →