Self-HostingIntermediate30 minVerified 29 days ago
Self-Host SearXNG for Agent Web Search
Run a private metasearch engine that your agents can query without sending searches to commercial providers.
searxngsearchprivacyself-hostingagents
The promise
SearXNG is a privacy-respecting metasearch engine. It queries multiple search engines and returns aggregated results without tracking the user. Self-hosting SearXNG gives your agents a web-search tool that does not depend on a single commercial provider.
What you'll get
- SearXNG running in Docker.
- An OpenAI-compatible JSON endpoint your agent can call.
- Aggregated search results with titles, URLs, and snippets.
Prerequisites
- Docker and Docker Compose installed.
- A server with outbound internet access.
Troubleshooting
- No results: Some engines block self-hosted instances. Enable more engines in
settings.yml. - Rate limits: Add delays between agent queries to avoid being throttled.
- CORS issues: Serve SearXNG behind a reverse proxy if your agent runs in a browser context.
Best fit
Agents that need web research with provider independence and stronger privacy than a single commercial search API.
Steps
1
services:
searxng:
image: searxng/searxng:latest
ports:
- "8080:8080"
volumes:
- ./searxng:/etc/searxng
environment:
- BASE_URL=http://localhost:8080/
mkdir -p searxng
cp searxng/settings.yml.new searxng/settings.yml
docker compose up -d
2
Edit searxng/settings.yml to allow JSON results:
search:
formats:
- html
- json
Restart the container:
docker compose restart
3
curl 'http://localhost:8080/search?q=local+LLM+runtimes&format=json'
Your agent can parse the JSON results and use them for research or citation.
Recipe verified 2026-07-01. Commands are tested but your environment may differ.
Browse related services