Library › Counting AI by Hand ✍️
Loop Engineering (coming soon, Sep 3, 2026)
The third lecture of Counting AI by Hand ✍️ is on September 3.
The first lecture counted the operations inside the model, and the second counted the tokens moving through an application. This one counts what happens when nobody is re-prompting: the agent reads the goal, picks an action, checks whether it is done, and goes around again. You used to be the loop. Now the loop runs on its own, and every turn of it is billed.
Here is a preview of the workbook.
About the instructor
Mohsena Ashraf is a PhD student in computer science at CU Boulder, with a research focus in HCI. Her work is on explainable AI, and specifically on making AI's cost legible to people who are not engineers.
Workbook
Three exercises, all of them the same job search agent looping until it collects five good opportunities.
Loop Cost. Eight opportunities have to be checked before five turn out to be eligible, so how many LLM calls is that, and what do the input tokens, the output tokens and the bill come to?
Expected Loops and Context Growth. Each opportunity has only a 50% chance of being eligible, so how many loops should you expect to run, and how much of what you pay for is the context that grows with every one of them?
Loop Optimization. The same three steps in two different orders, priced side by side. One order is cheaper, and the reason is that the expensive step runs fewer times.
There is a Solution sheet with every answer worked out, so you can fill the tables in yourself first or read straight through.
The recording will be posted here after the lecture.

