📖 Step 9: AI/LLM#252 / 291
Agent Loop
Agent Loop
📖One-line summary
The observe → think → act cycle an agent repeats to make progress on a task.
💡Easy explanation
The agent's working pattern of "observe → think → act," repeated. Lets it tackle work that doesn't finish in one step.
✨Example
A pattern of making progress through iteration
while (!done && iter < 10) {
observation = read()
thought = think(observation)
action = act(thought)
done = check(action)
}
iter = 1
⚡Vibe coding prompt examples
>_
Implement an observe → think → act agent loop in TypeScript with a max of 10 iterations and an exit condition.
>_
Write a helper that, when token usage in the loop is about to exceed the limit, automatically summarizes the context.
>_
Build a React UI that shows the user, in real time, where the agent currently is in its loop.
Try these prompts in your AI coding assistant!