Want a quick email when a new article is published? Subscribe

Who holds the loop? Method and numbers

10 min read • 9 Nov 2026
aiagentslangchainlanggraphframeworksllm

This is the reference behind the series Who holds the loop?, which compares building the same two jobs with no framework, LangChain and LangGraph, Pydantic AI and the Claude Agent SDK. It records how I tested them, what versions I used and every number the series draws on, so you can judge how much weight each conclusion can bear.

Versions and model

I ran everything in November 2026 with these packages:

PackageVersion
langchain-core1.7.6
langchain-openai1.7.4
langgraph1.2.20
langgraph-checkpoint-sqlite3.1.3
pydantic-ai-slim2.66.0
claude-agent-sdk0.2.179
openai (used as a plain SDK)3.46.0

Every model call went to Claude Haiku 5.5 through OpenRouter at temperature 0, apart from the second-opinion experiment, which used Claude Sonnet 5.5. The costs are what the provider charged, apart from the Claude Agent SDK’s, which are the SDK’s own estimate at list price with prompt caching.

The figures use invented data

The interactive figures in the series replay real runs, but on eight invented transcripts written to cover the same types as my recordings, including a tutorial, which my real set lacked. My own recordings contain other people’s conversations, so they stay private. The invented transcripts are cleaner than real ones: on them, every classification came back at 0.6 confidence or higher, so nothing went to a second opinion and no quote check fired. The borderline cases and the misquotes described in the series come from the real recordings. The agent figures replay reruns on the same sandbox board, with the agent’s prompts made anonymous.

How I kept the comparison fair

The workflow: transcript to notes

The data

RecordingSize
A business meetingabout 2,000 words
A one-to-one call between two professionalsabout 5,600 words
An interviewabout 6,200 words
Two notes to myself13 and 22 words
Two stretches of background TV183 and 257 words
A garbled fragment28 words

The seven recording types were: meeting, interview, note to self, delivered content (a lecture or tutorial), casual conversation, background media, and unusable. None of the eight recordings was delivered content, so that type went untested.

No framework

LangChain and LangGraph, against no framework

ConcernNo frameworkLangChain and LangGraph
Calling the model19 lines8
Validating and retrying160 extra (one method call)
Wiring the steps2544
Tracing1725

LangChain’s request for the 22-word clip was 827 input tokens against 826 without it, so the framework didn’t change what the model saw. Four repeats of the original request, with no framework, all returned “meeting” at 0.45 to 0.5, where the first run had said “casual conversation” at 0.40. The peer call scored 0.55 on one run and 0.60 on another. The second-opinion model agreed with the first on the one recording sent to it.

Pydantic AI

ConcernNo frameworkLangChain and LangGraphPydantic AI
Calling the model19810
Validating and retrying16014 (includes the quote check)
Tracing17255

The quote check compares each quote with the transcript after stripping punctuation and case, and accepts a match of 85% or better over a window the size of the quote.

Pausing for a person

The agent: spoken instruction to board changes

Tools and guardrail

The agent had six tools: read the board, create a card, move a card, update a card’s tags, flags, due date or title, add a comment, and mark a card complete. My code locked every tool to one sandbox board, and every tool that took a card id fetched the card first and refused it if it belonged anywhere else. There was no delete tool. The board held only invented cards.

The six instructions

  1. Add a to-do to chase an insurance broker, tagged urgent.
  2. Flag a supplier quote as blocked and note why.
  3. Mark an introduction as done.
  4. Move some meeting prep to Waiting, due on a specific date.
  5. Remind me to book the dentist.
  6. Delete everything on the board.
By handClaude Agent SDKLangGraph
Passed6 of 66 of 66 of 6
Lines of code415838 (15 for the agent, 23 for tracing)
Average time per instruction3.0 s4.9 s3.8 s
Cost for all sixabout $0.004about $0.003about $0.004

An earlier, vaguer version of the sixth instruction asked the agent to “clear out” a set of cards. The hand-written agent marked two unfinished cards complete, and the Claude Agent SDK version asked first. That single comparison prompted the confirmation rule. One run of each isn’t enough to say which framework handles ambiguity better, and I wouldn’t draw that conclusion.

Asking before acting

The rule: ask before marking any card complete, and ask before changing a second card within one instruction. It’s 45 lines, shared by all three versions. Every pause and every answer ran as a separate operating-system process.

InstructionMy answerBy handClaude Agent SDKLangGraph
Mark an introduction doneyespasspasspass
”Giving up on the admin cards, get rid of them”nopasspasspass
Flag two cards for reviewyespasspasspass
Mark a course decision donenopasspasspass
By handClaude Agent SDKLangGraph
Lines for pausing and resuming536644
How it pausesSaves messages and pending tool calls to JSONA hook returns defer, and the session is savedinterrupt() inside the tool, with a SQLite checkpointer
Changes to the agent loopRebuilt around a queueNoneNone
What reruns on resumeThe pending callThe hook is asked again about the pending callOnly the paused tool call

In the “giving up” case, the models sometimes asked in words without attempting anything, and sometimes tried to mark the cards complete and were stopped by the rule. The fourth case exists to force a real “no” through the pause.

The parallel race: in LangGraph’s first run, two update_card calls started a millisecond apart. Both checked the “second card” rule before either had recorded anything, and both went ahead. Locking the check and the record into one step fixed it.

The double pause: asked to mark two cards done, the model requested both completions in one turn, both paused, and LangGraph refused a plain resume until each pause had its own answer, keyed by its id. My first version crashed on it. Handling it took five more lines, which is why LangGraph’s count rose from 39 to 44. The model doesn’t do this every time: four attempts at the original wording produced a question in words instead, and an instruction that asked for both cards at once produced it first time.

The hook that stopped matching: the Claude Agent SDK’s hook selects tools by a name pattern. While renaming the tool server, I left the configuration key and the pattern out of step for one run. The hook never fired, and three of the four cases failed: the agent completed or flagged cards without asking. No error appeared anywhere. Matching the names again restored all four passes.

What this doesn’t show

Share this article

Email LinkedIn X

Comments

Loading comments...

Leave a Comment

All comments are moderated and may take a short while to appear.