Autonomous AI / The Autonomy Spectrum
Acting over long horizons needs memory.
Reviewed by Yuvaraj
When an agent runs for one chat turn, its context window is its memory: everything it needs is in the prompt. When the same agent runs for hours, days, or a week, that assumption breaks. The history of what it did grows without bound, the context window does not, and a process that lives that long will eventually crash, get rate-limited, or be redeployed. Long-horizon autonomy is therefore less about smarter prompting and more about a memory architecture and durable state: deciding what to keep, where to keep it, how to retrieve it, and how to resume after a failure.
Agent memory borrows a four-part split from cognitive psychology (the episodic/semantic distinction traces to Tulving, 1972). Each type answers a different question and lives in a different store.
| Memory type | Definition | Storage | Retrieval | Human analogy |
|---|---|---|---|---|
| Working | The current context window: task, recent turns, live scratchpad | The prompt itself (in-context) | None; already present | Short-term memory / RAM |
| Episodic | A time-stamped log of past events, actions, and observations | Append-only log or vector DB | Similarity or recency query | Autobiographical memory |
| Semantic | Distilled facts and knowledge extracted from experience | Key-value store or vector DB of notes | Lookup or similarity | General knowledge |
| Procedural | Learned routines and reusable skills |
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
| Tools, cached plans, prompt templates, code |
| Invoked as a named skill |
| Muscle memory |
For a curious beginner
Working memory is like RAM: fast, always visible, but small and wiped on restart. Episodic and semantic stores are like disk: slower to reach, but large and durable. You cannot fit a week of work in RAM, so you write things down and read the relevant page back when you need it.
How it is actually used
Every token in context costs money and latency, and models degrade when the window is stuffed. You get a fixed token budget per step, so you keep working memory small and treat episodic/semantic stores as an external retrieval layer, pulling in only the few items relevant to the current sub-task.
The underlying mechanism
A model attends over at most tokens. A week-long task emits a history with . At any step you can hold only a subset with . Memory is the policy that chooses each step and compresses the rest.
Suppose an agent monitors a fast-moving topic daily and produces a weekly briefing. The memory split keeps context bounded even as evidence piles up.
The keystone is a daily compaction step that folds yesterday's episodic log into semantic notes:
# End-of-day compaction keeps context bounded
notes = llm.summarize(
episodic_log.filter(day="yesterday"),
instruction="Extract durable facts, open questions, and cite sources.",
)
semantic_store.upsert(notes) # distilled knowledge persists
episodic_log.archive(day="yesterday") # raw events leave the hot path
checkpoint.save(agent_state) # crash-safe resume point
Each new day starts by loading a small semantic digest (a few hundred tokens) instead of the full week of raw events. Working memory stays roughly constant in size; the durable stores absorb the growth.
Maturity: EMERGING
Robust long-horizon autonomy is an active research area, not a solved problem. Over long runs, agents still drift from the goal, forget or overwrite useful facts, and let small errors in distilled notes compound. Treat multi-day autonomy as something to supervise and checkpoint, not fire-and-forget.
Common mistakes