Building with AILesson 43 of 80

Module 5 · Conversation, memory and the interface

Where the conversation lives

In this lesson

  • 9 min read
  • 8 reading sections
  • Knowledge check
  • Lesson 1 of 9 in this chapter

This chapter’s goalBuild the stateful, user-facing half of an AI feature: a conversation store with a trimming and compaction policy, cross-session memory a user can inspect and delete, clarifying questions only where they pay for themselves, a chat or inline interface whose controls match what the model can and cannot do, a voice path with a stated latency budget, an upload pipeline with limits, and feedback capture whose numbers you can interpret rather than merely collect.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
A 128,000-token window and an 18,500-token budgetSystem prompt: fixed at 1,500Paid on every call, so a line nobody has read stillbills foreverRetrieved context: up to 3,000Five to eight chunks, chosen by the retrieval stagerather than by what fitsConversation history: capped at 12,000Trim from the oldest, and never split a tool callfrom its resultResponse reserve: 2,000This is max_tokens; without it a label costs you anessayThe window is what the model accepts; the budget is what you choose to send. They are not the samenumber, because cost rises with every token and answer quality stops rising well before the windowdoes. The response reserve is the value you pass as max_tokens.
The window is what the model accepts; the budget is what you choose to send. They are not the same number, because cost rises with every token and answer quality stops rising well before the window does. The response reserve is the value you pass as max_tokens.

Figure 5.1

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 9Free · no account needed
Lesson steps

The API forgot you the moment it answered

The first module established the fact this whole block rests on: the model API is stateless. Every request carries the entire conversation, and the provider keeps none of it for you. So a “conversation” is not something the model has. It is a list of messages that you store, assemble and resend, and every property of it (how long it is, who can see it, when it is deleted, what the model is shown) is a decision you make.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Python, from Zero, for AI exam.

Stuck on something?Ask Sayali, your AI tutor

How to cite: Addaly (2026) ‘Where the conversation lives’, in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/where-the-conversation-lives (Accessed: 29 November 2026).