MLGuerrillaStart M1 →
Free · in beta·intermediate·M6·21 min read·Prereq: None. How LLMs Actually Run Things (M3) and Context Engineering (M5) give useful background.

Data & State

The capability

What are data and state in an AI system?

State is anything your system has to remember from one request to the next. As you already know from M3, the model remembers nothing between calls, so anything an AI system remembers has to live in code and storage that you own. Data and state is about figuring out where each piece of that goes, and how you keep it right while servers restart and the source data changes.

If you've built a normal web app, a lot of this will look familiar, because you're still storing rows in a database and reading them back. But an AI system brings a few problems of its own. A single run can take many steps and go on for several minutes, so you need to be able to recover from a crash halfway through without refunding a customer twice. People edit the documents the model answers from, so the copy your system searches has to keep up with them. And some of what you store is embeddings, which are basically lists of numbers you use to search by meaning, and those need their own kind of index.

If you get this right, a conversation keeps going even when the next message lands on a different server, and a long task picks up where it stopped after a crash.

Where it shows up

You'll run into this in any AI feature where the same user comes back more than once. A chat product has to keep every conversation somewhere that survives a deploy. A coding agent that runs for twenty minutes has to save how far it got. And a search feature over your company's documents has to notice when someone edits a document, and then update its copy.

Keep reading

The rest of this lesson is free with an account

Create a free account to read the remaining 10 sections. It takes about twenty seconds and there's nothing to pay. The same account opens the slide decks and CV reviews.

  1. 02The conversation list can't live in your server's memory
  2. 03What the support agent has to store
  3. 04Start with one Postgres database for all four
  4. 05Save progress after every step, and make the refund safe to repeat
  5. 06Update the knowledge base copy when the help center changes
  6. and 5 more

That's the last one written so far

Pick your next module from the board.

All modules →