Skip to content
RED SAGSkills
hardPrompt Engineer interview question

An agent runs long tasks that exceed its context window. How do you manage context so quality stays high?

What the interviewer wants to hear

  • Keep the stable prefix small and cacheable
  • Trim or summarise old tool outputs
  • Persist key state and notes outside the context
  • Use sub-agents or fresh contexts for subtasks
  • Test that critical facts survive compaction

Model answer

Even before the hard limit, very long contexts cost more, slow down and can make the model miss details, so I manage context actively. The system prompt and tool definitions stay compact and stable at the start, which also keeps prompt caching effective. Large tool outputs are trimmed to what matters, and old ones are cleared or replaced with short summaries once they have been used. Important state, such as the plan, decisions, open questions and progress, is written to external notes or memory files that the agent can re-read, so compaction does not lose it. For big subtasks, I can hand work to a sub-agent with a fresh context that returns only a concise result. Then I test long runs specifically, checking that key facts and constraints from early on are still respected later.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Prompt Engineer questions