> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Pubmed Tools

> Search PubMed for medical research papers with PubmedTools function toggles.

```python pubmed_tools.py theme={null}
"""
Pubmed Tools
=============================

Demonstrates pubmed tools.
"""

from agno.agent import Agent
from agno.tools.pubmed import PubmedTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------


# Example 1: Enable all PubMed functions
agent_all = Agent(
    tools=[
        PubmedTools(
            all=True,  # Enable all PubMed search functions
        )
    ],
    markdown=True,
)

# Example 2: Enable specific PubMed functions only
agent_specific = Agent(
    tools=[
        PubmedTools(
            enable_search_pubmed=True,  # Only enable the main search function
        )
    ],
    markdown=True,
)

# Example 3: Default behavior with search enabled
agent = Agent(
    tools=[
        PubmedTools(
            enable_search_pubmed=True,
        )
    ],
    markdown=True,
)

# Example usage with all functions enabled

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    print("=== Example 1: Using all PubMed functions ===")
    agent_all.print_response(
        "Tell me about ulcerative colitis and find the latest research."
    )

    # Example usage with specific functions only
    print("\n=== Example 2: Using specific PubMed functions (search only) ===")
    agent_specific.print_response("Search for recent studies on diabetes treatment.")

    # Example usage with default configuration
    print("\n=== Example 3: Default PubMed agent usage ===")
    agent.print_response("Tell me about ulcerative colitis.")

    agent.print_response("Find research papers on machine learning in healthcare.")
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `pubmed_tools.py`, then run:

```bash theme={null}
python pubmed_tools.py
```

Full source: [cookbook/91\_tools/pubmed\_tools.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/91_tools/pubmed_tools.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.