AI Agents and Automation
How AI agents plan, use tools, and act over many steps: the promise, the real risks, and the 2023 AutoGPT and BabyAGI wave.
Artificial Intelligence · Lesson 5
How AI agents plan, use tools, and act over many steps: the promise, the real risks, and the 2023 AutoGPT and BabyAGI wave.
Most people first meet AI as a single exchange: you type a prompt, the model answers, and you are done. An agent is different in kind, not just degree. It wraps the model in a loop and gives it a goal instead of a question, so the system can plan a sequence of steps, take actions in the world such as searching the web, running a calculation, or editing a file, look at the results, and decide what to do next. The appeal is obvious: describe an outcome and let the software handle the middle.
That appeal is also the risk. A single wrong answer is easy to catch, but a chain of fifty actions, each slightly off, can drift somewhere you never intended, and by the time you notice, real actions have already been taken. Knowing what agents can and cannot reliably do is now a practical skill for anyone building with AI, because the gap between an impressive demo and a dependable product is exactly this.
A plain model call is stateless: input in, text out. An agent adds memory and a control loop. It typically follows a cycle often summarized as plan, act, observe, repeat: propose a next step, carry it out, read the outcome, and update the plan until the goal is met or a stopping rule fires. The model is still just predicting text at each step; the agent is the scaffolding around it that turns those predictions into a sequence of actions.
An agent is only as capable as the tools it can reach. Major providers added a feature commonly called tool use or function calling: the model can output a structured request to run a named tool with specific arguments, such as a search, a calculator, a database query, or code execution, and the surrounding program runs it and feeds the result back. This is what lets a text model act on the world instead of only describing it. Crucially, the model does not run the tool itself; it asks, and your code decides whether and how to comply.
Errors compound. If each step is 90 percent reliable, ten steps in a row are far less than 90 percent reliable overall, because mistakes multiply rather than average out. Agents also get stuck in loops, pursue dead ends, hallucinate a tool result, or confidently declare a task finished that they never actually completed. On narrow, well-specified tasks they can work well; on complex, open-ended goals they remain unreliable, which is why serious deployments keep a human in the loop and limit what actions an agent may take unsupervised.
Suppose you ask an agent to book the cheapest weekend flight to a nearby city. A single prompt cannot do this; it needs to act. The agent plans: search flights, compare prices, pick one, fill the booking form. It calls a search tool, reads the prices (observe), narrows to two options, then calls a booking tool. At each step it decides the next action from what it just saw. If everything goes right, you get an itinerary. Notice how many tool calls and judgments sit between your one sentence and the result, and how each is a place something could go wrong.
Not every task needs an agent. If you want a paragraph rewritten, a single well-crafted prompt is faster, cheaper, and far more predictable than a multi-step agent. Adding a loop and tools to a task that does not require them mainly adds cost, latency, and new ways to fail. Agents earn their complexity only when a goal genuinely requires several dependent actions and outside information; otherwise the plain call wins.
In 2023 a wave of experimental projects tried to make language models fully autonomous. AutoGPT, released in March 2023 by Toran Bruce Richards under the Significant Gravitas name, chained GPT-4 calls together so the system would generate its own sub-tasks and pursue a high-level goal with little human input; it became one of the fastest-starred repositories in GitHub's history. Around the same time, Yohei Nakajima published BabyAGI, a compact script that used a language model to create, prioritize, and execute a task list in a loop. Both captured enormous attention as a glimpse of autonomous software.
They also made the limits concrete. Users and commentators widely reported that these agents frequently got stuck in loops, wandered off task, repeated work, ran up API costs, and failed to complete complex open-ended goals reliably. In parallel, providers shipped the more grounded building block: OpenAI introduced function calling in its API in June 2023, and other providers added comparable tool-use features, giving developers a structured, controllable way for models to invoke external tools. The lasting lesson from that year was not that autonomy had arrived, but that tool use is genuinely powerful while fully autonomous agents remained experimental and unreliable for hard tasks.
Take a goal you would hand to an agent, like planning a birthday dinner. Write out the plan, act, observe steps and, next to each, the tool it would need and one way that step could fail. Count the failure points; that number is why oversight matters.
Think Like a Maester: An agent multiplies both your reach and your mistakes, so give it tools freely but autonomy sparingly.
An AI agent wraps a model in a loop and a goal, letting it plan, use tools, observe results, and take multi-step actions instead of answering once. The capability that makes this possible is tool use, or function calling, in which the model requests a named tool and your code runs it. The promise is real, but so are the risks: errors compound across steps, agents get stuck or hallucinate progress, and they remain unreliable on complex open-ended tasks. The 2023 wave of projects like AutoGPT and BabyAGI showed both the excitement and the limits, while providers' function-calling features became the durable building block. Build with agents where a goal truly needs several dependent actions, keep a human in the loop, and limit autonomy on purpose.
Mark this lesson complete to track your progress.