Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-1557

Compact long agent runs at task boundaries, keeping decisions and open items, not raw tool output

Evidence type
documented fact
Difficulty
medium
Roles
Applied AI, ML engineer
Industries
cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    An agent run approaches the context limit after many large tool results, and quality begins to drop.

  2. Action

    Summarise at natural boundaries, keeping goals, decisions made, open issues and references to where details live, clear stale tool results, and keep durable notes outside the window to re-read.

  3. Reason

    Context engineering guidance describes compaction that keeps decisions and open bugs, clearing old tool results as the gentlest form, and notes stored outside the window.

  4. Boundary

    Agents with long, tool-heavy runs.

Symptom or risk

Old raw outputs crowd out the instructions and decisions that matter, or an automatic cut discards the one fact still needed.

Exceptions

Short runs do not need it, and summaries can drop details; keep the originals retrievable.

Trade-offs

Summaries cost a model call and may lose information.

Pitfalls

Summarising away the exact identifiers or error messages that later steps need.

Lessons and concepts

Claims and their sources

  • Anthropic's context engineering guidance describes compaction that preserves key decisions and open issues, tool result clearing of old raw outputs, and structured notes kept outside the context window.

    Effective context engineering for AI agents