SearxNG Search
Search the web using your local SearxNG instance for privacy-focused web searches
SearxNG Search Tool
The SearxNG search tool allows you to perform web searches using your local SearxNG instance, providing privacy-focused search capabilities as an alternative to traditional search engines like Google or DuckDuckGo.
Overview
SearxNG is a privacy-respecting metasearch engine that aggregates results from multiple search engines without storing your data. This tool integrates with your local SearxNG instance to provide secure, private web searches for your AI agents.
Installation
First, install the required dependency:
You’ll also need a running SearxNG instance. You can set it up using Docker:
Usage
Basic Usage
Using the Alias
Integration with Agents
Function Parameters
searxng_search(query, max_results=5, searxng_url=None)
Parameters:
query
(str, required): The search query stringmax_results
(int, optional): Maximum number of results to return. Default: 5searxng_url
(str, optional): URL of your SearxNG instance. Default: “http://localhost:32768/search”
Returns:
List[Dict]
: List of search results, each containing:title
: The title of the search resulturl
: The URL of the search resultsnippet
: A brief snippet/description of the contenterror
: Error message if the search fails
Configuration
Environment Variables
You can set a default SearxNG URL using environment variables:
SearxNG Setup
For production use, consider:
- Custom SearxNG Configuration: Configure engines, categories, and settings
- Authentication: Set up authentication if needed
- Rate Limiting: Configure appropriate rate limits
- SSL/TLS: Use HTTPS for secure connections
Advanced Usage
Multi-Agent Search System
Custom SearxNG Configuration
Error Handling
The tool includes comprehensive error handling:
Common Error Messages
- Connection Error: “Could not connect to SearxNG at . Ensure SearxNG is running.”
- Timeout Error: “SearxNG search request timed out”
- Missing Dependency: “SearxNG search requires requests package. Install with: pip install requests”
- Parsing Error: “Error parsing SearxNG response: “
Best Practices
- Local Instance: Use a local SearxNG instance for better privacy and performance
- Rate Limiting: Be mindful of search frequency to avoid overwhelming your instance
- Error Handling: Always check for errors in the response
- Custom URLs: Use environment variables for different deployment environments
- Result Validation: Validate search results before using them in your application
Comparison with Other Search Tools
Feature | SearxNG | DuckDuckGo | |
---|---|---|---|
Privacy | ✅ High | ⚡ Medium | ❌ Low |
Local Control | ✅ Yes | ❌ No | ❌ No |
Multi-Engine | ✅ Yes | ❌ No | ❌ No |
Customization | ✅ High | ❌ Limited | ❌ None |
Troubleshooting
SearxNG Not Responding
Connection Issues
For more information about SearxNG setup and configuration, visit the official SearxNG documentation.