Hard

Design Context and Memory for a Long-Running Agent System Design Interview

Design context curation, compression, retrieval, and durable memory for agents operating across many hours and context windows.

1. Problem Statement

Design memory and context management for an agent that works on a project for days, uses many tools, and must resume accurately after context compaction.

2. Architecture Discussion Map

Use this as one discussion aid, not a single correct answer. Your design should follow from the requirements, scale, and trade-offs you establish.

Rendering architecture diagram...
Mermaid Source (For AI Bots)
graph LR
    A["Design Context and Memory for a Long-Running Agent"]
    A --> F1["Memory tiers and source-of-truth model"]
    A --> F2["Context selection, compaction, and eviction"]
    A --> F3["Retrieval indexing, freshness, and provenance"]
    A --> F4["Concurrent updates and consistency"]
    A --> F5["Quality, privacy, cost, and long-horizon evaluation"]

3. Key Focus Areas

  • 1
    Memory tiers and source-of-truth model
  • 2
    Context selection, compaction, and eviction
  • 3
    Retrieval indexing, freshness, and provenance
  • 4
    Concurrent updates and consistency
  • 5
    Quality, privacy, cost, and long-horizon evaluation

4. What Strong Candidates Should Demonstrate

  • Treat context as a finite attention budget rather than an append-only log.
  • Separate working state, episodic memory, semantic memory, and source-of-truth artifacts.
  • Measure whether compaction and retrieval preserve task-critical facts.

Want interactive feedback?

Practice drawing this system component-by-component on a live whiteboard while the interviewer probes at your target level.

Continue to Dashboard

Core Concepts

Context EngineeringAgent MemoryRetrievalCompactionLong-Horizon Tasks

Continue preparing

Build a complete software engineer mock interview plan

Prepare by company

Use this scenario in a focused preparation plan

Related System Design

Design a Multi-Agent Research System

Design an orchestrator-worker agent system for open-ended research with parallel search, synthesis, citations, and bounded cost.