> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# arXiv Agent

> arXiv research paper search and analysis tools for AI agents.

<Note>
  **Prerequisites**

  * Python 3.10 or higher
  * PraisonAI Agents package installed
  * PraisonAI Tools package installed
  * `arxiv` package installed
</Note>

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent
from praisonai_tools import search_arxiv

agent = Agent(name="Researcher", tools=[search_arxiv])
agent.start("Find recent papers on retrieval-augmented generation")
```

The user asks for literature; the agent searches arXiv and returns relevant papers.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    U[Input] --> A[Agent]
    A --> T[Tool]
    T --> O[Output]

    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

    class A agent
    class U,O tool
    class T tool
```

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant Agent
    participant Feature as arXiv Agent

    User->>Agent: Request
    Agent->>Feature: Process request
    Feature-->>Agent: Result
    Agent-->>User: Response
```

## arXiv Tools

Use arXiv Tools to search and analyze research papers with AI agents.

<Steps>
  <Step title="Install Dependencies">
    First, install the required packages:

    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    pip install praisonaiagents praisonai-tools arxiv
    ```
  </Step>

  <Step title="Import Components">
    Import the necessary components:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonaiagents import Agent, Task, AgentTeam
    from praisonai_tools import search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category
    ```
  </Step>

  <Step title="Create Agent">
    Create a research agent:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    research_agent = Agent(
        name="ResearchAgent",
        role="Scientific Literature Specialist",
        goal="Find and analyze relevant scientific papers.",
        backstory="Expert in academic research and literature review.",
        tools=[search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category],
        reflection=False
    )
    ```
  </Step>

  <Step title="Define Task">
    Define the research task:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    research_task = Task(
        description="Search for recent papers on 'quantum machine learning' and summarize key findings.",
        expected_output="List of relevant papers with summaries.",
        agent=research_agent,
        name="quantum_research"
    )
    ```
  </Step>

  <Step title="Run Agent">
    Initialize and run the agent:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    agents = AgentTeam(
        agents=[research_agent],
        tasks=[research_task],
        process="sequential"
    )
    agents.start()
    ```
  </Step>
</Steps>

## Understanding arXiv Tools

<Card title="What are arXiv Tools?" icon="question">
  arXiv Tools provide scientific paper search capabilities for AI agents:

  * Paper search functionality
  * Author-based search
  * Category filtering
  * Abstract retrieval
  * PDF download options
</Card>

## Available Functions

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools import search_arxiv
from praisonai_tools import get_arxiv_paper
from praisonai_tools import get_papers_by_author
from praisonai_tools import get_papers_by_category
```

## Function Details

### search\_arxiv(query: str, max\_results: int = 10, sort\_by: str = "relevance", sort\_order: str = "descending", include\_fields: Optional\[List\[str]] = None)

Search arXiv for papers:

* Flexible query support
* Customizable results
* Multiple sorting options
* Field selection

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools import search_arxiv

# Basic search
papers = search_arxiv("quantum computing")

# Advanced search
papers = search_arxiv(
    query="quantum computing",
    max_results=5,
    sort_by="submittedDate",
    sort_order="descending",
    include_fields=["title", "authors", "summary"]
)
```

### get\_arxiv\_paper(paper\_id: str, include\_fields: Optional\[List\[str]] = None)

Get specific paper details:

* Direct ID lookup
* Full paper metadata
* Customizable fields
* PDF/Abstract links

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools import get_arxiv_paper

# Get paper by ID
paper = get_arxiv_paper("2401.00123")

# Get specific fields
paper = get_arxiv_paper(
    paper_id="2401.00123",
    include_fields=["title", "authors", "pdf_url"]
)
```

### get\_papers\_by\_author(author: str, max\_results: int = 10)

Search papers by author:

* Author-specific search
* Publication timeline
* Sort options

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools import get_papers_by_author

# Get author's papers
papers = get_papers_by_author("Yoshua Bengio", max_results=5)
```

### get\_papers\_by\_category(category: str, max\_results: int = 10)

Search papers by category:

* Category-specific search
* Latest publications
* Sort options

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools import get_papers_by_category

# Get papers in category
papers = get_papers_by_category("cs.AI", max_results=5)
```

## Examples

### Basic Research Agent

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category

# Create research agent
research_agent = Agent(
    name="PaperSearcher",
    role="Scientific Literature Specialist",
    goal="Find relevant scientific papers on specified topics.",
    backstory="Expert in academic research and literature analysis.",
    tools=[search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category],
    reflection=False
)

# Define research task
research_task = Task(
    description="Search for papers on 'transformer models in NLP' from the last year.",
    expected_output="List of relevant papers with abstracts and key findings.",
    agent=research_agent,
    name="nlp_research"
)

# Run agent
agents = AgentTeam(
    agents=[research_agent],
    tasks=[research_task],
    process="sequential"
)
agents.start()
```

### Advanced Research with Multiple Agents

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category

# Create research agent
research_agent = Agent(
    name="Researcher",
    role="Literature Specialist",
    goal="Gather comprehensive scientific literature.",
    tools=[search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category],
    reflection=False
)

# Create analysis agent
analysis_agent = Agent(
    name="Analyzer",
    role="Research Analyst",
    goal="Analyze and synthesize research findings.",
    backstory="Expert in scientific literature analysis.",
    reflection=False
)

# Define tasks
research_task = Task(
    description="Search for papers on quantum computing applications in cryptography.",
    agent=research_agent,
    name="quantum_research"
)

analysis_task = Task(
    description="Analyze the papers and identify key trends and breakthroughs.",
    agent=analysis_agent,
    name="research_analysis"
)

# Run agents
agents = AgentTeam(
    agents=[research_agent, analysis_agent],
    tasks=[research_task, analysis_task],
    process="sequential"
)
agents.start()
```

## Best Practices

<AccordionGroup>
  <Accordion title="Agent Configuration">
    Configure agents with clear research focus:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonai_tools import search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category

    Agent(
        name="Researcher",
        role="Literature Specialist",
        goal="Find relevant scientific papers",
        tools=[search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category]
    )
    ```
  </Accordion>

  <Accordion title="Task Definition">
    Define specific research objectives:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    Task(
        description="Find papers on 'deep learning in healthcare' from top authors",
        expected_output="Curated list of papers with impact analysis"
    )
    ```
  </Accordion>
</AccordionGroup>

## Common Patterns

### Literature Review

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category

# Literature search agent
searcher = Agent(
    name="Searcher",
    role="Literature Specialist",
    tools=[search_arxiv, get_arxiv_paper, get_papers_by_author, get_papers_by_category]
)

# Review agent
reviewer = Agent(
    name="Reviewer",
    role="Research Reviewer"
)

# Define tasks
search_task = Task(
    description="Find papers on AI ethics",
    agent=searcher
)

review_task = Task(
    description="Review and summarize findings",
    agent=reviewer
)

# Run workflow
agents = AgentTeam(
    agents=[searcher, reviewer],
    tasks=[search_task, review_task]
)
```

## Related

<CardGroup cols={2}>
  <Card title="Custom Tools" icon="wrench" href="/docs/tools/custom">
    Build your own agent tools
  </Card>

  <Card title="Tools Overview" icon="toolbox" href="/docs/tools/tools">
    Browse PraisonAI tool documentation
  </Card>
</CardGroup>
