Definition

What is stop_reason? — Plain-Language AI Definition

The field in a Claude API response that indicates why the model stopped generating, used to control agentic loop flow.

What is stop_reason?

stop_reason is a field returned in every Claude API response. It tells your code why the model stopped generating text. The two most important values are end_turn (the model is done) and tool_use (the model wants to call a tool).

Key Values

  • end_turn -- The model has finished its response
  • tool_use -- The model wants to call one or more tools
  • max_tokens -- The response was cut off because it hit the token limit
  • stop_sequence -- The model hit a custom stop sequence

Key Takeaway

stop_reason is the control signal for agentic loops. Check it after every API call.

Learn This in Practice

Move from definition to application with guides and resources that show how this concept appears in real AI workflows.

Get AI Tips Every Week

Get smarter about AI every week — practical tips, prompts, and workflows in your inbox.