jknavigate Enteropen Ctrl+dCtrl+uscroll ggscroll top Gscroll bottom

Agent Loops

An agent is a system that perceives its environment and takes actions to achieve a goal.

The Loop

An agent runs in a loop:

  1. Receive input
  2. Predict the next tokens—which may specify a tool call
  3. The system executes any tool calls
  4. Tool output becomes part of the context
  5. Repeat until complete

Each iteration extends the context. The context accumulates information about your codebase, file states, and previous attempts.

Why Tools Matter

Without tools, an LLM can only generate text. With tools, it can:

The tools define what the agent can actually do in your environment.