> ## 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.

# Perplexity Search Tools

> Search the web with PerplexitySearch, including a variant filtered by recency window and allowed domains.

Demonstrates Perplexity Search tools for web search.

```python perplexity_tools.py theme={null}
"""
Perplexity Search Tools
=============================

Demonstrates Perplexity Search tools for web search.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.perplexity import PerplexitySearch

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

# Example 1: Basic search with default settings
agent = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    tools=[PerplexitySearch()],
    markdown=True,
)

# Example 2: Search with recency and domain filters
agent_filtered = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    tools=[
        PerplexitySearch(
            max_results=10,
            search_recency_filter="week",
            search_domain_filter=["cnbc.com", "reuters.com", "bloomberg.com"],
            show_results=True,
        )
    ],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("What are the latest developments in AI agents?", stream=True)
```

## Run the Example

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

**1. Install dependencies**

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

**2. Export your API keys**

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

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

**3. Run the example**

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

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

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


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