What Are AI Agents?
An AI agent is a software system that uses a language model as its reasoning engine to perceive inputs, plan actions, call external tools, and iteratively work toward a goal — without a human making every decision step by step.
The key difference from a simple chatbot is the action loop. A chatbot responds to a message and stops. An agent responds, decides whether it needs more information, calls a tool to get it, observes the result, and continues until it reaches a satisfying answer or completes a task.
The Agent Loop
Every agent — regardless of framework — follows a version of this loop:
Observe → Think → Act → Observe → Think → Act → ... → Return result
In code, that looks roughly like this:
import anthropic
client = anthropic.Anthropic()
def run_agent(user_message: str, tools: list) -> str:
messages = [{"role": "user", "content": user_message}]
while True:
response = client.messages.create(
model="claude-opus-4-5",
max_tokens=4096,
tools=tools,
messages=messages,
)
# If Claude is done, return the final text
if response.stop_reason == "end_turn":
return response.content[0].text
# If Claude wants to use a tool, execute it
if response.stop_reason == "tool_use":
messages.append({"role": "assistant", "content": response.content})
tool_results = execute_tools(response.content)
messages.append({"role": "user", "content": tool_results})
# Loop back and let Claude continue reasoning
Why This Matters
The agent loop unlocks a class of tasks that pure language models cannot handle on their own:
- Multi-step reasoning — Breaking complex problems into sub-tasks
- Real-world interaction — Searching the web, reading files, calling APIs
- Dynamic decision-making — Choosing different paths based on intermediate results
- Long-running workflows — Completing tasks that take seconds or minutes
Course Structure
This course covers 7 chapters taking you from the fundamentals of the Claude API to deploying safe, cost-efficient agentic systems. You will write real Python and JavaScript code in every chapter and build three complete projects: a tool-use agent, a RAG pipeline, and a multi-agent orchestration system.