First AI agent, built from scratch
The agent breaks the problem into steps, calls a calculator tool for each one, and shows you every turn of the loop until it has the answer.
"Agents are models using tools in a loop." This one is built from four parts, in plain Python with no agent framework.
eval()
Based on Leonie Monigatti's guide AI Agent from Scratch in Python. The trace under each answer shows this loop as it runs.