Stateless
The model remembers nothing between calls. Each request starts from a blank slate.
Last updated
Analogy
A REST API with no session cookie. It greets you like a stranger every time, no matter how many times you've met.
Code example
// Call 2 must carry the whole conversation againconst messages = [ { role: "user", content: "My name is Faisal" }, { role: "assistant", content: "Nice to meet you, Faisal!" }, { role: "user", content: "What's my name?" },];In an agent
"Memory" in an agent means your code stores the messages and resends them on every call.
Practice
Interview questions
- How do you handle memory?
- Short-term memory is the message history, trimmed or summarized near the context limit.
- Long-term facts go to a database and are retrieved when relevant.
- For multi-step tasks, LangGraph checkpoints in Postgres hold the working state.
Questions people ask
Does ChatGPT remember my conversation between API calls?
The API does not. Every request starts from a blank slate, and the model only sees what you send in that request. Chat apps feel like they remember because the app stores the conversation and sends it again with every new message. Your own code has to do the same.
How do agents have memory if the model is stateless?
Your code keeps the memory. It stores the messages array and resends it on every call, which is short-term memory. It can also save facts to a database for long-term memory, and save the agent's progress in a checkpointer. The model itself never stores anything between calls.