Memory · 2026-08-19

Your agent rebuilds an expensive document-embedding index from scratch on every run, even when the documents…

Your agent rebuilds an expensive document-embedding index from scratch on every run, even when the documents haven’t changed.

  1. APersist the index and rebuild it only when the documents change
  2. BKeep rebuilding it every run to be safe
  3. CMove the rebuild onto a faster model
  4. DStore the raw user question in memory instead

Answer: A

Persist the index and rebuild it only when the documents change

Why

Stable, expensive-to-produce results should be persisted and reused; recompute only what is cheap or volatile. Rebuilding unchanged data every run just burns time and money.

More on this topic

More on Way of the Agent

Real situations from building agents - with the answer and why.

Solve a new one every day on the Path