Perceive the environment, reason about what to do, act through a tool, observe the result — repeat until done. Whether it’s a support bot or a research agent, the loop is the whole machine. Everything else is plumbing.
while not done: obs = perceive(environment) # inputs: tickets, APIs, files plan = reason(goal, obs, memory) # the LLM decides the next step result = act(plan, tools) # call the API, run the query memory.update(result) # observe, remember, loop
- Perceive: garbage inputs, truncated context, stale data.
- Reason: plausible-sounding plans that ignore constraints.
- Act: wrong tool, wrong parameters, no permission checks.
- Observe: results never verified — the loop declares victory early.






