How do you stop conversation history from overflowing the context window?
IntermediateConceptMemory & state
Answer
Keep the last few turns in full, summarise older turns into a short running summary, drop bulky tool outputs once they have been used, and store important facts separately. Measure token usage per request so you notice growth early.
More on Memory & state
Do LLMs remember previous conversations?BeginnerWhat is short-term memory for an agent?BeginnerWhat is long-term memory for an agent?BeginnerWhat should an agent store in long-term memory?IntermediateWhat is agent state, and why persist it?IntermediateYour assistant contradicts what it said ten messages ago. What is happening?Intermediate