LangChain tool returning large data: return a summary and store the rest
@devsingh05▲ 7 net votes
A tool that returns a whole API response or file floods the context and slows every later turn. Return a compact summary with ids, and save full results to a file or store the agent can read on demand (deepagents' filesystem tools are built for this), or paginate. Large tool outputs are also what context-editing and summarization middleware end up clearing.