Sample question 1 — Manage Memory, State, and Execution
An agent handling multi-turn conversations needs to remember user preferences across sessions. The agent currently stores all conversation history in memory, but this leads to high memory usage and slow response times. Which approach best balances memory efficiency and context retention?
- A. Use a sliding window of recent messages and summarize older context into a compact state
- B. Clear the memory after each session and rely on the user to repeat preferences
- C. Increase the memory allocation to handle the growing history without performance degradation
- D. Store the full conversation history in a database and retrieve it for each turn
Answer: A. Option A is correct because a sliding window with summarization retains essential context while reducing memory footprint and improving response times. Option D is incorrect because retrieving full history for each turn increases latency and memory usage. Option B is incorrect because it degrades user experience by losing preferences. Option C is incorrect because it only postpones the problem and does not address efficiency.
