Testing Agentic LLM Workflows Without a Model: A Deterministic Mock-LLM Reference Implementation of a LangGraph Supervisor, RAG, Tool and Critic Graph

Multi-step LLM applications that route, retrieve, call tools, critique their own drafts and pause for human approval are hard to test, because every node depends on a non-deterministic, paid model. This paper is an experience report on a small open-source (MIT) reference implementation built on LangGraph's StateGraph. A supervisor routes each question either to a BM25 retriever over a bundled document set or to a tool-calling agent with two offline tools; a writer drafts a cited answer; a critic scores the draft and loops back until a threshold or an iteration cap is reached; an optional human-in-the-loop interrupt pauses the thread, which is checkpointed in memory or in SQLite and resumed by thread id. The key design decision is a deterministic, rule-based mock chat model that honours the same prompt contract as a real model, including tool calls, so the whole graph runs without an API key in tests and demonstrations, while OpenAI or Ollama models can be swapped in through one environment variable. We describe the graph, the state reducers and the mock model, and report what we ran: the 28 pytest cases pass, and with the mock model one question took a median of 6.5 ms (retrieval path) and 12.4 ms (tool path) end to end with the in-memory checkpointer and 10.7 ms and 18.9 ms with SQLite, writing 9 and 13 checkpoints per run. These numbers measure orchestration overhead only, not answer quality. We also report a resource-exhaustion weakness we found in the arithmetic tool.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-30
DOI
https://doi.org/10.5281/zenodo.24689163
Primary Topic
Natural Language Processing Techniques
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Testing Agentic LLM Workflows Without a Model: A Deterministic Mock-LLM Reference Implementation of a LangGraph Supervisor, RAG, Tool and Critic Graph

Muhammad Afzal Kalwar
Zenodo (CERN European Organization for Nuclear Research)
Natural Language Processing Techniques
preprint

Testing Agentic LLM Workflows Without a Model: A Deterministic Mock-LLM Reference Implementation of a LangGraph Supervisor, RAG, Tool and Critic Graph

Muhammad Afzal Kalwar
preprint en

Abstract

Multi-step LLM applications that route, retrieve, call tools, critique their own drafts and pause for human approval are hard to test, because every node depends on a non-deterministic, paid model. This paper is an experience report on a small open-source (MIT) reference implementation built on LangGraph's StateGraph. A supervisor routes each question either to a BM25 retriever over a bundled document set or to a tool-calling agent with two offline tools; a writer drafts a cited answer; a critic scores the draft and loops back until a threshold or an iteration cap is reached; an optional human-in-the-loop interrupt pauses the thread, which is checkpointed in memory or in SQLite and resumed by thread id. The key design decision is a deterministic, rule-based mock chat model that honours the same prompt contract as a real model, including tool calls, so the whole graph runs without an API key in tests and demonstrations, while OpenAI or Ollama models can be swapped in through one environment variable. We describe the graph, the state reducers and the mock model, and report what we ran: the 28 pytest cases pass, and with the mock model one question took a median of 6.5 ms (retrieval path) and 12.4 ms (tool path) end to end with the in-memory checkpointer and 10.7 ms and 18.9 ms with SQLite, writing 9 and 13 checkpoints per run. These numbers measure orchestration overhead only, not answer quality. We also report a resource-exhaustion weakness we found in the arithmetic tool.

Zenodo (CERN European Organization for Nuclear Research)
Natural Language Processing Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon