AI-assisted development is rapidly moving beyond autocomplete and simple chat interfaces.
Instead of asking an AI model to generate a function, developers can now give an agent a task such as:
"Find the cause of this bug, inspect the relevant files, implement the fix, run the tests, and verify that everything still works."
The agent may then read dozens of files, search the repository, call tools, execute commands, inspect the results, modify code, encounter an error, retry, and continue until the task is complete.
And as AI becomes a normal part of software development, understanding how those tokens are used will become increasingly important.
This article is the first part of a three-part series about token-efficient agentic development.
Before talking about optimization, monitoring, model selection, or local AI, we first need to understand what we are actually consuming.
a full word, part of a word, punctuation, whitespace, a number, or a fragment of source code.
The model does not necessarily see this as one logical programming statement. It sees a sequence of tokens representing pieces of that statement.
your prompt, conversation history, system instructions, project instructions, source code, documentation, tool results, terminal output, error messages, retrieved files, previous agent steps.
An agent handling this task might: inspect the repository structure, read several files, search for registration-related code, inspect API calls, inspect backend validation, read existing tests, modify code, execute tests, receive an error, inspect the failure, modify the code again, rerun the tests, summarize the solution.
Every interaction between the model and its environment may involve additional tokens.
The important part is that the model often needs context from previous steps to decide what to do next.
That means a task that appears simple from the developer's point of view may involve a surprisingly large amount of model interaction.
But the agent could process tens of thousands of tokens before completing the task.
In agentic development, the visible prompt may represent only a small fraction of the actual workload.
The context window represents how much information a model can consider during an interaction.
Second, it can make it harder for the model to focus on the information that actually matters.
