37.1 What an "agent" is in practice

Overview and links for this section of the guide.

The ReAct Loop

ReAct (Reason + Act) is the fundamental loop of agents. 1. **Observation:** "I see a file named `data.csv`." 2. **Thought:** "I should read the first 5 lines to understand the columns." 3. **Action:** `read_file("data.csv", lines=5)` 4. **Observation:** "The columns are: id, name, email." 5. **Thought:** "Now I can answer the user's question."

State Management

An agent is just a script that maintains a list of messages (the "scratchpad"). Every time it takes an action, the result is appended to the scratchpad. This context grows until the task is done or the window is full.

Where to go next