Your analytics agent is summing a 100-row page and calling it the total: five tool-design fixes from Cube's production harness
AbleBranch6 · reddit · 2026-11-04
On agentic analytics over a warehouse, the SQL the model writes is usually fine — the trouble starts with what the tool hands back. Drawing on Cube's production agentic analytics harness, the author distills five patterns plus a quick test.
- Flag truncation explicitly: a tool returning the first 100 rows of 48k invites the model to rank and sum the page as the total. Return rows + total count + a queryid for more pages + an explicit partial note. Self-test: ask for the top-10 customers' revenue share; if it's much higher than your own SQL, the agent divided by a page total.
- Errors should teach recovery: quote the position column, retry timeouts with a longer limit, lint invalid constructs (measure inside SUM) before execution.
- 'Success' has multiple states: ran-but-not-saved isn't success; zero rows isn't completion; partial results must say what's missing.
- Search the schema on demand instead of preloading it — fresh, permission-filtered, small candidate lists beat a stale prompt dump that fails silently.
- Context has multiple shapes: semantic metadata, free-form business notes, etc., each with its own owner and loading rules.
More from coding & agent
- OpenAI SDK ships official WebSocket helpers for Responses, GPT-Live and Realtime APIs — craigsdennis · 2026-11-04
- Pydantic AI adds ConversationStore to prevent concurrent chat saves from overwriting each other — samuelcolvin · 2026-11-04
- Gemini API CLI skill lets agents call image, TTS and video models with one command — _philschmid · 2026-11-04
- Anthropic silently pushed a server-side rule to Claude Code banning recreations of specific games — alex_verem · 2026-11-04
- Open-source 'Palantir for Cybersecurity' maps live exploits and routes fixes to coding agents — Fowe · 2026-11-04
- Cherry Pit blog launches: a local-first workspace for people, agents and machines — sull · 2026-11-04