Context Engineering

Optimizing the entire set of tokens provided to an LLM, beyond just the prompt, to consistently achieve desired behaviors and outcomes from AI agents.

When to use

When building complex AI agents or applications where the model's behavior needs to be consistently steerable and reliable across multiple interactions or steps.

How to apply

  1. Consider all information that might be present in the LLM's context window at any given time, not just the explicit prompt.

  2. Identify and curate the optimal set of tokens (information) to include in the context.

  3. Actively manage and maintain this context throughout the agent's operation to ensure the LLM always has the most relevant and useful information.

Glossary

Context Window
The maximum number of tokens (words or sub-word units) that an LLM can process or 'see' at one time. Information outside this window is not considered by the model.
Tokens
The basic units of text that a language model processes. These can be whole words, parts of words, or even individual characters, depending on the model's tokenizer.
AI Agents
Autonomous or semi-autonomous software systems that use LLMs to perceive their environment, make decisions, and take actions to achieve specific goals.