Stop Pre-injecting Context: Let Agents Search to Reduce Errors
siddharthnibjiya · reddit · 2026-08-11
The author shares a key engineering insight from building AI agents: stop pre-injecting context into prompts via RAG, and instead make the agent search for it using a tool. This was the single biggest lever for reducing agent errors.
Previously, using Markdown files with vector search led to context poisoning and digression past 50 files, with no source traceability. The effective solution involved:
- Structured docs: Moving context to JSON/structured documents, which agents navigate much better than plain text.
- Tool-based search: Giving the agent meta-info and a searchresources tool with 5 parameters (query, filter, searchtype, temporal, limit) to retrieve data from an OpenSearch index, rather than spoon-feeding context upstream.
More from coding & agent
- Prodigy Research Launches AI Quant Agent Claiming 100%+ Live Returns — ycombinator · 2026-08-11
- a16z: Agentic Computer Use Is Now Cheaper Per Hour Than Offshore Labor — msharmas · 2026-08-11
- MkAgent Open-Sources Cross-Platform Desktop Agent Development Base Powered by Pi Agent — yihui_indie · 2026-08-11
- Razer Open-Sources AIKit: A Local LLM Toolkit with Multi-GPU Scaling — tom_doerr · 2026-08-11
- Developer runs an agent swarm directly on top of GitHub — Vjeux · 2026-08-11
- Amazon AGI Lab: Adopting AI Coding Agents is a Leadership Problem, Not an IC One — AI Engineer · 2026-08-11