$npx -y skills add ai4protein/VenusFactory2 --skill arxivarXiv preprint server — keyword search the official API and download papers as PDF / HTML / source tarball. Use whenever the user mentions an arXiv ID (e.g. 2106.04559) or wants preprints on a topic in CS / physics / math / quantitative biology. For biomedical preprints specifica
| 1 | # arXiv |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Two complementary tools: existing `query_arxiv_tool` (text search, returns JSON list inline) + new `download_arxiv_paper_by_id` (fetches the actual paper as PDF / HTML / source tarball to disk). |
| 6 | |
| 7 | ## Project Tools (VenusFactory2) |
| 8 | |
| 9 | | Tool | Args | Returns | Description | |
| 10 | |------|------|---------|--------------| |
| 11 | | **query_arxiv** | `query` (text), `max_results` (default 5, max 50), `max_content_length` (default 10000) | JSON list of paper records (title, abstract, arxiv_id, authors, etc.) inline | Search-only; small JSON returned to agent context. | |
| 12 | | **download_arxiv_paper_by_id** | `arxiv_id` (e.g. `2106.04559`, `2106.04559v2`, `hep-th/9510017`), `out_dir`, `format` (`pdf` \| `html` \| `source`; default `pdb`), `timeout` (default 60s) | rich JSON envelope; file at `file_info.file_path` (`arxiv_<id>.pdf` etc.) | Download the actual paper. | |
| 13 | |
| 14 | ## When to Use Each |
| 15 | |
| 16 | | Goal | Tool | |
| 17 | |---|---| |
| 18 | | "Find papers about X" | `query_arxiv` | |
| 19 | | User provided an arxiv id and wants the PDF | `download_arxiv_paper_by_id` | |
| 20 | | Build a literature review pipeline (search → read PDFs) | `query_arxiv` → `download_arxiv_paper_by_id` for each result | |
| 21 | | Get the LaTeX source / figures for a paper | `download_arxiv_paper_by_id` with `format=source` (tar.gz) | |
| 22 | |
| 23 | ## ID Formats Accepted |
| 24 | |
| 25 | - Modern: `2106.04559`, `2106.04559v2` (with version) |
| 26 | - Old-style: `hep-th/9510017`, `cond-mat/0411174` |
| 27 | - The tool strips the `arxiv:` / `arXiv:` prefix if present. |
| 28 | |
| 29 | ## Format Details |
| 30 | |
| 31 | | `format` | URL pattern | When to use | |
| 32 | |---|---|---| |
| 33 | | `pdf` (default) | `https://arxiv.org/pdf/<id>.pdf` | Read the paper | |
| 34 | | `html` | `https://arxiv.org/html/<id>` | Modern papers only (post-2023); fails 404 on older papers | |
| 35 | | `source` | `https://export.arxiv.org/e-print/<id>` | LaTeX source as `.tar.gz` (for reproducing figures, extracting data, etc.) | |
| 36 | |
| 37 | ## Rate Limiting |
| 38 | |
| 39 | - arXiv asks for ~3-second spacing between requests. The tool doesn't enforce this internally; if you fire many in a loop, sleep yourself. |
| 40 | - Bulk downloads should use [the arXiv full-text bulk dataset on AWS S3](https://info.arxiv.org/help/bulk_data_s3.html), not this tool. |
| 41 | |
| 42 | ## Common Mistakes |
| 43 | |
| 44 | - **HTML format on an old paper**: 404. Fall back to `pdf`. |
| 45 | - **PDF response is HTML**: arXiv occasionally serves an error page with 200 OK; the tool checks `%PDF` magic bytes and returns `DownloadError` if the bytes aren't a real PDF. |
| 46 | - **No abstract from `download_arxiv_paper_by_id`**: this tool only downloads; for abstract / metadata, use `query_arxiv` (or fetch the abstract page via `WebFetch`). |
| 47 | |
| 48 | ## References |
| 49 | |
| 50 | - [arXiv API user manual](https://info.arxiv.org/help/api/user-manual.html) |
| 51 | - [arXiv Terms of Use](https://info.arxiv.org/help/api/tou.html) |