📊 Module Progress
🎯 Learning Objectives
📖 Theory: The Agentic Loop
🤖 What Powers AI Agents? The Sense→Think→Act→Evaluate Loop
Every AI agent follows a continuous cycle: Sense → Think → Act → Evaluate. This repeats until the goal is achieved.
1. SENSE — Receive Input
The agent receives information from its environment. This could be a user prompt, a notification, a scheduled event, or a system trigger.
Example: User says "Research top 3 AI tools for students."
2. THINK — Plan & Reason
The agent analyzes the goal, breaks it into steps, checks available tools, and creates a plan of action.
Agent thinks: "I need to search web → compare features → summarize → present results"
Tools available: web_search, web_fetch, summarize
3. ACT — Execute the Plan
The agent uses its available tools to carry out each step in the plan. This is where the work happens.
Agent executes: Calls web_search("best AI tools for students 2026") → Fetches each result → Compiles findings into a list.
4. EVALUATE — Check if Goal is Met
After executing, the agent assesses whether the original goal has been achieved. If yes → return result. If no → adjust plan and repeat from SENSE.
Agent decides: "Did I provide 3 AI tools with links? Yes → Done. No → Re-plan."
🔍 SENSE
Receive input
🧠 THINK
Plan & reason
⚡ ACT
Use tools
EVALUATE
Goal achieved?
🔧 Key Components of an AI Agent
- Prompt/Input: The user's request or trigger event that starts the agent.
- Context Window: The agent's "working memory" — recent messages and tool results that it can reference.
- Tools: External capabilities the agent can use (web_search, write_file, APIs, etc.).
- Memory: Long-term storage across sessions — learned facts, preferences, history.
💡 Real-World Examples: The Loop in Action
Example 1: Weather Check
▼Agent (SENSE): Receives user message → recognizes need for current weather data.
Agent (THINK): "I need to use a weather tool or web search. Location: Ipoh."
Agent (ACT): Calls web_search("weather Ipoh now") → gets results → extracts temperature and forecast.
Agent (EVALUATE): "Did I provide current weather for Ipoh? Yes → return answer."
Result: "Currently 32°C in Ipoh, partly cloudy with 70% humidity."
Example 2: File Organization
▼Agent (SENSE): Receives request → identifies file operation task.
Agent (THINK): "Steps: 1) List files in Downloads 2) Filter for .pdf extension 3) Create PDFs folder if missing 4) Move files 5) Report summary."
Agent (ACT): Uses file tools → lists Downloads → finds 15 PDFs → creates folder → moves all → counts moved items.
Agent (EVALUATE): "All PDFs moved? Yes (15/15) → Done!"
Result: "Done! Moved 15 PDF files to Downloads/PDFs/"
Example 3: Research Task
▼Agent (SENSE): Gets request → identifies it as research task requiring real-time info.
Agent (THINK): "Break down: Search for Python courses → Find top 5 → Extract prices → Format as list. Tools needed: web_search ×5, maybe web_fetch for details."
Agent (ACT): Runs web searches, visits course pages, extracts pricing data.
Agent (EVALUATE): "Did I return 5 courses with prices? Yes → complete. Missing price for one? → Search again for that course."
Result: Presents structured list: 1) Coursera — $49/month, 2) edX — Free audit, 3) ...
🧪 Hands-On Exercise
Try the Agentic Loop Yourself (10 minutes)
Good examples: "Search for latest news about AI", "Summarize this article: [URL]", "Calculate compound interest on $1000 at 5% for 10 years."
Step 2 — Give the task to an AI agent
Use OpenClaw, Claude with tools, or ChatGPT Advanced Data Analysis. Type your prompt clearly.
Step 3 — Observe the loop in action
Watch for: 1) Does the agent acknowledge it needs to use tools? 2) Does it break the task into steps? 3) Does it call tools sequentially? 4) Does it evaluate the result before responding?
Step 4 — Reflect
Did you see the complete Sense→Think→Act→Evaluate cycle? Which step was most obvious? What would happen if the agent failed at evaluation?
💡 Pro Tip: Prompt Engineering for Better Loops
Bad: "Find me AI tools."
Better: "Search for the top 5 AI tools for students, compare their features, and present a table with tool name, key feature, and pricing."
The better prompt helps the agent create a clearer plan → better execution → better results.
📝 Quiz: How AI Agents Work (5 Questions)
Test your understanding of the agentic loop and its components.