Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Giving Your LLM Agent Web Search Without Burning Money: Self-hosted SearXNG, Caching and Citation Checks

Description and use

An automation recipe enabling LLM agents to perform web search without paid APIs, using self‑hosted SearXNG, disk caching, and rate limiting.

Problem

LLM agents repeatedly query paid web‑search APIs, causing high costs, rate limits, and unreliable citations.

Outcome

The gateway reduced API costs to zero, limited queries to 20 per minute, cached results for 6 hours, and prevented agents from repeating identical searches.

Workflow

  • Deploy SearXNG in Docker with JSON output enabled
  • Configure SearXNG to bind to 127.0.0.1 and disable public limiter
  • Implement a Python gateway using httpx and diskcache
  • Add a TokenBucket class to enforce a 20 queries/minute limit
  • Hash and normalize queries to cache results for 6 hours
  • Return cached results when available, otherwise fetch from SearXNG
  • Parse JSON results and forward to LLM agent

Evidence

Agents called external search APIs directly, without caching or rate limiting, resulting in duplicate queries and high costs.

Source

Deploy SearXNG in Docker with JSON output enabled

Source

Implement a Python gateway using httpx and diskcache

Source

  • Record date: 2026-10-06T00:40:51.071Z