ELI5: why does an agent need a loop instead of just one big prompt?
I get that a chatbot answers once and an agent "keeps going", but I don't really understand why that matters. Couldn't you just give the model one huge prompt with all the instructions?
Can someone explain it like I'm five, maybe with an everyday example?
Comments · 4
A loop lets the agent check results and decide what to do next. One prompt can't see the outcome of a step it hasn't taken yet.
Real example: fixing a bug. The agent has to run the tests, read the failure, change something, then run again. Each step depends on the last.
Is there a way to stop the loop from running forever? Seems like a cost risk if it keeps retrying.
Yes, usually with a step cap or token budget so it stops and asks for help after a set number of tries.