The routine path at the illustrative public service counter is now a chain. It detects language and intent, retrieves approved content within a boundary, and returns a structured answer with citations, as Part 3 built it. For most questions, that is enough, and nothing in this part should tempt a team to replace it.
Some requests do not fit. A person wants to collect a document but brings only one of the two supporting papers. Another has two documents that give different spellings of the same name. A third asks a question that needs a follow-up before it can be answered, and the person replies tomorrow. A fourth hits a service that is down. Each of these needs the work to wait, branch, loop back or hand over, and each needs the system to remember where it was. A chain runs once, from top to bottom, and forgets.
Move from a chain to a graph when the work must branch, wait or retry in ways that someone has to see and resume, and design the state schema before the nodes, because the state is the contract between steps and a checkpoint is only as useful as what that state records.
When a chain stops being enough
The source brief behind this series lists the cases for the exception path: multiple documents, missing or conflicting information, a follow-up question, human review, case handoff, a retry after a service failure, and a controlled external action. The test is simple. If the next step depends on something that might not be known yet, or on a decision someone must be able to inspect, the flow needs explicit branches and saved state.
| Signal | A chain is enough | A graph is justified |
|---|---|---|
| Steps | Fixed sequence | Branches chosen from the current state |
| Waiting | None; the answer is immediate | The case waits for a person, a document or a service |
| Retries | A simple retry around one call | Retries with a counted budget and a defined exit |
| Loops | None | Back to the person for a missing item |
| Restart | Rerun from the start is harmless | Rerun would repeat work or lose what the person said |
| Inspection | A trace is enough | A reviewer must see and possibly edit state |
Do not choose a graph for better answers. The third-party manual this series started from, LangChain 101 at aiengineeringfromscratch.com (accessed 25 November 2026), reports that a plain loop, a framework agent and a hand-built graph gave the same outcomes on its tested tasks and models, under its stated conditions. Its advice is to pick a harness for persistence, streaming, approvals or files, not for answer quality. That matches Framework, SDK, workflow tool or agent platform?, which selects by responsibility rather than by brand.
What LangGraph provides
LangGraph's overview (checked on 25 November 2026) calls it "a low-level orchestration framework and runtime for long-running, stateful agents", and says it does not require LangChain. PyPI listed version 1.2.24 of langgraph on the same date. The Graph API page describes a StateGraph built over a typed state schema, with nodes, fixed edges from add_edge, routed edges from add_conditional_edges, and START and END markers. By default a node's update overwrites a state key. A reducer, attached with Annotated, combines values instead, for example appending to a list.
That is the whole model: state, functions that read and update it, and edges that decide what runs next. It is deliberately small. Everything that makes the workflow governable is in how the team uses it.
Design the state before the nodes
Start with a list of what the case must remember, and who needs to read it. For the counter's exception path, a first version might hold:
- the detected language and intent;
- the documents received and the items still missing;
- the evidence references from retrieval, appended and never overwritten;
- the route chosen and the reason for it;
- an attempt count for each external service;
- the handoff reason, if a person takes over;
- the case status.
Three design rules keep this honest. Store references rather than copies of personal documents where you can, because every checkpoint will hold the state. Use append-only reducers for anything that is evidence, so that a later step cannot erase what an earlier one saw. And keep the fields a reviewer needs readable without the model: plain values, not a transcript to be reinterpreted.
Illustrative; check against the current documentation. Synthetic fields.
import operator
from typing import Annotated
from typing_extensions import TypedDict
from langgraph.graph import StateGraph
from langgraph.checkpoint.memory import InMemorySaver
class CaseState(TypedDict):
intent: str
missing: list[str]
evidence: Annotated[list[str], operator.add] # append-only
route: str
builder = StateGraph(CaseState)
builder.add_conditional_edges("check_documents", choose_route)
graph = builder.compile(checkpointer=InMemorySaver()) # development only
The fragment leaves out the add_node and add_edge calls for the classify, check-documents, ask-person and handoff nodes, and the choose_route function, which is plain code that reads the state.
Edges are where decisions become visible
The value of a graph is that a decision is a named edge, not a sentence in a prompt. Let the model classify and extract. Let plain code choose the route from the state it produced: if missing is not empty, go to ask the person; if two documents conflict, go to human review; if a service failed and the attempt count is under its budget, retry; otherwise hand over. A reviewer can read that function. Nobody can read a model's private reasoning about where to go next.
Bound every loop twice. The graph has a recursion limit on super-steps. The Graph API page states that it defaults to 10,007 from version 1.1.4, that it can be set per run as a top-level recursion_limit config key, and that exceeding it raises GraphRecursionError. That default is a backstop, not a design. Keep your own attempt counters in state, set a much lower per-run limit for a counter workflow, and route the error to a handoff rather than a crash.
Checkpoints and threads
A checkpointer saves the graph's state as checkpoints for a thread. The persistence page (checked on 25 November 2026) shows the graph compiled with a checkpointer and each run given a thread_id under configurable. Two warnings on that page matter for production. In-memory checkpoints are lost when the process restarts, so use a persistent store such as PostgresSaver from langgraph.checkpoint.postgres, which needs its setup() call the first time. And checkpoints accumulate, so plan pruning and a retention rule.
A thread is not a case. The thread ID belongs to the runtime. The case reference belongs to the service. Keep a mapping between them, so that a person returning tomorrow resumes the right thread, and a reviewer can find every thread a case has used. An agent without durable state cannot own a long-running process covers what a checkpoint should contain, and Memory is not state keeps run state separate from long-term memory.
Pausing for a person, and resuming safely after an approval, is the subject of Part 6. This part only makes sure there is a state worth pausing.
What the graph does not solve
A graph makes control flow explicit. It leaves four things to the team.
- Authority. An edge to "submit" does not make submission allowed. That rule lives in the system of record.
- Safe replay. Resuming from a checkpoint can rerun a node. The manual cited above treats the tool, not the checkpointer, as responsible for not repeating a side effect. Part 5 designs tools for that.
- Data protection. The checkpoint store holds case state. It needs the same classification, access control and retention as any other store of personal information.
- Evidence of decisions. The state history explains how the run moved. The case record shows who decided. LangGraph and MCP solve different problems places that record outside the framework.
How NalaTolika applies it
NalaTolika is a CloudNala concept and reference architecture for governed language interpretation. It has no customers, deployments, pilots, data or results. In its reference design, the routine path stays a chain, and only the exception path runs as a graph. Routes are chosen by code from typed state, evidence references are append-only, each external service has an attempt budget, and every exit that is not a completed answer is a handoff to a person with the reason recorded. The design rule holds: chains for predictable interpretation, graphs for controlled decisions, humans for accountability.
Next in the series: Tools and MCP connections need boundaries. All parts are on the series page.
Sources and limits: this article is CloudNala analysis. LangGraph's overview, Graph API and persistence pages, and the PyPI listings for langgraph and langgraph-checkpoint-postgres, were checked on 25 November 2026; defaults and APIs change between releases. The manual at aiengineeringfromscratch.com is a third-party source and its results apply to the models, tasks and conditions it reports. The code is illustrative and synthetic; no CloudNala code lab or repository exists for this series. The counter scenario describes no department or organisation. NalaTolika is a concept with no deployments.
How CloudNala can help
CloudNala helps teams decide which parts of a workflow need a graph and which should stay a chain. We design the state schema with the people who will review it, move routing decisions from prompts into readable code, set attempt budgets and handoff exits, and specify the checkpoint store, retention rule and case-to-thread mapping before the first exception case runs.
Work with CloudNala
CloudNala helps organisations move from technology ambition to practical execution across cloud, AI, data, platform engineering and digital services.
Whether you are exploring AI, modernising your cloud environment, building a public-sector digital service, or turning an idea into a working MVP, we can help you shape the roadmap and deliver the next step.
Book an AI Production Readiness Review or write to us at consult@cloudnala.co.za