Building AI Agents from Scratch

What Is an AI Agent?

LLM vs chatbot vs workflow vs agent — and what actually makes software agentic.

A language model predicts tokens. That is all it does. An agent is software you write around that model: a loop, a list of tools, and a stop condition. If you skip those pieces you have a chatbot, a script, or a slide deck — not an agent.

This course builds the pieces in Python against an OpenAI-compatible Chat Completions API. You will not install LangChain, CrewAI, or AutoGen. You will own run().

LLM, chatbot, workflow, agent

  • LLM — one request, one completion. No tools. No loop. Useful for rewrite and classify.
  • Chatbot — messages go back and forth. History matters. The model still cannot do anything outside the text.
  • Workflow — you decide the steps in code (if, queues, webhooks). The model fills slots. Reliable, rigid.
  • Agent — the model chooses the next action from tools you exposed. You run the action and feed the result back. Repeat until it stops.

A workflow is the right default when the path is known. An agent earns its keep when the next step depends on what the last tool returned — search, then read, then file a ticket — and you refuse to encode every branch.

What makes software agentic

  • A goal in the user message (and a system prompt that states limits).
  • A loop you wrote: model → maybe tool → observation → model again.
  • Tools with names, descriptions, and JSON schemas — not a raw OpenAPI dump.
  • A stop: final text, max steps, or a human gate.

If the model cannot change the outside world and cannot see a result, it is not acting. Next: make one honest model request before you add a loop.