Skip to main content
NOV 2026 New identity Latest guide updates. Latest: AI Design Patterns Local vs cloud AI Grill me Changelog →
Architecture API

stop_reason

Messages API response field explaining why generation stopped: `end_turn` (natural completion), `max_tokens` (output limit), `stop_sequence` (custom sequence matched), `tool_use` (tool call), `pause_turn` (server-tool loop paused), `refusal` (request declined), or `model_context_window_exceeded` (context limit). `max_turns` is an Agent SDK loop limit, not a Messages API stop reason. Verified against Anthropic documentation on 2026-10-05.

Learn more in the guide