context.window_config
Context window management configuration.
Determines how the context window is managed for long-running durable agents — auto-summarization, eviction, and history archive.
ContextWindowConfig Objects
@dataclass
class ContextWindowConfig()
Configuration for context window management.
Spec example::
context_management:
enabled: true
max_tokens: 200000
compress_threshold: 0.9
summarization_model: "openai:gpt-4.1-mini"
eviction_token_limit: 20000
Attributes
enabled : bool Whether automatic context management is active. max_tokens : int Maximum context window size in tokens (auto-detected from model if 0). compress_threshold : float Fraction of max_tokens at which summarization triggers (default 0.9). summarization_model : str | None Model to use for summarization (cheaper than the agent model). eviction_token_limit : int | None Tool outputs larger than this are evicted to files. history_archive : bool Whether to persist the full conversation history for search.
max_tokens
0 = auto-detect from model
from_spec
@classmethod
def from_spec(cls,
spec_context: dict[str, Any] | None) -> "ContextWindowConfig"
Build from AgentSpec context_management dict.
from_env
@classmethod
def from_env(cls) -> "ContextWindowConfig"
Build from environment variables.