Lesson 411 lessons

Memory — Short-term and Long-term

Short-term memory: the current task context

Within a single agent run, short-term memory is simply the conversation/action history so far — what's been tried, what results came back. This lives only for the duration of that task.

Long-term memory: persisting across runs

Long-term memory stores durable facts or learned preferences in a database, retrieved and injected into future agent runs — allowing the agent to "remember" a user or past decisions across sessions.

Avoiding context bloat

Not everything should be remembered forever. Design a clear policy for what gets stored long-term (key decisions, preferences) versus what's discarded after the task (intermediate reasoning, tool call noise).

Key Takeaways

  • Short-term memory is the current task's action history.
  • Long-term memory persists durable facts across separate agent runs.
  • Store long-term memory in a database, injected into future context.
  • Have a clear policy for what's worth remembering vs. discarding.

Design a memory policy

Write down 3 types of facts your agent should remember long-term about a user, and 3 types it should discard after each task.