<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chris Gougui</title>
    <description>The latest articles on DEV Community by Chris Gougui (@cgougui).</description>
    <link>https://dev.to/cgougui</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4127559%2F67ec8af7-5794-487c-ae2d-3071f5265b70.jpeg</url>
      <title>DEV Community: Chris Gougui</title>
      <link>https://dev.to/cgougui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cgougui"/>
    <language>en</language>
    <item>
      <title>I traced the agentic calls. Here's where the token consumption comes from</title>
      <dc:creator>Chris Gougui</dc:creator>
      <pubDate>Wed, 16 Sep 2026 08:12:02 +0000</pubDate>
      <link>https://dev.to/cgougui/i-traced-the-agentic-calls-heres-where-the-token-consumption-comes-from-52nf</link>
      <guid>https://dev.to/cgougui/i-traced-the-agentic-calls-heres-where-the-token-consumption-comes-from-52nf</guid>
      <description>&lt;p&gt;I expected an agentic coding assistant to use more tokens than a simpler tool. I didn't expect the difference to be this large.&lt;/p&gt;

&lt;p&gt;For the exact same simple coding task, I measured:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Pi&lt;/th&gt;
&lt;th&gt;Aider&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LLM calls&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON exchanged&lt;/td&gt;
&lt;td&gt;~760 KB&lt;/td&gt;
&lt;td&gt;~100 KB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The task was very simple: a small PyQt project, two files, and a single instruction — &lt;strong&gt;"Make the cards width = total_width / 3."&lt;/strong&gt; I already knew exactly which two files needed to be changed.&lt;/p&gt;

&lt;p&gt;That made me curious about what was actually happening under the hood.&lt;/p&gt;

&lt;p&gt;My API bill had gone above $400/month, despite trying various techniques to reduce token usage. My company doesn't pay for it, so I wanted to understand where all those tokens were going.&lt;/p&gt;

&lt;p&gt;I therefore traced the exchanges between a coding harness and the LLM during a simple coding task.&lt;/p&gt;

&lt;p&gt;To make the test as clean as possible, I used Pi with no add-ons. I explicitly added the two files that needed editing to its context, then compared the result with the exact same prompt in Aider.&lt;/p&gt;

&lt;p&gt;Here is an overview of the Pi workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User&lt;/strong&gt; sends prompt: "Make the cards width = total_width / 3" and tags A.py and B.py.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; responds with read tool calls to fetch the contents of both files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Harness&lt;/strong&gt; returns the full text of both files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; generates internal thoughts about UI design (adding color blue) and uses the edit tool on A.py and B.py to restructure the layout.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Harness&lt;/strong&gt; confirms: "Successfully replaced 2 block(s)".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; uses the edit tool on B.py to add the new CSS classes for the updated components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Harness&lt;/strong&gt; confirms: "Successfully replaced 2 block(s)".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; sends a text response to the User summarizing the design changes (Modern layout, Visual Hierarchy, Selection states).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So you see: for a simple request where I already know what files to edit, there are 3 back and forth with the LLM.&lt;br&gt;
The total size of the json files exchanged is 760kB. Not huge, but again this is a very trivial test. &lt;/p&gt;

&lt;p&gt;The ah-ah moment came when I compared this with the exact same prompt with aider. &lt;/p&gt;

&lt;p&gt;Here is the aider workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Harness&lt;/strong&gt; sends a massive, pre-assembled prompt containing:

&lt;ol&gt;
&lt;li&gt;A "Repo Map" (summaries of all files in the project to provide global context).&lt;/li&gt;
&lt;li&gt;The full, raw text of the files the user "added" to the chat (A.py and B.py).&lt;/li&gt;
&lt;li&gt;Strict system instructions on how to format SEARCH/REPLACE blocks.&lt;/li&gt;
&lt;li&gt;The user's actual prompt: "Make the cards width = total_width / 3"&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; generates internal thoughts to figure out the Qt layout math.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM&lt;/strong&gt; responds with a text explanation of the planned changes, followed by three specific SEARCH/REPLACE blocks targeting A.py &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here we have a single LLM call. The first prompt is larger, but contains all the necessary context for the LLM to work.&lt;br&gt;
The total size of the json files exchanged is only 100kB !&lt;/p&gt;

&lt;p&gt;Of course, the experiment is excessively simple and fits a case where I already know which files need editing. But in my experience, this is actually the case for a majority of my daily tasks. I don't need an agent to "discover" them and burn tokens in a loop. I just need a tool that applies the edits efficiently.&lt;/p&gt;

&lt;p&gt;Aider is fantastic for this, but I unfortunately it is not maintained anymore. So I ended up building my own lightweight harness around this exact single-prompt philosophy called Frugaast.&lt;/p&gt;

&lt;p&gt;By switching part of my workflow away from agentic loops and just using single-shot edits for known files, my API bill dropped from $400+ to under $100 a month.&lt;/p&gt;

&lt;p&gt;Has anyone else traced their AI editor's network calls? I'm curious if other popular tools like Cursor or Copilot are hiding massive token bloat under the hood.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>coding</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
