AI Infrastructure & Tools10 min read

AI Agents

AI that doesn't just answer β€” it plans, acts, and gets things done
scope:Intermediatedifficulty:Medium

From Chatbots to Agents: The Big Leap

When you ask ChatGPT or Claude a question, they answer β€” but they don't actually do anything. You have to tell them each step manually.

AI agents are fundamentally different. Give an agent a goal, and it:

  • Plans β€” figures out what steps are needed
  • Uses tools β€” web search, code execution, API calls, file access
  • Checks results β€” verifies whether the task was done correctly
  • Self-corrects β€” tries again if something went wrong

Think of it this way: a chatbot is like calling someone for information. An agent is like hiring someone to "get this done" β€” and they handle every step and report back with results.

How Agents Work: The ReAct Loop

Most AI agents follow the ReAct (Reasoning + Acting) pattern:

  1. Think: "What do I need to do? Which tool should I use?"
  2. Act: Call a tool or run code.
  3. Observe: Check the result β€” did it work?
  4. Repeat: If needed, go back to step 1.
Note: Claude Code is an agent: When you tell Claude Code to "fix this bug," it reads files, finds the problem, modifies code, runs tests, and revises if needed. That's a real AI agent in action.

Core Components of an Agent

  • LLM (The brain): For thinking and planning β€” GPT-4, Claude, Gemini, etc.
  • Tools (Hands and feet): For taking action β€” web search, code execution, file system, API calls.
  • Memory: For remembering previous steps and results.
  • Planning: The ability to break complex tasks into smaller steps.

Real-World Agent Examples

  • Claude Code: Reads, writes, debugs code, and runs tests.
  • Devin: A software engineering agent that can build entire features.
  • AutoGPT: An early general-purpose agent for various autonomous tasks.
  • Computer Use agents: Can see the screen and use mouse and keyboard like a human.

Multi-Agent Systems

For complex tasks, multiple specialized agents can work together. Just like a software team has a product manager, developer, and tester, a multi-agent system can have a research agent, coding agent, review agent, and more.

A Simple Agent Loop (Python Pseudocode)

# Basic ReAct agent loop structure
def agent_loop(task: str, tools: list, max_steps: int = 10):
messages = [{"role": "user", "content": task}]
for step in range(max_steps):
# 1. Think: Ask the LLM what to do
response = llm.chat(messages, tools=tools)
# 2. If it's the final answer, stop
if response.is_final_answer:
return response.content
# 3. Act: Execute the tool call
tool_result = execute_tool(
response.tool_name,
response.tool_args
)
# 4. Observe: Add result to messages
messages.append({"role": "tool", "content": tool_result})
# (Loop continues β€” agent thinks about what to do next)
return "Max steps reached"
Output
# Example: "Check today's weather in Tokyo and write a tweet"
#
# Step 1: Think -> "I need to check the weather first"
# Step 2: Act  -> weather_api("Tokyo")
# Step 3: Observe -> "28Β°C, partly cloudy"
# Step 4: Think -> "Now I'll write the tweet"
# Step 5: Final -> "β˜€οΈ Tokyo is 28Β°C today..."
Challenge

Quick check

What's the key difference between an AI agent and a regular chatbot?

Continue reading