Build Your First AI Agent from Scratch · 25 min · Python · Anthropic Python SDK
What Is an Agent, Really?
An agent is just a loop: the model decides, you execute, the model sees the result, and decides again — until it stops deciding to act.
Hiring signal: Every 'agent' product on the market — Claude Code, Cursor, customer support bots, research assistants — is this loop with better tools bolted on. Understanding it at the API level means you're never dependent on a framework to explain what your own code is doing.
What you will learn
- Explain the agent loop (perceive -> think -> act -> observe -> repeat) in your own words
- Distinguish a tool call from a normal chat response by reading the raw API response
- Make a single tool-augmented API call and inspect what actually comes back
Introduction
By the end of this course you'll have a terminal AI agent that takes a task like "research the top 3 vector databases and write a comparison to comparison.md", breaks it into steps on its own, actually browses and reads, writes the file, and reports back — no LangChain, no CrewAI, just the Anthropic API and about 150 lines of Python you wrote and understand completely.
Today you're not building any of that yet. You're building the one piece everything else sits on top of: a single tool-augmented API call, and you're going to read the raw response closely enough to see exactly what an "agent" actually is.
The loop, stripped of marketing language
Every agent product you've used — Claude Code, a customer support bot, a research assistant — is running the same four-step loop:
- Perceive — the model receives the current state: the task, the conversation so far, the result of anything it already did
- Think — the model decides what to do next: answer directly, or call a tool
- Act — if it calls a tool, your code runs that tool (the model can't run anything itself — it can only ask)
- Observe — you feed the tool's result back into the conversation, and go to step 1
That's it. There's no separate "agent brain." It's a chat model, a loop, and some Python that executes what the model asks for. The entire rest of this course is refining that loop and giving it better tools.
The model never runs anything
This trips people up constantly: when the model "calls a tool," it isn't executing code. It's returning a structured request — "please run web_search with this query" — and stopping. Your Python code decides whether to actually run it, what to do if it fails, and what to send back. The model has no hands. You are the hands.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Tool calling vs. a normal chat response, Your first real call, What You're Building — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy