A Tour of Agents
LearnCompareBlog
Source

Lesson 4: Conversation = Messages Array — A Tour of Agents

ChatGPT remembers context because conversation is a messages array. Build multi-turn chat from scratch and see how context windows actually work.

Conversation = Messages Array Open ChatGPT or Claude, send a message, then send another. The second message knows about the first. How? The app sends every previous message along with your new one. There's no magic memory — it's literally an array that grows. In L3, each agent() call started fresh. Move the messages array outside, and now every call sees the full history. That's it. That's what LangChain calls ConversationBufferMemory. It's a list that doesn't get cleared.

Concepts covered

  • conversation history
  • multi-turn
  • context window
  • ChatGPT pattern

Framework comparison: ChatGPT, Claude, every chat agent — the messages array IS the conversation.

All lessons in this course

  1. Lesson 1: The Agent Function
  2. Lesson 2: Tools = Dict
  3. Lesson 3: The Agent Loop
  4. Lesson 4: Conversation
  5. Lesson 5: State = Dict
  6. Lesson 6: Memory
  7. Lesson 7: Policy = Guardrails
  8. Lesson 8: Self-Scheduling
  9. Lesson 9: The Whole Thing
4 / 9