Search⌘ K
AI Features

Max Output Tokens: Preventing Runaway Responses and Keeping Runs

Explore how max output tokens affect output size and behavior in AI workflows. Understand setting step-specific caps to balance completeness and token usage, recognize truncation symptoms, and log run finish reasons. This lesson helps you create predictable, bounded responses for different workflow stages and handle truncation as a key failure mode.

A support workflow produces different types of output at each step. A triage step should return a compact JSON object with a few fields, while a draft reply may need several paragraphs for the greeting, explanation, and next steps. Using one global output limit for both steps can either over-allocate tokens to triage or truncate the draft reply.

Max output tokens sets a hard cap on how much text a single run can generate, regardless of how open-ended the prompt is. That cap makes latency and spend more predictable because generation stops when the cap is reached, but it also creates a controllable failure mode when the cap is ...