Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Design and implement context management in single agents and between agents, including context accumulation, retrieval, injection, and compaction

A worked example

Complete the statement

A retailer runs a multi-agent system on Azure OpenAI models.

  • Each agent has an explicit per-request token budget. Before invoking an agent, the assembler compresses any context that exceeds that agent's budget and logs the overrun, including what it compressed.
  • The stock-check agent handles single-turn requests and is called directly by the orchestrator. Its system prompt is short.
  • Each inventory API call returns a 50-field product record. The agent uses only three fields: product name, current stock level, and price.
  • Finance has fixed the budgets, and they cannot be raised.
  • No additional model invocations may be added to the request path.

Complete the sentences to meet the requirements.

To find which agents regularly exceed their token budgets, review . To reduce the stock-check agent's budget overruns, .

  • Blank 1: monthly analysis of logged budget violations (correct answer)

    Correct: each budget overrun is logged with details of what was compressed, and analysing these logs every month shows which agents keep exceeding their budgets. cached_tokens reports prompt cache reads, not budget overruns. The digest validation model checks whether a summary lost facts, not budget size. The assembler's priority order sets which components it prunes first, not which agents overrun.

  • Blank 2: extract only the referenced fields with an agent-specific tool result schema (correct answer)

    Correct: the overruns come from full API responses, and a tool result schema injects only the fields the agent uses, with no extra model call. Raising the budget is ruled out because finance has fixed the budgets. Summarizing with a model adds a model invocation, which is not allowed. A sliding window over conversation turns does not help because the requests are single-turn and the excess tokens come from tool results.

Why

The logged budget violations, reviewed each month, show which agents consistently exceed their budgets. For the stock-check agent, the excess comes from injecting full 50-field inventory records when it uses only three fields. An agent-specific tool result schema extracts just those fields before they are injected into context. This cuts tokens without raising the budget or adding a model call.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free