Read-only analytics agent: route → fetch → narrate → ground, LLM never computes anything

RedaHaloubi · reddit · 2026-09-10

A developer building a restaurant-POS analytics copilot shares a detailed read-only agent architecture before enabling writes: the LLM never computes — all math lives in a pre-aggregated pipeline (CDC → analytics DB → edge API). The loop: Route (keyword/intent tool filtering with a frozen CORE 12 for prompt-cache stability, pins for narrow tools, hand-rolled since Gemini lacks deferloading), Fetch (thin wrappers projecting responses to slim DTOs, e.g. revenue summary 4k→500 chars, soft-fail on errors), Narrate (Gemini Flash via Vercel AI SDK streamText, maxSteps, SSE), Ground (post-hoc validator checking every $/% figure against tool output). Open questions: tool selection at 20-40+ tools, numeric grounding via regex vs constrained decoding, PII-safe observability, and HITL write patterns.

Related event: Restaurant POS Analytics Agent Uses Four-Step Architecture(2 posts)→

Original post →

More from coding & agent

coding & agent channel →