E-Book, Englisch, 260 Seiten
Reihe: Packt Publishing
Marco AI Agents & Harnesses Foundations
1. Auflage 2026
ISBN: 978-1-80808-730-1
Verlag: Packt Publishing
Format: EPUB
Kopierschutz: 0 - No protection
Building from ReAct Loops to Agent Harnesses with Harness Engineering, LangChain, and LangGraph
E-Book, Englisch, 260 Seiten
Reihe: Packt Publishing
ISBN: 978-1-80808-730-1
Verlag: Packt Publishing
Format: EPUB
Kopierschutz: 0 - No protection
AI Agents & Harnesses Foundations shows you how to build the AI agents and agent harnesses powering modern agentic AI applications. You'll start with LangChain's core primitives, including models, messages, prompts, tools, and structured outputs, and use them to build increasingly capable agents. From there, you'll go under the hood to understand the agent loop, tool-calling LLMs, state, memory, context engineering, orchestration, and long-horizon agents. Using LangChain, LangGraph, and LangSmith, you'll see how modern agent systems are built, orchestrated, traced, and observed. By the end, you'll understand modern agent harness architecture and have the practical foundations to build, debug, secure, and evolve reliable production AI agents.
Autoren/Hrsg.
Weitere Infos & Material
Preface
Agents and agent harnesses are everywhere now: product launches, conference keynotes, job listings. The vocabulary has grown too: harnesses, subagents, context engineering, MCP, skills. You open Claude Code or Codex, type a sentence, and a pull request shows up.
But at the API level, a language model is really just a stateless function. Give it instructions, tool definitions, and a sequence of messages, and it hands back either generated content or a request to call a tool. That's it. No memory, no filesystem, no clock, no ability to actually do anything.
Everything that makes a model feel like an agent (the fact that it seems to remember what it said, reads your files, retries when something fails, and knows when to stop) comes from code written around the model. An agent is really just a loop: call the model, run whatever tool it asks for, feed the result back in, repeat until you get a final answer.
A harness is the system that the loop runs inside. It handles tool definitions, context management, persistence, guardrails, delegation, and the logic that decides when to keep going or stop. Claude Cowork and Codex are both harnesses in this sense, and so is LangChain's Deep Agents.
This book uses LangChain throughout, for a couple of reasons.
The practical one comes down to what the stack actually gives you. It's open source, model-agnostic, and it does a few things well for a book like this:
- One interface for models, prompts, and tools, regardless of provider
- Agent development at whatever level of abstraction you want, from high-level APIs down to a fully handwritten loop
- LangSmith built in, for tracing, evaluating, and debugging agent behavior
The historical reason matters too. Before agents became a mainstream product category, LangChain was already building and popularizing the abstractions we now take for granted: models, tools, memory, execution flow. That lineage runs through LangGraph and now Deep Agents, which covers most of what you'd expect from a complete harness.
This book is a deep dive into all of it. We start with the basics: setting up your environment, working with prompt templates, chat models and chains, running hosted models and local open-weight ones. From there, we look at what actually separates an agent from a chain, and build a first working agent with tool calling.
Once the mechanics click, we go further. We take LangChain's abstractions apart piece by piece and rebuild the same agent loop, first with handwritten JSON schemas, then with raw prompts and regex parsing of the model's output. This is close to how a lot of early agent systems actually worked, and once you've done it by hand, it's obvious why structured tool calling had to happen.
Then we step back into theory: zero-shot and few-shot prompting, chain-of-thought, ReAct, function calling, and the context-engineering problems that show up once an agent's been running a while.
Last, we scale up: harnesses, durable state, tool execution, delegation, and how LangChain's Deep Agents pulls all of it together into something you'd actually deploy and run long-term.
By the end, you'll have built agents at every level, from one line of framework code to a fully hand-rolled implementation, and worked with tools like Ollama, LangSmith, and Tavily along the way.
Disclaimer
This book is an independent publication and is not affiliated with, endorsed by, sponsored by, or officially associated with Anthropic, PBC, LangChain, or any of their respective subsidiaries or affiliates. "Claude," "Claude Code," and "Anthropic" are trademarks or registered trademarks of Anthropic, PBC. "LangChain" and related marks are trademarks of their respective owners. All other trademarks mentioned herein are the property of their respective owners.
The author is an employee of Google LLC. However, this book is a personal project and does not represent the views, opinions, or official positions of Google LLC, Google Cloud, Alphabet Inc., or any of their subsidiaries or affiliates. This book is not endorsed by, sponsored by, or officially associated with Google in any capacity. "Google," "Google Cloud," and related marks are trademarks of Google LLC.
The content in this book is based solely on the author's personal experience, independent research, and publicly available documentation. The views, opinions, and interpretations expressed are those of the author alone and do not represent the official positions, strategies, or opinions of Anthropic, PBC, LangChain, Google LLC, or any other organization.
While every effort has been made to ensure the accuracy and completeness of the information presented, the author makes no warranties or representations, express or implied, regarding the completeness, accuracy, reliability, or suitability of the content. AI tools and their associated APIs, features, and functionalities evolve rapidly, and information in this book may become outdated after publication.
The author and publisher shall not be held liable for any damages, losses, or consequences arising directly or indirectly from the use of or reliance on the information contained in this book. Readers are encouraged to consult the official documentation of the relevant tools and technologies for the most current and authoritative information.
Who this book is for
This book is for builders: developers, data and ML professionals, platform and operations teams, and PMs who want to understand agents and agent harnesses from the inside out. Code samples are in Python, and comfort with a command line will help; no machine learning background is needed.
What this book covers
, , gets your project set up and walks through the basics: prompt templates, chat models, chains. You'll build a chain that summarizes text, run the same thing on a local open-weights model with Ollama, and hook up LangSmith so you can actually see what your app is doing instead of guessing.
, , draws the actual line between a chain and an agent. In a chain, you decide what happens next. In an agent, the model does. You'll build your first working agent with web search, and look at the two ways models handle tool use: the provider strategy and the tool strategy.
, , takes LangChain's and pulls it apart layer by layer. Same agent loop, three ways: LangChain's built-in tools, hand-written JSON schemas with no framework at all, and a raw ReAct prompt with regex parsing and a scratchpad.
, , takes the middle layer from Chapter 3 and actually builds it out. You'll rip out LangChain's tool abstraction, hand-convert Python functions into tool schemas yourself, and wire tracing back in manually since the framework isn't doing it for you anymore.
, , goes back to before function calling was a thing. You'll rebuild the original ReAct prompt that kicked off the whole agent pattern, control what the model outputs with stop sequences, pull actions and answers out of raw text with regex, and manage memory yourself in a scratchpad that just keeps growing.
, , steps back and explains why any of this works in the first place. You'll trace the path from zero-shot to few-shot to chain of thought to ReAct to function calling, then get into context engineering: what happens when an agent's context window fills up, goes stale, or gets clogged with stuff that's actively working against it.
, , moves from one-off tool calls to systems that run for a while. You'll see what a harness actually gives you beyond the model itself: planning, persistence, delegating to sub-agents, recovering when something fails, executing safely, and how LangChain's Deep Agents pulls all of that together in something you'd actually deploy.
To get the most out of this book
- A working knowledge of basic Python is assumed: functions, dictionaries, and virtual environments. No prior experience with LangChain or agent frameworks is needed.
- An OpenAI API key, since most of the examples in this book run on OpenAI's models.
- A LangSmith API key, used throughout the book for tracing, evaluating, and debugging agent behavior.
- Any Python IDE or code editor will work: VS Code, PyCharm, or your usual setup.
Download the example code files
This book includes a complete downloadable code bundle containing all the example projects and files used throughout the chapters. We recommend downloading the bundle so you can follow along smoothly and experiment with the examples.
Use the bundle as a practical starting point. Modify it, extend it, and apply what you learn by creating your own variations as you...




