# Stateful

Concept · [Building with AI](https://ecosystem.samcarlton.com/ai)

Also called: state, statefulness, keeps state, persistent state

Describes something that carries information forward from one moment to the next. A [session](https://ecosystem.samcarlton.com/session) is stateful because each message builds on the earlier ones. Files and [databases](https://ecosystem.samcarlton.com/database) are stateful because they stay put between sessions.

**For example:** An order saved to the customer [database](https://ecosystem.samcarlton.com/database) on Monday is still there on Friday. The database is stateful; the model that helped write the order confirmation remembers nothing.

## Connects to (5)

- [Stateless](https://ecosystem.samcarlton.com/stateless): Describes something that keeps nothing between uses.
- [Session](https://ecosystem.samcarlton.com/session): One stretch of work with an AI agent, from a blank start until it is cleared, closed or compacted.
- [Memory system](https://ecosystem.samcarlton.com/memory-system): A setup that tries to give an agent memory across sessions by saving notes to files or a database and loading them back when a new session…
- [Database](https://ecosystem.samcarlton.com/database): Organized storage for your app's information, such as users, orders and messages, so it can be saved and looked up later.
- [Agent environment](https://ecosystem.samcarlton.com/agent-environment): Everything outside the agent's own software that it can look at or change: your files, terminal, browser, databases and connected services.

Map view: https://ecosystem.samcarlton.com/stateful
