PATCHBOOK SERIES Part of the Patchbook Series

Chapter 1: It sounds more complicated than it actually is

If you read tech news or social media, AI agents sound almost mystical. They are described as autonomous digital workers, cognitive architectures, and emergent intelligences that plan, reason, and act across your systems.

It sounds like you need to learn an entirely new paradigm of computing before you can write a single line of useful agent code.

You don't.

The illusion of magic

When people interact with tools like ChatGPT or coding assistants like Claude Code, they experience a cohesive personality that seems to have intentions and memory.

Because the output feels alive, it is tempting to assume the underlying software architecture must be equally mysterious.

It isn't. When you strip away the branding and marketing, an "AI agent" is not a unified, conscious entity. It is an ordinary software program built from three basic primitives you already understand:

  1. Host Control Flow: Everyday code you already write in your favorite programming language (variables, arrays, if statements, and loops).
  2. The Network Wire: A regular HTTPS POST request sending JSON and receiving JSON.
  3. The LLM Transformation: A remote, stateless function running on a server farm that takes text in and returns text out.

The three primitives: Host Control Flow, an HTTP POST request, and the remote LLM

Where does "agency" actually live?

Here is the central secret of agent development: the LLM itself has no agency.

The model sitting on OpenAI's or Anthropic's servers does not have goals. It does not have a clock. It does not "think" in the background while waiting for your next prompt. It has no memory of who you are or what you asked two seconds ago.

An LLM is completely dormant until an HTTP request arrives. When a request lands, the model processes the incoming text, predicts the next sequence of characters, returns the response over the wire, and immediately goes back to sleep.

The "agency" (the loop of trying an action, reading the result, deciding what to do next, and persisting until a task is done) does not live inside the AI model.

The agency lives entirely in your host code.

Everyday software craft still applies

This is good news for software engineers.

Because agents are just regular programs wrapped around remote stateless API calls, you don't need to throw away everything you know about building reliable systems.

The mathematical titans and machine learning researchers did the heavy lifting during model training. In our workshop, all we are doing is orchestrating remote function calls with standard software engineering tools.

In the next chapter, we will look at the single simplest mechanism that turns these primitives into an active agent: a basic while loop.