Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CrewAIInc CrewAI Arxiv Paper Tool

From Leeroopedia
Knowledge Sources
Domains Tools, Research, Academic_Search
Last Updated 2026-02-11 00:00 GMT

Overview

Concrete tool for searching academic papers on arXiv.org and optionally downloading PDFs provided by CrewAI.

Description

The ArxivPaperTool class extends BaseTool to fetch metadata from arXiv based on a search query. It uses the arXiv REST API (http://export.arxiv.org/api/query) to query papers via URL construction with encoded search queries, and parses XML responses using ElementTree to extract metadata from Atom-formatted entries including titles, authors, summaries, publication dates, and PDF URLs. When download_pdfs is enabled, it fetches PDFs via urllib, supports filename customization (arXiv ID or sanitized title via use_title_as_filename), and creates necessary directories. Results are formatted as human-readable text summaries with truncated abstracts (300 characters). The implementation includes rate limiting via 1-second sleep delays between PDF downloads and a 10-second request timeout.

Usage

Use this tool when CrewAI agents need to search academic literature, retrieve paper metadata, or download papers for downstream processing like RAG, summarization, or citation analysis.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/arxiv_paper_tool/arxiv_paper_tool.py
  • Lines: 1-169

Signature

class ArxivPaperTool(BaseTool):
    name: str = "Arxiv Paper Fetcher and Downloader"
    description: str = "Fetches metadata from Arxiv based on a search query and optionally downloads PDFs."
    args_schema: type[BaseModel] = ArxivToolInput
    download_pdfs: bool = False
    save_dir: str = "./arxiv_pdfs"
    use_title_as_filename: bool = False

    def _run(self, search_query: str, max_results: int = 5) -> str: ...
    def fetch_arxiv_data(self, search_query: str, max_results: int) -> list[dict]: ...
    def download_pdf(self, pdf_url: str, save_path: str): ...

Import

from crewai_tools import ArxivPaperTool

I/O Contract

Inputs

Name Type Required Description
search_query str Yes Search query for arXiv (e.g., "transformer neural network")
max_results int No Maximum results to fetch; 1-100, default 5
download_pdfs bool No Whether to download PDFs (constructor, default False)
save_dir str No Directory to save downloaded PDFs (constructor, default "./arxiv_pdfs")
use_title_as_filename bool No Use paper title as PDF filename instead of arXiv ID (constructor, default False)

Outputs

Name Type Description
_run() returns str Formatted text with paper titles, authors, dates, PDF URLs, and truncated summaries

Usage Examples

Basic Usage

from crewai_tools import ArxivPaperTool

# Search only
tool = ArxivPaperTool()
results = tool.run(search_query="large language models", max_results=3)

# Search and download PDFs
tool = ArxivPaperTool(download_pdfs=True, save_dir="./papers")
results = tool.run(search_query="attention mechanism", max_results=5)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment