Skip to content
MH
← all work
Smart RAG Agent A local agent that costs nothing to run

$0 a month, sub-2s, nothing leaves the machine

A rebuild of an assistant that queried its knowledge base on every message including "hello", returned fabricated links, and refused work as "outside my lane". The replacement runs entirely on one box.

2026 · for internal + client assistant rebuild

FastAPIOllama / Kimi K2.5ChromaDBnomic-embed-textSearXNGDocker

$0

Running cost

per month, no external API

100%

Routing

10-query benchmark

<2s

Direct reply

no tool overhead

18

Typed errors

one exception hierarchy

Pipeline

  1. request
  2. rate limit +
    request ID
  3. dual-mode
    router
  4. KB search /
    web / direct
  5. LLM with
    tool results
  6. SSE stream

A router that hedges an unverified claim

Kimi K2.5 tool-use support through Ollama is strong but not confirmed across every quantization. Rather than discover that in production, both paths were built from the start: the native tool-use API, and a prompt-based JSON classifier as automatic fallback. The system works regardless of whether the chat template exposes tool use at all.

Fail at boot, not at 3am

Startup checks that Ollama is reachable and both models are actually pulled, then exits with a typed error if not. Stop Ollama and the service refuses to come up instead of hanging on the first request. The comment in the plan is two words: do not serve broken.

Failure paths are the design

A circuit breaker opens after five consecutive search failures and is tested explicitly — the sixth call fails immediately with no upstream request made. Tool calls run under gathered exception isolation so one failure does not abort the others. An empty knowledge-base result triggers a web search rather than a confident guess. And any exception reaching the handler is logged with its request ID and converted into a clean error event: never a naked 500.

The persona file is the bug fix

The third complaint about the old system was that it kept declining work. The replacement encodes the opposite instruction directly in a persona file, alongside a hard rule that web results must link to the actual specific page rather than a domain homepage — the exact failure the old search had.

From the archive

“No API keys. No monthly bills.”

“Never a naked 500.”

“Do not serve broken.”

Run log

Every run recorded on this project.