AI-ENGINEERING
    advanced

    Context Engineering

    AI Engineer path · lesson 83 of 124
    The idea
    The context window is a small desk: only so much fits. Context engineering is choosing which papers to lay out, filing old ones into a one-page summary, and keeping the rest in a drawer you reach into on demand — a cluttered desk slows you down, it doesn't help.
    How to use
    Check or uncheck 'compaction' and click Add agent turn to watch how the window fills — with compaction on, old turns collapse into a summary; with it off, the window overflows.
    800 / 8,000 tokens
    10% of context window
    What's in the window
    system prompt + task (always kept)800 tok
    Add turns to fill the window…

    Key insight

    The context window is a finite budget the agent loop spends every turn. Compaction trades old detail for a summary so the agent keeps running coherently; without it, long runs overflow and silently lose their earliest context.

    Budget the context window

    Sort

    Sort each item by whether it earns its tokens on every call.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Always worth the tokens

    Drop items here

    Compress or retrieve instead

    Drop items here
    6 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    Why can adding more context to the window hurt an agent?

    The short version

    The context window is a small desk: only so much fits. Context engineering is choosing which papers to lay out, filing old ones into a one-page summary, and keeping the rest in a drawer you reach into on demand — a cluttered desk slows you down, it doesn't help.

    Interview Questions

    Anthropic
    OpenAI
    Cognition
    Anthropic
    Google
    Anthropic
    OpenAI
    Anthropic
    OpenAI
    Google

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required