Front matter

Oct 10, 2026 · @Ahmed Hassanien

This book teaches engineers to build an agent harness with Spring AI in Java. Chapters 2 to 8 also show every step in Python with LangChain. The running example is the Log Incident Watcher. Read the chapters in order. Each chapter adds one idea. Run the code in each chapter before you read the next one. All examples use fake data and run offline.

Versions: Spring Boot 4.1.1, Spring AI 2.0.1, Spring AI Session 0.6.0, Temporal 1.35.0. Use released versions only.

Local services: PostgreSQL 17 with VectorChord, BM25, and AGE. LM Studio with Gemma for chat and BGE-M3 for embeddings. A reranker container for bge-reranker-v2-m3. A Temporal dev server.

Figure 0.1. The local stack. Everything runs on one machine with fake data. The figure leaves out the embedding and Temporal connections from the app; later chapters draw each one where it is used.

How to use this course

The code lives in the garage-education/harness-engineering repository on GitHub. Clone it before Chapter 2:

git clone git@github.com:garage-education/harness-engineering.git

Pick a language: Java with Spring AI, or Python with LangChain. From Chapter 2 to Chapter 8, every code sample has a Java tab and a Python tab. Your choice applies to every page and is remembered.

You need LM Studio, plus JDK 27 for Java or uv for Python. Chapter 2 sets up the rest.

Work through each chapter in four steps:

  1. Read the chapter. It shows the code for that chapter only.
  2. Write the code, or compare it with java/src/main/java/com/garageeducation/harness/ or python/src/harness/ in the repository.
  3. Send the chapter’s requests in requests/harness.http. Open the file in IntelliJ IDEA, or in VS Code with the REST Client extension.
  4. Read the console log. Each chapter shows the log lines to expect. Chapter 2, Table 2.1 explains every log tag.

The repository’s java/ and python/ folders hold the code after the latest chapter. The Git history has one commit for each chapter, tagged chapter-01, chapter-02, and so on. Run git checkout chapter-05 to see the code at the end of Chapter 5. Run git diff chapter-04 chapter-05 to see what Chapter 5 changed. Run git checkout main to come back to the latest chapter.

Both apps listen on port 8080 and answer the same requests. Run one at a time.

Model replies differ between runs. Compare the shape of each reply and log, not the exact words.

docs