Domain 5 — Context Management & Reliability (15%)
Preserving the right information across long conversations and multi-agent systems, and building reliable production behavior: escalation, error propagation, graceful degradation.
Subtopics to cover
- Conversation context strategies — sliding window, summarization, reference sections, structured state, retrieval.
- Multi-agent handoffs — what context to pass, structured handoff.
- Error propagation — how failures move through a multi-agent system.
- Escalation and graceful degradation — when to escalate to a human, how to degrade.
Key concepts
Conversation context strategies
- Context capacity ≠ attention — a big context window doesn’t mean the model attends to all of it.
- Sliding window — keep recent turns, drop older ones.
- Progressive summarization — structured summaries (decisions, preferences, facts), not vague prose. Hybrid: summaries for old turns, verbatim for recent.
- Persistent reference sections — retain exact, stable content that must stay verbatim.
- Structured state objects — track current user preferences as canonical state; update the state object rather than re-inferring from the transcript.
- Retrieval / fact stores — for precision when summaries would lose detail.
- Tool result compression — extract the relevant fields; don’t keep every RAG result forever.
- Returning users / stale data — combine structured summaries with fresh lookups; don’t resume an old transcript with stale tool results.
- External updates mid-conversation — inject as system context, not as an unsolicited user message.
- System prompt versioning — for long-lived sessions, version the prompt.
Multi-agent handoffs
- A receiving agent gets only what’s explicitly passed. Pass concise task, findings, sources, constraints, expected output shape.
- Don’t pass raw large outputs — pass compressed, structured findings.
Error propagation
- In multi-agent systems, design how errors propagate — a worker failure should surface to the coordinator as a structured result, not vanish or crash the whole run.
- Graceful partial failure — a research system with one failed subagent should return verified progress plus what’s pending, not fail entirely.
Escalation and graceful degradation
- Escalate when: the user asks for a human; authority or an exception is needed; the state is uncertain or unsafe; no progress is being made; a policy would be breached.
- A structured handoff to a human includes: customer ID, issue type, root cause, relevant records, recommended action — escalating with no useful handoff is a pitfall.
- Graceful degradation — explain verified progress, pending items, and next steps. Switch strategies when a tool keeps failing rather than blindly retrying. Never claim a side effect happened if it didn’t complete.
Common pitfalls (distractor patterns)
- Confusing context capacity with attention.
- Summarizing exact facts into vague prose (losing the detail that mattered).
- Keeping every RAG result in context forever.
- Resuming an old transcript with stale tool results.
- Injecting external updates as unsolicited user messages instead of system context.
- Escalating with no useful handoff payload.
- Blindly retrying a tool that keeps failing instead of switching strategy.
- Claiming a side effect will happen when it hasn’t completed.
Interview / exam angle
- “A long support chat — the agent forgot the customer’s verified account tier. Best fix?” — Track it in a structured state object updated canonically, not re-inferred from the transcript or buried in a prose summary.
- “When should a support agent escalate instead of resolving?” — User asks for a human, an exception/authority is needed, the state is uncertain/unsafe, no progress, or a policy would be breached — and the handoff must carry the full structured context.
- “One of five research subagents fails — what should the system return?” — The verified results from the other four plus a clear note on what’s pending; graceful partial failure, not a total abort.
- “A price changed mid-conversation — how do you tell the agent?” — Inject it as system context, not as a fake user message.
See also: ../01_agentic_architecture_orchestration/README.md (subagent context passing), ../04_prompt_engineering_structured_output/README.md (system prompt versioning).
Interview angle
- “What degrades as context grows?” - attention over a very long context is not uniform; relevant detail buried in the middle of a large window is used less reliably. That is why retrieval and compaction beat “put everything in the prompt”, even when it fits.
- “How do you compact a long conversation?” - summarise older turns while preserving decisions, constraints and open questions verbatim, and keep the recent turns intact. What you must not lose is the reasoning behind decisions already made.
- “Retrieval or context?” - retrieval when the corpus is larger than the window or changes often; context when the material is small, stable and needed in full. Cost and latency scale with tokens, so this is an economic decision as much as a quality one.
- “How do you make a long-running agent resumable?” - checkpoint state at each step so a crash resumes rather than restarts. Without it, a failure at step 40 of 50 throws away everything, which is unacceptable at agent token prices.