Build Lab: From Chain to Governed Agent
LangChain can take a team from a model call to a working agent, but a working agent is not a production service. This eight-part build series follows one workflow from a single model call to a governed AI service, and is practical and slightly sceptical throughout: it explains what each framework layer solves and what it does not, and promotes no framework or vendor. It replaces free text with a versioned output contract; releases prompt templates like components, with labels in code and exact versions in traces; restricts retrieval to approved sources and carries the evidence with every answer; moves exception paths into a stateful graph with explicit transitions and limits; puts allowlists, schemas and least privilege on tools and MCP connections, read-only first; pauses side-effecting actions at durable checkpoints for an accountable person and resumes without repeating them; joins traces and evaluations so any failure can be reconstructed; and pins, locks and rehearses rollback. The organising rule is to use chains for predictable interpretation, graphs for controlled decisions and humans for accountability. The running example is NalaTolika, CloudNala's concept for governed language interpretation, which has no customers, deployments or results, at an illustrative public service counter. A standalone companion, The framework is not the product, sets out the argument, and each part adds a section to the printable Chain-to-Governed-Agent Readiness Checklist. Framework versions and APIs were checked on official pages on 25 November 2026.
Series published . 8 articles
- Part 1From model call to structured outputA model call returns text. A service needs fields it can check, route and record. Part 1 of Build Lab: From Chain to Governed Agent shows the ways LangChain asks a model for structured output, what the schema cannot guarantee, and the output contract card a team should complete before any downstream code trusts a field.7 min read
- Part 2Prompt templates are versioned componentsA one-line prompt edit can change who gets escalated to a person, with no code change and no test run. Part 2 of Build Lab: From Chain to Governed Agent treats prompt templates as components with a version, an owner, a test set and a release path, and gives a change classification table for deciding which edits need which approval.7 min read
- Part 3Retrieval with evidence and source boundariesAdding retrieval to a chain is easy. Proving which approved source supported each sentence is the hard part. Part 3 of Build Lab: From Chain to Governed Agent sets the source boundary before the query, treats evidence as a data structure the answer must reference, and tests what the retriever finds before judging what the model writes.8 min read
- Part 4Stateful workflows with LangGraphA chain runs once from top to bottom. An exception case waits for a document, loops back to the person, retries a failed service and sometimes hands over to a human. Part 4 of Build Lab: From Chain to Governed Agent shows when to move from a chain to a graph, why the state schema is designed first, and what checkpoints and threads do and do not give you.8 min read
- Part 5Tools and MCP connections need boundariesA tool turns an assistant that explains into one that acts, and MCP makes tools easy to connect. Neither decides which tools a step should see, what their arguments may contain, or what happens when a call fails twice. Part 5 of Build Lab: From Chain to Governed Agent treats each tool as a permission with a contract, keeps the first version read-only, and treats every result as untrusted input.8 min read
- Part 6Human approval and durable checkpointsPausing an agent for a human is easy. Resuming it safely after a restart, a long wait or a second click is the hard part. Part 6 of Build Lab: From Chain to Governed Agent explains what a LangGraph checkpoint holds, why a resumed node runs again from its start, and gives a resume safety matrix of seven situations every approval flow must survive.8 min read
- Part 7Tracing, evaluations and failure reconstructionWhen an agent gives a wrong answer, the team must be able to say what it was asked, what it knew, what it decided, what it did and under which versions, then prove the fix. Part 7 of Build Lab: From Chain to Governed Agent joins traces, evaluations and checkpoint history into a seven-question failure reconstruction ledger that ends with a new regression case.8 min read
- Part 8Production packaging, version pinning and rollbackAn agent's behaviour depends on its code, locked dependencies, runtime, model, prompts, tools, graph configuration and index, and any of them can change without a code commit. Part 8 of Build Lab: From Chain to Governed Agent defines the release manifest, the gate a release must pass, and why rolling back an agent is also a question about the threads already in flight.8 min read
Working through any of this in your own organisation?
These articles come out of delivery work rather than theory. If the problems in this series look familiar, a short scoping conversation is usually the quickest way to work out what is worth doing first.
Talk to CloudNala