Nearby lessons
23 of 49Prompt Engineering - Stop Conditions
Stop Conditions — Know When to Stop
A stop condition is a rule that tells AI when to stop. Without one, AI can loop forever — an infinite loop that wastes time and money.
Stop conditions + retry limits + output limits = controlled execution.
In simple words: Smart AI knows when to stop. Control your process, control your results.
The cleaning-room example:
- Without a rule → you clean forever.
- With the rule "clean for 30 minutes, stop when the room is clean" → you finish.
AI needs the same kind of boundary.
| Without Control | With Control |
|---|---|
| Infinite loop | Safe stop |
| High cost | Controlled cost |
| No limits | Clear limits |
| Unstable | Stable |
Example01
📝 Key Takeaways
- A stop condition tells AI when to stop — without one it can loop forever.
- An infinite loop wastes time and money.
- Retry limits + output limits + stop conditions = controlled execution.
- The cleaning rule: "clean for 30 minutes, stop when the room is clean".
- If the max limit is reached, return the best available output.
- Smart AI knows when to stop.
🧠 Test Your Knowledge
2 QuestionsProgress: 0 / 2