Skip to main content

Module output_limits

Module output_limits 

Source
Expand description

Output limits to prevent unbounded memory growth. Output truncation limits inspired by OpenAI Codex multi-tier truncation. Prevents OOM with three independent size limits. Reference: https://openai.com/index/unrolling-the-codex-agent-loop/

Constants§

DEFAULT_MESSAGE_LIMIT
Default message count limit for history.
ERROR_LOG_BUFFER_SIZE_LIMIT_BYTES
Maximum retained error-log payload bytes in the in-memory collector (10 MiB).
MAX_AGENT_MESSAGES_SIZE
Maximum size for single agent message payloads (bytes) - 4 MB.
MAX_ALL_MESSAGES_SIZE
Maximum size for entire message history payloads (bytes) - 24 MB.
MAX_LINE_LENGTH
Maximum size per line (bytes) - 256 KB. Prevents OOM on malformed output with very long lines.
MAX_MESSAGE_LIMIT
Maximum message count limit.
TINY_PREVIEW_BYPASS_BYTES
Legacy small-preview threshold retained for API compatibility. Per-result limiting no longer needs a separate verifier reserve.
TURN_PREVIEW_BUDGET_BYTES
Maximum fallback preview size for one execution result (64 KiB). Historical names are retained for API compatibility; these are per-result limits, never an aggregate allowance. History compaction bounds accumulated context without disabling tools or hiding subsequent evidence.
TURN_PREVIEW_BUDGET_BYTES_PLANNING
Maximum fallback preview size for one planning result (96 KiB).
TURN_TINY_PREVIEW_BUDGET_BYTES
Legacy verifier reserve retained for API compatibility; no longer enforced.

Functions§

turn_preview_budget_bytes
Effective per-result preview limit for the active workflow mode.