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.
More from coding & agent
- AI documents long-term tasks to avoid wasted tokens — draginol · 2026-08-28
- AI Agent uses task comments to document long-term projects — draginol · 2026-08-28
- Implementing Automatic Model Routing Based on Intent — chadwell · 2026-08-28
- Google's Harness Engineering: Agent = Model + Harness Replaces Prompt Engineering — anselm · 2026-08-28
- GLM-5.3 Released: 50% Coding Gain, Emergent Cyber Capabilities — jacek2023 · 2026-08-28
- zai releases GLM-5.3 open-weight model for agentic coding and defense — zai-org · 2026-08-28