---
published: true
id: context-window
title: Context Window
description: Knowledge captured in João Lopes' learning graph.
tags:
- ai-engineering
- llm
- agent-design
locale: en
resource: https://joaolopes.dev.br/knowledge/concepts/en/context-window/
created: '2026-03-19'
---

# Context Window
The maximum amount of text a language model can process in a single inference, measured in tokens.

## Definition
The context window is the total token budget a language model has for a single inference — conversation history, system prompt, tool definitions, file contents, and outputs all count against this limit. For AI agent workflows, the context window is the primary resource to manage. Instructions loaded at session start consume budget that could hold conversation history or tool results. As the window fills, earlier content — including behavioral rules — gets evicted or compressed, which is why behavioral modeling degrades under pressure.

## Source
- [Context window - Wikipedia](https://en.wikipedia.org/wiki/Context_window)

## Related
- behavioral-modeling
- [Hooks](/concepts/en/hooks.md)
- [Context](/concepts/en/context.md)
