Agent state persistence is built into the SDK—every agent checkpoint preserves its memory. But for richer patterns, you need structured memory: semantic memories the agent can reference, session summaries, and user preferences that persist.
Design your memory architecture: working memory for current context, episodic memory for conversation history, semantic memory for learned facts. The agent can query memory to inform its responses—memory is the scaffold for intelligence.
Storage choices matter: KV for simple data, D1 for structured memory with queries. Embeddings for semantic search: store embeddings in Vectorize, then search similar memories. Memory consolidation—periodically summarizing older memories—keeps agents fast.