Learn Everything

Paths/AI Engineer/Prompt Engineering / Few-Shot Examples & Context Budget

Challengeadvancedubuntu:24.04Ask AI

Budget the Context Window

Every request has a token budget - instructions, retrieved context, history and the answer. Write the budget so nothing silently overflows the window.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • File ~/prompts/context-budget.yaml exists○
  • The budget states the total context size○
  • The budget reserves room for the answer○
  • The budget defines what to drop when the window fills up○

02Walkthrough

1 of 3 revealed
  1. 01

    Write the context budget

    max_context_tokens is the whole window, reserved_output_tokens is what the answer needs, and truncation_strategy says what gives way first.

    echo 'max_context_tokens: 128000\nreserved_output_tokens: 2000\ntruncation_strategy: drop_oldest_history_first' > ~/prompts/context-budget.yaml
  2. 2 locked · each failed submit reveals one

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list