crewai-builtsimple 0.1.0
CrewAI tools for Built-Simple research APIs (PubMed, ArXiv)
Requires Python: >=3.10
Keywords: agents, ai, arxiv, crewai, pubmed, research

# CrewAI Built-Simple Research Tools

🔬 CrewAI tools for searching scientific literature via [Built-Simple](https://built-simple.ai) research APIs.

## Features

- **PubMedSearchTool** - Search 4.48M+ peer-reviewed medical articles
- **PubMedFullTextTool** - Retrieve full article text when available
- **ArXivSearchTool** - Search 2.77M+ scientific preprints
- **ResearchTool** - Combined search across both databases

All tools use GPU-accelerated hybrid search (semantic + keyword) for fast, accurate results.

## Installation

```bash
pip install crewai-builtsimple
```

Or install from source:

```bash
pip install git+https://github.com/built-simple/crewai-builtsimple.git
```

## Quick Start

```python
from crewai import Agent, Task, Crew
from crewai_builtsimple import PubMedSearchTool, ArXivSearchTool, ResearchTool

# Create tools
pubmed_tool = PubMedSearchTool()
arxiv_tool = ArXivSearchTool()
research_tool = ResearchTool()  # Searches both!

# Create a research agent
researcher = Agent(
    role="Medical Research Analyst",
    goal="Find relevant scientific literature on given topics",
    backstory="Expert at finding and synthesizing medical research",
    tools=[pubmed_tool, arxiv_tool, research_tool],
    verbose=True
)

# Define a research task
task = Task(
    description="Find recent research on CRISPR gene therapy for cancer treatment",
    expected_output="Summary of 5 key papers with their findings",
    agent=researcher
)

# Run the crew
crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()
print(result)
```

## Tool Details

### PubMedSearchTool

Search peer-reviewed medical and biomedical literature.

```python
from crewai_builtsimple import PubMedSearchTool

tool = PubMedSearchTool(
    api_key="optional-api-key",  # For higher rate limits
    timeout=30.0
)

# Agent will use with parameters:
# - query: Search query
# - top_k: Number of results (1-100, default 10)
# - min_year: Filter by publication year (default 2010)
```

### PubMedFullTextTool

Retrieve full text of articles by PMID.

```python
from crewai_builtsimple import PubMedFullTextTool

tool = PubMedFullTextTool()
# Agent provides: pmid (PubMed ID)
```

### ArXivSearchTool

Search ArXiv preprints (physics, CS, math, biology, economics, etc.)

```python
from crewai_builtsimple import ArXivSearchTool

tool = ArXivSearchTool()
# Parameters:
# - query: Search query
# - limit: Number of results (1-100, default 10)
# - search_type: 'hybrid', 'vector', or 'text' (default 'hybrid')
```

### ResearchTool

Combined search across PubMed and ArXiv.

```python
from crewai_builtsimple import ResearchTool

tool = ResearchTool()
# Parameters:
# - query: Search query
# - limit_per_source: Results per database (default 5)
# - sources: 'both', 'pubmed', or 'arxiv' (default 'both')
```

## Example Crew: Research Assistant

```python
from crewai import Agent, Task, Crew, Process
from crewai_builtsimple import PubMedSearchTool, ArXivSearchTool, ResearchTool

# Tools
pubmed = PubMedSearchTool()
arxiv = ArXivSearchTool()
research = ResearchTool()

# Agents
literature_scout = Agent(
    role="Literature Scout",
    goal="Find all relevant papers on a research topic",
    backstory="Skilled at comprehensive literature searches across multiple databases",
    tools=[research],
    verbose=True
)

paper_analyst = Agent(
    role="Paper Analyst", 
    goal="Analyze and synthesize research findings",
    backstory="Expert at reading scientific papers and extracting key insights",
    tools=[pubmed, arxiv],  # Can do targeted follow-up searches
    verbose=True
)

report_writer = Agent(
    role="Report Writer",
    goal="Write clear research summaries",
    backstory="Excellent at explaining complex research in accessible language",
    verbose=True
)

# Tasks
search_task = Task(
    description="Search for recent research on '{topic}'",
    expected_output="List of 10 relevant papers with abstracts",
    agent=literature_scout
)

analysis_task = Task(
    description="Analyze the papers found and identify key themes and findings",
    expected_output="Thematic analysis with supporting evidence from papers",
    agent=paper_analyst
)

report_task = Task(
    description="Write a research summary report",
    expected_output="2-page research summary in markdown format",
    agent=report_writer,
    output_file="research_report.md"
)

# Crew
research_crew = Crew(
    agents=[literature_scout, paper_analyst, report_writer],
    tasks=[search_task, analysis_task, report_task],
    process=Process.sequential,
    verbose=True
)

# Run
result = research_crew.kickoff(inputs={"topic": "mRNA vaccines for cancer"})
```

## API Information

These tools use the Built-Simple research APIs:

- **PubMed API**: https://pubmed.built-simple.ai
- **ArXiv API**: https://arxiv.built-simple.ai

Free tier available with IP-based rate limiting. For higher limits, obtain an API key.

## License

MIT