The AI Agent Loop
Observe, Think, Act, Learn: the cycle that replaces rigid rule-based automation
Read current context: user request, data from APIs, error messages, previous results
Plan the next action. The LLM reasons about tools to call, order of operations, potential failures
Execute the plan: call an API, run a query, send a message, write a file, browse a page
Evaluate the result. Did it work? If not, adjust the plan and loop again with new context
Traditional automation follows rigid rules: "if X, then Y." AI agents break this limitation. They observe context, reason about what to do, take action using tools, and learn from the result. This makes them perfect for automations that require judgment, natural language understanding, or handling edge cases.
If you've taken the Agentic Web course, you understand the theory. This module is about putting agents to work as practical automators.
The operational difference between a script and an agent is adaptability. A script that processes job listings breaks when the API changes its response format. An agent reads the new format, adjusts its parsing logic, and continues processing. This strength is why agents are replacing brittle rule-based automation in production workflows. The tradeoff is cost and latency: every agent action involves an LLM inference call. The decision framework is straightforward: use agents for tasks that require reasoning, and use scripts for tasks that are purely mechanical.
Tool Calling in Practice
How an agent decomposes a natural language request into API calls
"Find all open engineering jobs at Stripe and add them to my spreadsheet"
I need to: (1) call the Stripe jobs API, (2) filter for engineering roles, (3) format the data, (4) write to Google Sheets
fetch("https://api.stripe.com/jobs") → Returns 47 positions
filter(jobs, department="Engineering") → 12 matches
sheets.update("Jobs!A2:E13", formattedData) → 12 rows written
"Done. Added 12 engineering positions from Stripe to your Jobs spreadsheet."