Skip to content

Learning LangChain: the graph survives, the code does not

Mayo Oshin and Nuno Campos · O'Reilly, 2025
19 de abril de 2026 por
Learning LangChain: the graph survives, the code does not
Andrés Briñez

The first part walks through retrieval and chatting with models; the second, the one that matters, presents workflows as graphs with state: nodes that do something, edges that decide where to go next, a state that travels, and a point where all of it is persisted so the run can be resumed.

What I took from it

The habit of drawing the flow before writing the first prompt. Nodes, state, exit conditions. It sounds obvious and almost nobody does it: the usual approach is chaining model calls until the demo works, after which nobody can say what happens when step three fails.

The second idea, the one I argue for in front of a client: the moment a human approves something has to be a node in the flow, with its state saved, not an email off to the side. If the approval lives outside the system, the system does not know it is waiting, does not know how long it has been waiting, and cannot resume where it stopped. Persisting state is what turns a demo into something operable.

The third is memory understood as a design decision rather than a checkbox: what gets remembered, for how long, and who can see it. Inside a company, that last part is a permissions question wearing a technical costume.

What I left out

The code. Not out of contempt, but because these libraries rename their functions every few months and half a dozen pages no longer run as printed. There is also a disagreement underneath: for a simple case, calling the model's interface directly is less work than learning a framework that hides what it does. The framework starts paying once the flow has state, retries and humans in it; before that, it is dead weight.

# AI
Learning Domain-Driven Design: what deserves custom code and what does not
Vlad Khononov · O'Reilly, first edition, 2021
WhatsApp