Agents in 60 lines of python : Part 6

Dev.to AI
Generative AI

Memory Across Runs Lesson 6 of 9 - A Tour of Agents The entire AI agent stack in 60 lines of Python. State tracks everything - turns, tool calls, results. But close the session and it's gone. Start a new conversation and ask the agent your name. Blank. It has no idea. ChatGPT remembers your name across chats. Here's how that works - and it's simpler than you think. The problem Your agent has a state dict. It records everything that happens during a run. But state lives in memory. When the process ends, the dict disappears.