The Agent Loop
How Claude thinks
Analyze
Claude analyzes the request and current context
Understanding the goal, identifying required information, assessing current state
Analyze
Claude analyzes the request and current context
Understanding the goal, identifying required information, assessing current state
Select Tool
Selects the appropriate tool for the next step
Read, Edit, Bash, Grep, Task or another from 18+ tools
Execute
Executes action with the selected tool
Reading file, editing code, running command, etc.
Evaluate
Evaluates the result and decides what to do next
Task complete? More actions needed? Error occurred?
Each action adds information to the context. When context fills up, Claude automatically compresses it:
💡 Use /compact for manual context compression while preserving important information
Task completed
Claude determines the goal is achieved
User input needed
Confirmation or additional information required
Limit reached
Step count or context size exceeded
Error
Critical error requiring intervention
Key Understanding
Claude Code is not just a text generator. It's an agent that autonomously works in a loop until the task is complete. It can make dozens of iterations, reading files, fixing code, running tests — all without your involvement at each step.
This lesson is part of a structured LLM course.
My Learning Path