Short-Term Memory (STM)

beginner
Memory TypesLast updated: 2025-01-15
Also known as: STM

What is Short-Term Memory (STM)?


Short-term memory (STM) in AI agents refers to the temporary storage of recent information and immediate context, typically covering the current session or recent interactions. This memory provides the agent with awareness of recent conversation turns, temporary task state, and immediate context needed for coherent ongoing interaction. Unlike long-term memory that persists across sessions, short-term memory is often ephemeral, cleared when a session ends or when it exceeds capacity limits.


In practical implementations, short-term memory often maps to conversation buffers or recent message history that gets included in prompts to provide context for the current interaction. It might be limited by token count (to fit in the model's context window), by number of interactions (last N messages), or by time (events in the last hour). The contents of short-term memory directly influence the agent's immediate responses and behavior, making it crucial for maintaining conversational coherence and task continuity.


The distinction between short-term and long-term memory helps manage the tradeoff between comprehensive context and limited computational resources. Short-term memory provides rich detail about recent interactions without the cost of retrieving from persistent storage. When short-term memory reaches capacity, important information might be summarized and moved to long-term memory (memory consolidation) while less important details are discarded. This mirrors human memory organization and provides a practical architecture for agents that need both immediate context and access to historical information.


Related Terms