Preserving Context in Research Agents for Better Debugging
I have a research agent using Claude 4 that works well much of the time, but in certain scenarios hits a context window error repeatedly (this is dependent on the company being researched, likely due to scarcity of information prompting the agent to do more and more searches) The challenge is that once the error hits, the previous chain of reasoning and tool use disappear, which makes it very difficult to analyze where in the process the agent is failing, which in turn makes it difficult to optimize the instructions Is there a way to preserve the information up to the point the error hit so that we can debug more easily?