<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ChristineWanjau</title>
    <description>The latest articles on DEV Community by ChristineWanjau (@christinewanjau).</description>
    <link>https://dev.to/christinewanjau</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1035638%2Fc6d3213a-4d9e-4bf0-8e5a-09150992e3b3.png</url>
      <title>DEV Community: ChristineWanjau</title>
      <link>https://dev.to/christinewanjau</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/christinewanjau"/>
    <language>en</language>
    <item>
      <title>Don't Hire a Smarter Intern. Build a Better Office. Why LLM agents need LangChain, LangGraph and LangSmith</title>
      <dc:creator>ChristineWanjau</dc:creator>
      <pubDate>Mon, 30 Nov 2026 14:09:36 +0000</pubDate>
      <link>https://dev.to/christinewanjau/dont-hire-a-smarter-intern-build-a-better-office-why-llm-agents-need-langchain-langgraph-and-3om7</link>
      <guid>https://dev.to/christinewanjau/dont-hire-a-smarter-intern-build-a-better-office-why-llm-agents-need-langchain-langgraph-and-3om7</guid>
      <description>&lt;p&gt;Think of a large language model as a very capable intern. It reads quickly, writes fluently and never gets tired. It also misreads instructions, skips steps and hands in work in whatever format it feels like that day. Hiring a smarter intern doesn't fix this. A better workplace does: standard forms, a clear process and a record of what was done.&lt;/p&gt;

&lt;p&gt;The smallest version of that idea is one line of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;plan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;with_structured_output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Plan&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;PLANNER_PROMPT&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"question"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of free text that you have to parse and hope is correct, the model returns a validated &lt;code&gt;Plan&lt;/code&gt; object with a list of sub-questions. One line removes a whole category of bugs.&lt;/p&gt;

&lt;p&gt;That line comes from a research agent I built with LangChain, LangGraph and LangSmith. It runs entirely on a laptop, using a local &lt;code&gt;qwen3:8b&lt;/code&gt; model through Ollama. Each tool solves a different problem. This article explains which problem each one solves, so you can decide whether you need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The agent
&lt;/h2&gt;

&lt;p&gt;The agent takes a question such as "FastAPI vs Flask for REST APIs" and returns a cited Markdown report.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    Q([Question]) --&amp;gt; P[Planner]
    P --&amp;gt; H{{Human review}}
    H --&amp;gt;|one task per sub-question| R[Researchers&amp;lt;br/&amp;gt;search + read pages]
    R --&amp;gt; W[Writer]
    W --&amp;gt; C{Critic}
    C --&amp;gt;|rewrite| W
    C --&amp;gt;|needs more research| R
    C --&amp;gt;|pass, or revision limit reached| S([Save report])&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;A planner breaks the question into sub-questions, and a person approves or edits the plan. Researchers work on the sub-questions in parallel: each one chooses its own searches, reads the pages it finds and keeps the most relevant passages. A writer drafts the report, and a critic scores it. If the draft fails, it goes back for a rewrite or more research, up to a fixed number of revisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  LangChain: one interface for models, tools and documents
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Without it&lt;/strong&gt;, every provider has its own SDK and message format, every tool needs custom glue code, and getting structured data out of a model means writing your own parsing and retry logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With it&lt;/strong&gt;, these share a common interface:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Models.&lt;/strong&gt; &lt;code&gt;init_chat_model&lt;/code&gt; creates a Groq, Gemini or local Ollama model from a setting, and the rest of the code doesn't change. A hosted model can fall back to another provider when it hits a rate limit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured output.&lt;/strong&gt; The planner and critic return Pydantic objects (&lt;code&gt;Plan&lt;/code&gt; and &lt;code&gt;Critique&lt;/code&gt;), so the rest of the code works with typed fields instead of strings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools.&lt;/strong&gt; Web search is wrapped as a &lt;code&gt;@tool&lt;/code&gt;. Instead of searching each sub-question word for word, the model writes its own queries: given "How fast is FastAPI compared to Flask?", it searched for "FastAPI vs Flask performance benchmark".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval.&lt;/strong&gt; Search snippets are short. The researcher downloads the full pages, splits them into chunks, embeds them with a local &lt;code&gt;nomic-embed-text&lt;/code&gt; model and gives the writer only the most relevant passages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  LangGraph: the process, written down
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Without it&lt;/strong&gt;, a multi-step agent becomes a &lt;code&gt;while&lt;/code&gt; loop that passes a growing set of variables from step to step. Then you need parallel research, a revision limit, a pause for human approval and the ability to resume after a crash, and the loop becomes the hardest part of the codebase to change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With it&lt;/strong&gt;, the process is a graph:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shared, typed state.&lt;/strong&gt; Each node reads the state and returns only the fields it changes. Findings from parallel researchers are merged automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conditional edges.&lt;/strong&gt; The critic's verdict decides the next step: rewrite, research more or save. A &lt;code&gt;max_revisions&lt;/code&gt; setting guarantees the loop ends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallel work.&lt;/strong&gt; &lt;code&gt;Send&lt;/code&gt; starts one researcher per sub-question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human approval.&lt;/strong&gt; &lt;code&gt;interrupt()&lt;/code&gt; pauses the run after planning. The caller can accept or edit the plan and resume with &lt;code&gt;Command(resume=...)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checkpointing.&lt;/strong&gt; Each step is saved to SQLite, so a paused run can be resumed later, even after a restart.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The graph code describes the process instead of hiding it inside control flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  LangSmith: seeing what happened
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Without it&lt;/strong&gt;, a bad report is a mystery. The cause could be a vague plan, poor search queries, pages that failed to load, a writer that ignored its sources or a critic that approved too quickly. You add print statements, run the agent again and wait another few minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With it&lt;/strong&gt;, every run is recorded as a trace once you set an environment variable. Each step's inputs, outputs, latency and token usage are listed in order: every search query the model chose, every passage it retrieved and every score the critic gave. When a report is weak, you open the trace and find the step that went wrong instead of guessing.&lt;/p&gt;

&lt;p&gt;LangSmith also supports evaluations, where you run the agent against a set of questions and score the results to check that a change actually helped. Tracing alone was enough to justify setting it up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you need all three?
&lt;/h2&gt;

&lt;p&gt;No. They're independent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A single prompt with no loop doesn't need LangGraph.&lt;/li&gt;
&lt;li&gt;LangGraph works without LangChain models.&lt;/li&gt;
&lt;li&gt;LangSmith can trace any Python code with the &lt;code&gt;@traceable&lt;/code&gt; decorator.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They're useful together because each one covers a different weakness: inconsistent output, fragile process, and work you can't see. Once an LLM application has more than one step, you usually run into all three.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The full agent is on GitHub, including the graph, prompts and tests that run without API keys or a running model: &lt;strong&gt;&lt;a href="https://github.com/ChristineWanjau/research-agent" rel="noopener noreferrer"&gt;github.com/ChristineWanjau/research-agent&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Clone it, pull two Ollama models and run it on a question you care about. If you turn on LangSmith, open the trace and follow the agent's work step by step.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>langchain</category>
      <category>langgraph</category>
      <category>langsmith</category>
    </item>
  </channel>
</rss>
