part one

Part 1 Building your first LLM agent

 

The term AI agent is used broadly, but the underlying idea is simple. An LLM serves as the brain, tools give it a way to act on the world, and a loop ties the two together so the agent can keep working until a task is done. This part focuses on assembling those three elements from scratch so that by the end, you have a small working agent. We skip frameworks on purpose. After youve built the internals yourself, any framework you pick up afterward becomes easy to read because you already know whats happening underneath.

Chapter 1 defines an agent and draws a clear line between agents and the chatbots or automation scripts they’re often confused with. It establishes the mental model that carries through the rest of the book.

Chapter 2 is about talking to an LLM directly. You’ll learn how to send messages, shape behavior through a system prompt, and parse what comes back, building the thin communication layer that every later chapter depends on.

Chapter 3 gives the LLM a way to reach into the outside world through tools and function calling. You’ll convert ordinary Python functions to specifications that the model can understand and invoke.

Chapter 4 ties everything together with a ReAct loop—the cycle of thinking, acting, and observing that turns a one-shot model call into an agent that keeps going until the job is finished.