The AI Agent Tutorial That Is Not an AI Agent
The AI Agent Tutorial That Is Not an AI Agent
I ran the code. The tutorial that promises to build an AI agent calls one API in a while loop, has no tool definitions, no memory of previous steps, and no ReAct cycle — the observe-reason-act loop that makes a system decide whether to keep going. Here is what that actually means.
Mahnoor Javed published "The Ultimate Beginners' Guide to Building an AI Agent in Python" on Towards Data Science on May 24. The piece is earnest, clear, and aimed at true beginners: install Python, set up PyCharm, create a .env file, pip install openai and dotenv, write a while loop, hit enter. The headline says "build an AI agent in Python." The code has a while loop. Per Javed's own description, the core implementation initializes an OpenAI client pointed at OpenRouter and calls the chat completions API inside a while True loop.
It is a fine tutorial. It is not an AI agent.
This is not a criticism of Javed's work. It is a description of a pattern.
What real agent architecture looks like
The tutorial's core code, per its own description, is a Python while loop that initializes an OpenAI client pointed at OpenRouter and calls the chat completions API in repetition. That is a chatbot architecture: send a prompt, get a response, repeat. There are no tools for the model to call, no memory of previous turns, no loop-termination logic, and no mechanism for the system to evaluate whether it has achieved its goal.
Frameworks like LangChain and CrewAI implement the agent pattern explicitly. A CrewAI sequential three-agent crew costs roughly $0.10 to $0.20 per execution in API calls, according to production benchmarks. In LangChain, an agent uses an ReAct loop — dynamically deciding the next action based on tool output rather than following a fixed script — paired with a tools component that lets the model query external data, a memory component that tracks conversation state across steps, and an iteration limit to prevent runaway processes. CrewAI adds role-specific agents defined in code or YAML configuration, each with its own toolset, that collaborate through structured pipelines. LangChain's own documentation recommends setting max_iterations between five and seven as a guardrail — a parameter the tutorial never mentions because it has nothing to guard.
The gap is architectural. A while loop runs until a human kills it. A real agent runs until it decides it has achieved the goal, hit a maximum iteration count, or encountered an error it cannot resolve.
Javed describes what an agent should do: observe, think, decide, act. The tutorial code does not implement any of those four operations as a loop. It implements prompt and response.
The tutorial is a market signal, not a bug
The proliferation of beginner agent tutorials is real information. It means the floor of agent development has dropped: anyone with an OpenRouter API key can run what gets called an agent for cents per session. The cost economics Javed's tutorial implicitly demonstrates — a free API key, a few Python packages, no server infrastructure — are the same economics that make production-grade agent frameworks cost-effective at scale. The gap between hobbyist and production is not capability. It is reliability, observability, and cost control at scale.
What a beginner tutorial labeled as "AI agent" actually teaches is how to call an LLM API in a loop. That is a real skill. It is not what the label promises.
The tutorial is worth reading if you are new to Python and want to understand how an LLM call works. It is not where you learn what an AI agent is.