get-wandb-data-from-chrome-cookie
Skill2 starsChanged 2 months agoMITView on GitHub
Download Weights & Biases (wandb.ai) run data - metadata, files, full metric history/curves and output artifacts - with the Chrome login session instead of a W&B API key. Use when the user asks to fetch, export or download a wandb run that the local API key cannot access, when a GraphQL query returns a null project although the run page opens in Chrome, or when the user asks to read wandb cookies from Chrome on Linux.
- Reads credentials
- Installs packages
In this repository8 other files it gives its agents.
- check-opencode-usageSkill
- code-simplifierSkill
- commandcode-toolsSkill
- python-docstring-standardSkill
- writing-a-project-proposalSkill
- wty-markdown-standardsSkill
- youtube-downloadSkill
- yuketang-backgroundSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
run metadata: config, summaryMetrics, historyKeys, state
- Very specific: line 14
run files: config.yaml, wandb-metadata.json, wandb-summary.json, *.diff, requirements
- Distinctive: line 17
Use it when the run belongs to another account than the local API key, or when the user has no API key at all.
- Very specific: line 50
Verify the identity with query { viewer { username email } } before downloading.
- Very specific: line 76
If cookie decryption breaks, copy the Chrome profile and launch headless Chrome with --remote-debugging-port, then read the app's own …
- Very specific: line 80
Only the profiles in CHROME_PROFILES are scanned.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Get W&B Data From Chrome Cookie
When To Use
Extract the wandb.ai cookies from a locally logged-in Chrome profile and download any run the browser session can access:
- run metadata:
config,summaryMetrics,historyKeys, state - full metric history (
history): every logged step and key - run files:
config.yaml,wandb-metadata.json,wandb-summary.json,*.diff, requirements - output artifacts: history/events parquet and other artifact files
Use it when the run belongs to another account than the local API key, or when the user has no API key at all.
Quick Start
pip install pycryptodome secretstorage
python scripts/download_wandb_run.py --url https://wandb.ai/<entity>/<project>/runs/<run_id> --output <dir>Output layout:
<dir>/
├── run_info.json # run metadata: config, summary, historyKeys, state
├── history.json / .csv # full metric history, one row per step
├── artifact_info.json
├── files/ # run files
└── artifacts/<seq>/ # output artifact files (parquet)Implementation Details
Chrome cookie decryption (Linux, Chrome 127+)
- Linux Chrome no longer stores
os_crypt.encrypted_keyinLocal State; the key lives in gnome-keyring as an item withapplication=chromeandxdg:schema=chrome_libsecret_os_crypt_password_v2, read throughsecretstorage. - Derive the AES key with
PBKDF2-HMAC-SHA1(secret, b"saltysalt", 1, 16). - Cookie prefixes
v10andv11both use AES-128-CBC with a 16-space-byte IV;v11plaintext starts with a 32-byte domain hash that must be stripped. - Cookies are stored in
~/.config/google-chrome/<profile>/Cookies(SQLite,encrypted_valuecolumn); copy the database before reading to avoid lock contention.
Authentication
- Set
session.trust_env = False. Otherwise requests reads~/.netrcand adds Basic auth automatically, silently replacing the cookie session with the API key account; the symptom isprojectreturningnulleven though the run page opens in Chrome. - Verify the identity with
query { viewer { username email } }before downloading.
W&B endpoints
| Data | Endpoint |
| GraphQL | POST https://api.wandb.ai/graphql with the cookie session |
| Full history | run { historyLineCount history(samples: N) }; pass N greater than historyLineCount to get every row as JSON lines |
| Run files | GraphQL run { files { edges { node { name directUrl } } } }; fall back to https://api.wandb.ai/files/<entity>/<project>/<run_id>/<name> |
| Output artifacts | run { outputArtifacts { ... files { directUrl } } }; directUrl is a signed GCS URL, download directly |
| Optional system metrics | run { events(samples: N) } via --system-metrics; rows use _runtime instead of _step |
- Send
x-origin: https://wandb.aiwith GraphQL requests to match the frontend. historyandeventsreturn arrays of JSON strings, one per row.
Troubleshooting
| Symptom | Fix |
Chrome Safe Storage key not found | Keyring is locked, or the item is not registered under application=chrome; enumerate items with secretstorage to check |
project returns null | Ensure trust_env is disabled, the Chrome account has access, and the profile is listed in CHROME_PROFILES |
| File download returns 404 | Newer runs do not store output.log or wandb-history.jsonl; this is expected |
History has fewer rows than historyLineCount | samples is too small; pass a value greater than historyLineCount |
Fallback: headless Chrome + CDP
If cookie decryption breaks, copy the Chrome profile and launch headless Chrome with --remote-debugging-port, then read the app's own GraphQL responses with Network.getResponseBody or run fetch in the page context. This is independent of the cookie encryption format but requires starting a browser.
Notes
- Only the profiles in
CHROME_PROFILESare scanned; extend the list for more profiles. - Session cookies are account credentials. Do not write them to disk, logs or repositories.
- Self-hosted W&B instances expose different GraphQL and file URLs; adjust the
GRAPHQLconstant and path templates.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

