[F]CCAF101
BootcampClassroomPracticeDemosBlogEnterpriseContact
Log inGet the guide
CCAF101

Ameureka × CCAF101 Chinese CCA-F / CCAF learning community.

  • X (Twitter)

Learning

  • Guide
  • Bootcamp waitlist

Service

  • Enterprise
  • Contact

Switch language

CCAF101 is an independent third-party learning community, not affiliated with, sponsored by, or authorized by Anthropic. CCAF, Claude, and CPN are products or trademarks of Anthropic; all trademark rights belong to their respective owners. For certification policy and exam information, always defer to Anthropic's official announcements.
© 2026 Ameureka × CCAF101
Privacy PolicyTerms of Service
Enterprise services by Ameureka; learning content by CCAF101.
CCAF101 · Claude Certified Architect - Foundations · MODULE 01

The Agentic Loop智能体循环

发请求 · 读 stop_reason · 执行工具 · 回灌结果——循环的生命周期。单步跑一遍:stop_reason 如何驱动工具调用与终止。

This demo is unofficial, original practice content written from public exam objectives — not real exam questions.

迭代 0/3·messages[1]
场景 · 用户「统计本周新增的注册用户,并按来源渠道分组。」
可用工具query_usersgroup_by
AGENTIC_LOOPPython
1messages = [{"role": "user", "content": prompt}]2 3while True:4    resp = client.messages.create(5        model="claude-sonnet-4-6",6        tools=tools,7        messages=messages,8    )9    messages.append({"role": "assistant", "content": resp.content})10 11    if resp.stop_reason == "end_turn":12        break13 14    tool_results = []15    for block in resp.content:16        if block.type == "tool_use":17            output = run_tool(block.name, block.input)18            tool_results.append({19                "type": "tool_result",20                "tool_use_id": block.id,21                "content": output,22            })23    messages.append({"role": "user", "content": tool_results})
Conversation Historymessages[1]
  1. USER · 用户

    统计本周新增的注册用户,并按来源渠道分组。

stop_reason
等待响应

请求尚未返回,下一步将看到 stop_reason。

工具执行 · 本步

本步未发生工具调用。

GUIDE · 引路

对话刚开始,messages 数组里只有一条 user 消息。点「下一步」把它发给 Claude,看它决定先做什么——而不是我们替它决定。

开始 · 2 tools