問題文
An architect is implementing the agentic loop for a customer support agent using the Claude Agent SDK. The agent must keep calling tools until it has enough information to answer the customer. Which loop control condition correctly determines whether the agent should continue?
選択肢
- Continue the loop while the assistant message contains any text content, and exit when the text is empty.
- Continue the loop for a fixed maximum of five iterations, then return whatever the agent has produced so far.
- Ask Claude at each step whether it is finished, and parse the natural language reply for words like "done" or "complete".
- Continue the loop while stop_reason is "tool_use", and exit when stop_reason is "end_turn".