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.
MAX_AGENT_MESSAGES_SIZE
Maximum size for single agent message payloads (bytes) - 10 MB.
MAX_ALL_MESSAGES_SIZE
Maximum size for entire message history payloads (bytes) - 50 MB.
MAX_LINE_LENGTH
Maximum size per line (bytes) - 1 MB. Prevents OOM on malformed output with very long lines.
MAX_MESSAGE_LIMIT
Maximum message count limit.
TRUNCATION_MARKER
Truncation marker appended when content is cut off.

Functions§

collect_with_truncation
Collect content with lazy truncation (Codex pattern). Marks truncated but continues draining to prevent pipe blocking.