Building a Read-Only POS Analytics Agent: Route-Fetch-Narrate-Ground Architecture Review
RedaHaloubi · reddit · 2026-09-10
A developer shares the architecture of a restaurant POS analytics copilot before opening it up to write actions, asking for blind-spot review. The core rule: the LLM never computes anything — all math happens in a pre-aggregated pipeline.
The loop: route → fetch → narrate → ground
- Route: 27 tools not all registered; a frozen 12-tool CORE keeps prompt cache stable, with on-demand "pins" for narrow tools (inspired by Claude Code's CORE + deferred-tools, hand-rolled since Gemini lacks native deferloading)
- Fetch: thin tool wrappers projecting responses to slim DTOs (revenue summary shrunk from 4k to 500 chars), with soft-fail on errors
- Narrate: Gemini Flash via Vercel AI SDK streamText, multi-step loop, SSE streaming
- Ground: post-hoc validator scans every $/% figure and checks it against tool output
What works: slim DTOs, intent filtering reducing phantom tool calls, static how-to catalog retrieval.
Pain points: pins outside CORE aren't always registered (cache vs reachability); "compare to last week" queries trip the numeric validator; multi-turn follow-ups not scripted.
Asks: tool selection at 20-40+ tools; grounding for numbers (regex vs constrained decoding vs model judge); observability without PII leaks; HITL write patterns (preview→confirm→mutate→audit).
Stack: Node 22 / TypeScript / Vercel AI SDK v7 / Gemini Flash / Redis / MongoDB.
Related event: Restaurant POS Analytics Agent Uses Four-Step Architecture(2 posts)→
More from coding & agent
- Cognition's Devin agents factor RSA-260, set new record; RSA-1024 cost pegged at ~$30M — StefanoGogioso · 2026-09-10
- Harmonic's Aristotle: an AI agent that proves software correct with machine-checked proofs — satnam6502 · 2026-09-10
- OpenAI Mobilized 250+ People to Build a "Defense Factory" of AI Agents That Find and Fix Vulnerabilities — OpenAI · 2026-09-10
- LangChain NYC meetup to teach voice agent evaluation across execution, outcomes and experience — LangChain · 2026-09-10
- Astral Details Code Signing for Its Toolchain, Extending to Ruff and ty — charliermarsh · 2026-09-10
- uv Now Ships Code-Signed Binaries for macOS and Windows, Including PyPI Wheels — charliermarsh · 2026-09-10