preu.at / work / searxng-cli

SearXNG CLI

web search for agents through a SearXNG instance you choose: compact results, a cache for repeatable runs, and output checked against its published format.

what it’s for

searxng sends queries to a SearXNG metasearch instance and returns the results as TOON by default, or JSON, JSON lines, CSV, markdown, YAML, XML, RSS or HTML. any upstream SearXNG parameter can be passed through, so the CLI never hides a feature of the instance.

here the guard rails are about provenance and repeatability: knowing where a result came from, reading the same answer again from the cache, and failing loudly when there is nothing to find.

what it covers

  • search over GET and POST
  • autocomplete
  • engines and categories
  • time ranges
  • presets
  • persistent cache
  • instance health
  • engine errors
  • Prometheus metrics
  • OpenSearch metadata

built for agents

results you can check

an agent acting on a search result should know where it came from and when it was fetched.

  • a contract agents can read

    prints the complete, versioned command contract, in TOON or as JSON for tool builders.

    searxng commands --json
  • modes for agents

    --agent trims output for language models, --agent-json adds validated compact JSON, --agent-ci is strict, offline-first and validated.

    searxng --agent-json "query"
  • repeatable from the cache

    answers from the local cache only, without touching the network.

    searxng --offline-first "query"
  • validate the output format

    checks the output’s shape against the format’s schema (--schema-json), not whether the results are true.

    searxng --format json --validate-output "query"
  • fail loudly on nothing

    exits with code 2 when a search returns no results. machine formats also carry the source instance and a timestamp.

    searxng --strict --json "query"

a first run

● commands from the READMEsearxng 2026.7.31
# point it at your instance and test the connectionsearxng --setupsearxng "your search query"searxng --doctor
commands from the project’s README; what they print depends on your server.

checked against the README at dd47144 (npm 2026.7.31) · npm

same rules, four services