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

# Perplexity Search Tools

> 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-4o"),
    tools=[PerplexitySearch()],
    show_tool_calls=True,
    markdown=True,
)

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

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

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Export your API keys">
    <CodeGroup>
      ```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"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `perplexity_tools.py`, then run:

    ```bash theme={null}
    python perplexity_tools.py
    ```
  </Step>
</Steps>

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