Long agent runs can fail because the context gets too crowded

An agent can start a long task well and then get worse after many steps, often around step ten or later. It may run the same tool again, miss an instruction from the start, or repeat its own earlier . The model has not changed; the has filled up with too much old material.

The drop in quality often lines up with deeper token position and a crowded . The crowded input usually contains the full raw , early instructions buried under later work, large , and the agent’s own past . A big JSON tool result can add many fields that are never needed again.

A better is to summarize old settled turns, keep the decision, remove the raw back-and-forth, and trim to only the fields the agent actually needs.

Key points

  • Agents can become less reliable during long multi-step tasks.
  • Common failures include repeated , missed early instructions, and repeated .
  • The likely cause is a filled with old history, large , and prior .
  • JSON can waste space when unused fields stay in the prompt.
  • Summarizing settled turns and trimming tool results can reduce both tokens and mistakes.

Sources covering this story (2)

Read original