<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Agent Loop on ByF (BaiFan) · Daily Deep Think</title>
    <link>https://blog.baifan.site/en/tags/agent-loop/</link>
    <description>Recent content in Agent Loop on ByF (BaiFan) · Daily Deep Think</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>blog@baifan.site (ByF (BaiFan))</managingEditor>
    <webMaster>blog@baifan.site (ByF (BaiFan))</webMaster>
    <copyright>CC BY-NC 4.0</copyright>
    <lastBuildDate>Thu, 07 May 2026 09:00:00 +0800</lastBuildDate><atom:link href="https://blog.baifan.site/en/tags/agent-loop/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>The Soul of an AI Coding Assistant: The Think-Act-Observe Loop</title>
      <link>https://blog.baifan.site/en/claude-code-think-act-observe-loop/</link>
      <pubDate>Thu, 07 May 2026 09:00:00 +0800</pubDate>
      <author>blog@baifan.site (ByF (BaiFan))</author>
      <guid>https://blog.baifan.site/en/claude-code-think-act-observe-loop/</guid>
      <description>&lt;!-- more --&gt;&#xA;&lt;p&gt;If you dig through the Claude Code source, you will discover a counterintuitive fact:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The core of the entire program is a while loop.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Not a complex state machine, not an elaborate pipeline, not distributed coordination — just a plain &lt;code&gt;while&lt;/code&gt; loop that does three things over and over: let the model think, let the model act, feed the results back.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;&#xA;&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;&#xA;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8&#xA;&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;9&#xA;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#xA;&lt;td class=&#34;lntd&#34;&gt;&#xA;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;while (user hasn&amp;#39;t quit) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  thinking = callLLM(conversation history + tool definitions)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  if (thinking.wants to call a tool) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    result = executeTool(thinking.toolCall)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    conversationHistory.push(result)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  } else {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    output(thinking.reply)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;That&amp;rsquo;s it? The entire secret of an AI coding assistant lives in this loop?&lt;/p&gt;</description>
      
    </item>
    
  </channel>
</rss>
