Classroom / 2. The Mental Model

The Agent Loop

The Loop: Perceive → Act

The Agent is not magic. It is an infinite loop.

1. Perceive

User: "What's the weather?"

2. Think (LLM)

Context: System Prompt + Tools + User Message Thought: "I need to check the weather tool."

3. Act

Call: web_search("weather nyc")

4. Observe

Result: "75°F, Sunny"

5. Reply

Agent: "It is currently 75°F and sunny."

This loop repeats for every interaction.

Knowledge Check

What comes after the Agent 'Acts' (calls a tool)?