R218 · Agent principles and patterns › Harness building blocks

LangChain 101: measured answers on harness choice, durability and structured output

Read the original

Authors Alvaro Cintas (shared)

agent-harnessdurable-executionidempotencystructured-outputbenchmarksopen-source

Source: LangChain 101, a free open manual in the AI Engineering from Scratch project (aiengineeringfromscratch.com, repo rohitg00/ai-engineering-from-scratch, manuals/langchain-101). It covers LangChain 1.5, LangGraph 1.2, Deep Agents 0.7 and LangSmith, about 390 pages, and every listing is captured from a real run with the capture scripts committed. Surfaced by Dr. Alvaro Cintas on LinkedIn, 2026-11-22.

Why it matters

Most framework material shows how few lines it takes to build an agent. This manual asks the question a staff engineer actually has to answer: what does the framework change about a run, measured, and what does it not? Each section opens with a one-sentence answer and a recorded experiment behind it. The headline answer is that the harness does not decide quality; the model does.

What it measured

QuestionFinding (as reported by the manual)Design consequence
Does the harness change outcomes?A plain ~40-line tool loop, create_agent and a hand-built StateGraph produced identical outcomes on 60 of 60 shared local tasks, on two models.Pick a harness for persistence, streaming and approvals, not for accuracy.
What does the harness cost?create_agent adds roughly 5 ms of framework time per model call and no extra tokens.The thin layer is effectively free; the overhead argument against it is weak.
What do batteries-included agents cost?Deep Agents used 3.6x to 4.3x the prompt tokens of a plain loop across all model sizes tested, and only the deep agent on small local models lost tasks.Planning scaffolds, sub-agents and file tools are a token tax; adopt them only when tasks need them.
Is checkpointing exactly-once?No. After a crash between steps, a node re-ran on resume in 97 of 100 trials, and no durability mode (sync, async, exit) protects a task that had just returned.Every external side effect needs an idempotency key and a check of your own records before acting.
Is structured output portable?On Qwen3 4B, ToolStrategy returned no object in 39 of 39 tasks and ProviderStrategy raised in 10 of 10; a separate extraction call matched the best score on every model.Treat structured-output strategy as a per-provider decision with a test, or extract in a dedicated call.
Default limitsThe default recursion limit of 9999 steps allows about 5000 model calls.Set recursion_limit per run.

Architecture, as the manual frames it

The manual goes from the runtime internals (channel write collisions, checkpoint size and the delta channel, stream modes) through middleware ordering, guardrails and PII handling, memory stores with namespace isolation, and serialization of state that does not round-trip. It ends with a production build: FastAPI, Postgres checkpointer, approvals, OpenTelemetry and evals.

Tradeoffs

Failure modes to design for

  1. Double side effects on resume. A crash after a tool returns but before the checkpoint lands re-runs the node: two charges, two emails, two tickets.

  2. Silent None structured responses on smaller or local models, which look like success to code that does not check.

  3. Runaway loops under the default recursion limit, billed per call.

  4. State that does not round-trip through the checkpointer's serializer, which breaks resume only after a restart.

  5. Token blow-up from a deep-agent template chosen for convenience.

  6. Version drift. Most 0.x code (chains, AgentExecutor, langchain_community imports) no longer imports on 1.5; the manual is pinned to one version set, so findings can move with upgrades.

Review checklist

Caveats

These numbers are the manual's own, from its published capture kit and a task suite of 30 to 99 tasks per model. The suites are local and small, so the equal-outcome result says the harness is neutral on these tasks, not that it is neutral on every workload.

Cited in field guides

Connections

See R218 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.