30 lines of bash to give llama-server LLMs web search: batsearch

mantisalt · reddit · 2026-08-28

The author added batsearch to the ratsearch repo — a tiny CLI sidekick to llama-cli that lets an LLM backed by llama-server (or any API endpoint) perform web searches. Unlike llama-cli, it outputs a single response to stdout for easy piping, is non-interactive, and requires a running llama-server endpoint. The LLM gets a minimal web tool it can keep using until it decides to answer; the tool automatically distinguishes URLs from search queries, so models will visit links they find.

The script is shrunk to 30 hand-written lines of bash (at the cost of comments and some error handling); searches go through DuckDuckGo via w3m -dump duckduckgo.com/<query> since Google is a pain to access. In testing, Qwen works great and LMF2.5-2B correctly said who won the World Cup. The author's earlier ratsearch writeup covers the JSON/API-calling details.

Original post →

More from coding & agent

coding & agent channel →