An agentic loop receives a response with stop_reason: "max_tokens". The response content includes one tool_use block with a valid tool name and input. What is the correct next action?
Answer: Append the partial response to messages, execute the tool call, and continue the loop
When stop_reason is max_tokens and the response contains a tool_use block, the model was mid-execution when it hit the token limit. The pending tool call must be executed and its result appended before the loop continues — the model is waiting for that result. Stopping the loop drops in-progress work. Retrying with higher max_tokens starts a new generation and loses the partial tool call. Discarding and restarting wastes all prior progress.