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

# Searxng Tools

> Query a self-hosted SearxNG instance at localhost:53153 for web, news, and science results.

```python searxng_tools.py theme={null}
"""
Searxng Tools
=============================

Demonstrates searxng tools.
"""

from agno.agent import Agent
from agno.tools.searxng import SearxngTools

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


# Initialize Searxng with your Searxng instance URL
searxng = SearxngTools(
    host="http://localhost:53153",
    engines=[],
    fixed_max_results=5,
    news=True,
    science=True,
)

# Create an agent with Searxng
agent = Agent(tools=[searxng])

# Example: Ask the agent to search using Searxng

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("""
    Please search for information about artificial intelligence 
    and summarize the key points from the top results
    """)
```

## 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 OpenAI API key">
    <CodeGroup>
      ```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"
      ```
    </CodeGroup>
  </Step>

  <Step title="Start SearxNG">
    Start a SearxNG instance at `http://localhost:53153` before running the example.
  </Step>

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

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

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