This article explores the critical architectural decision of where to store conversation history when building AI agents. It examines how different storage strategies impact user experience, privacy, cost, and portability. The author compares service-managed versus client-managed storage models and details how modern APIs support both linear threads and forking/branching capabilities.
Key topics include:
* Service-Managed vs. Client-Managed storage tradeoffs
* Linear (single-threaded) vs. Forking-capable conversation models
* Strategies for context window management and compaction such as truncation, summarization, and sliding windows
* How Microsoft Agent Framework abstracts these patterns using AgentSession and ChatHistoryProvider to ensure provider-agnostic code
* Practical implementation examples for the Responses API in different modes