Implementing Sliding Window
Lecture 7.1
- Taking the sliding window strategy from Module 4 and writing real code
- Where truncation runs in the agent loop (between inner-loop iterations)
- The naive last-N implementation and why it breaks the API contract
- The pair-integrity rule: `tool_use` and `tool_result` must stay together
- Preserving the first user message as a task anchor
- Testing: what gets dropped when the window is set aggressively low
Additional Resources