1:1 mentoring with Big Tech AI engineers
System Design

Context Engineering

What may enter one request, from whom and for how long, and the budget each kind of request gets: sources and lifetimes, one cache-safe prefix, the four moves and the failures that come from context.

Last updated

After this section you can

  • Name the sources of one request and their lifetimes
  • Set a budget per request type from measured usage
  • Decide which move each source gets
06

Context Engineering

Decide what enters each request, how long each part lives, and what each kind of request may spend.

Key idea

A request is eight sources, each with one lifetime. Budget each request type from measured usage, put the stable sources first so the cache can read them, and give every source one move: select, compress, write or isolate.

Each source has one lifetime, and each gets one move
SOURCE, IN RENDER ORDER LIFETIME THE FOUR MOVES Tool definitions per session System instructions per deploy Policy the model must follow per tenant State and memory per user, loaded at start write: keep it outside Conversation history per session, append-only compress: server summary Retrieved knowledge per request select: load when needed Tool results per step isolate: sub-agent window Output reservation per call, sets max_tokens

Top to bottom is render order. Above the dashed line is the cached prefix; below it, the newest turn.

Related

More in System Design

Get full access to all 149 sections with code examples, diagrams, and interactive animations.

Unlock Premium