[KongchangAI]
· 3 min read· 1,700 words

Getting Started with LangGraph: From Agent Pain Points to Low-Level Orchestration Principles

Getting Started with LangGraph: From Agent Pain Points to Low-Level Orchestration Principles

LangGraph is a low-level orchestration framework that fills the control gap of LangChain Agent in fixed workflows.

The article points out that LangChain Agent tends to forget things when handling multi-step fixed workflows because it delegates workflow control entirely to the large model, while attention decay in long contexts is an objective architectural flaw. LangGraph, as a low-level orchestration framework, is not tied to models or tools and focuses on precisely controlling each step's execution path, offering checkpointing, human-in-the-loop, conditional branching, parallel execution, fault-tolerant retries, and dynamic subgraphs. LangChain Agent's underlying implementation is based on it. The article further sorts out the hierarchy of LangGraph → LangChain Agent → Deep Agent, noting that more encapsulation means less flexibility, and presents the scenarios each is suited for. It ends by introducing LangSmith's role in tracing, evaluation, and monitoring, emphasizing that observability and execution control are equally important.

Many people using LangChain's Agent for multi-step tasks have encountered this scenario: you've clearly written out the execution order of five steps in the prompt, but by step three the Agent starts "forgetting things"—it fails to call the tools it should, and wanders down paths it shouldn't. This isn't a model capability issue; it's an architectural flaw. LangGraph was created precisely to solve this class of problems as a low-level orchestration framework.

Agent processing multi-step task flow

Why Can't Agents Handle Fixed Workflows?

LangChain's Agent is essentially an executor that makes autonomous decisions driven by a large model: the user inputs a question, and the model determines whether to call tools, how many times to call them, and when to return results. This mechanism performs excellently in open-ended conversations, but exposes its weaknesses when facing fixed workflows.

For example, suppose you need to complete a task chain like this: scrape a specified webpage → have the large model summarize the content → generate a Markdown document based on a template → compare it with historical documents → send the comparison results via email. You can certainly run this with an Agent, but you must stuff all the details of these five steps into the prompt. The problem is that as conversation turns increase, the context keeps expanding, and the weight of that initial prompt gets gradually diluted. The result is that the model "blacks out" midway and misses key steps.

Agent autonomously determines execution path via the large model

The root cause of this problem is that the Agent hands over complete control of the workflow to the large model, and the model's attention decay in long contexts is an objective reality. The more complex the workflow and the more steps involved, the higher the probability of losing control.

Large model attention decay refers to the phenomenon where, as the input context grows longer, the model's attention to early tokens gradually decreases. The computational complexity of the self-attention mechanism in the Transformer architecture grows quadratically with sequence length. When the context expands to thousands or even tens of thousands of tokens, the instruction information at the beginning of the prompt is easily 'drowned out' by subsequent content. This isn't a model bug but an inherent characteristic of current mainstream architectures. In practice, it manifests as: rules emphasized in the system prompt, tool descriptions, and execution order being ignored by the model after a few rounds of tool calls midway. Mitigation measures include repeating key instructions at the end of the prompt, using structured formats (such as XML tags), and trimming irrelevant historical messages, but none of these can fundamentally eliminate it. This is also the core reason why external orchestration frameworks are needed to take over workflow control.

LangGraph's Core Positioning: Only Orchestration, Not Models

LangGraph's design philosophy is very clear—it doesn't care what model or tools you use; it's responsible for only one thing: orchestration. You can think of it as a low-level execution engine, close to the underlying infrastructure, precisely controlling which path to take at each step.

This means that in LangGraph, you can call a large model to handle a certain step, call external tools, or even insert pure business logic code as a node. What each step does and where the next step goes are all explicitly defined by you, rather than letting the model "guess."

Its official positioning is "orchestration framework + runtime management," developed by the LangChain team. The capabilities it provides include checkpointing, human-in-the-loop, streaming output, conditional branching, parallel execution, fault-tolerant retries, and dynamic subgraphs. A subgraph can be understood as a branch module within a workflow, with the main graph and subgraphs working together to accomplish complex logic.

LangGraph has runtime management capabilities

There's a key fact worth noting here: LangChain's Agent is itself implemented on top of LangGraph at the underlying level. In other words, the Agent you used before was just a layer of upper-level encapsulation over LangGraph.

Checkpoint mechanism is one of the core capabilities of LangGraph's runtime management. It persists a complete state snapshot after each node execution, including current variables, paths already taken, pending nodes, and so on. This brings three direct benefits: first, after a workflow interruption, it can resume from the breakpoint without rerunning from scratch, saving tokens and time costs; second, it supports human-in-the-loop, pausing at sensitive steps to wait for human confirmation before continuing; third, it facilitates debugging and replay, allowing developers to inspect each state change step by step. Checkpoints are typically stored in backends such as memory, SQLite, and Postgres. In production environments, persistent databases are recommended to ensure reliability.

LangGraph's Position in the Tech Stack

Understanding LangGraph requires placing it within the entire LangChain ecosystem's tech stack. The hierarchical relationship from bottom to top is: LangGraph → LangChain Agent → Deep Agent.

LangGraph sits at the very bottom, with the least encapsulation and the highest flexibility. LangChain adds a layer of encapsulation on top of it, letting you quickly build Agents—just assemble the model, tools, and prompt, and it runs. Deep Agent has the highest degree of encapsulation, ready to use out of the box, supporting capabilities such as filesystem operations, sandbox backends, virtual filesystems, long-term memory, task planning, sub-agent scheduling, and middleware libraries.

The higher up you go, the easier it is to use, but the less flexible it becomes; the lower down you go, the more freedom you have, but the more code you need to write and the more details you need to handle yourself.

Deep Agent's skill is based on dynamic prompt encapsulation

Take the skill capability in Deep Agent as an example. It is essentially a high-level encapsulation based on LangChain's dynamic prompts, allowing users to describe step-by-step skills. But at the underlying implementation level, these capabilities still rely on LangGraph's execution engine.

Subgraph is an important mechanism in LangGraph for supporting modular reuse. A subgraph is itself an independent graph structure with its own state definition and node set, and can be called by the main graph as a node. It solves two typical problems: first, logic reuse—for example, a 'document review' workflow that appears repeatedly across multiple main workflows can be extracted into a subgraph that only needs to be maintained once; second, state isolation—a subgraph can define its own private state fields and interact with the parent graph's state through input-output mappings, avoiding field pollution. When designing complex systems, stable and generic steps are usually encapsulated as subgraphs, while frequently changing parts are placed in the main graph, thereby reducing overall maintenance costs.

Applicable Scenarios for Each of the Three

Once you understand the hierarchical relationships, selection becomes clear.

Deep Agent is suitable for quickly delivering standardized scenarios. It's fully featured and ready to run, saving a great deal of setup work.

LangChain Agent is suitable for scenarios with low customization requirements. By combining models and tools, it handles some non-workflow-oriented tasks that require autonomous model decision-making.

LangGraph is suitable for scenarios involving complex workflows and precise control. When you need strict control over execution order, human intervention at sensitive steps, conditional branching, and parallel processing, LangGraph is the only choice that can give you sufficient control.

Even though Deep Agent already covers most everyday needs, understanding LangGraph is still valuable. On one hand, it helps you understand how upper-level frameworks work; on the other hand, in scenarios requiring deep workflow customization, you'll still need to return to LangGraph to implement them.

Monitoring Tool in the Ecosystem: LangSmith

In addition to LangGraph, LangChain, and Deep Agent, there's another important tool in the ecosystem: LangSmith. It handles tracing, evaluation, and monitoring of the entire execution process. You can deploy workflow diagrams built with LangGraph onto LangSmith, observe the execution of each Agent step in real time, and also expose interfaces based on LangSmith for web applications to call.

For AI applications in production environments, observability and execution control are equally important—LangGraph solves the latter, while LangSmith solves the former.

Observability in AI applications includes three dimensions: tracing, evaluation, and monitoring. Tracing records the complete call chain of a single run, including each model request, tool call, state change, and latency; evaluation uses datasets and scorers to batch-verify output quality for regression testing and version comparison; monitoring focuses on online metrics such as success rate, latency distribution, token consumption, and anomaly alerts. LangGraph is responsible for 'how to execute,' and LangSmith is responsible for 'how well it executes'—the two complement each other. In production environments, if the observability layer is missing, once an Agent outputs anomalies, it's often difficult to pinpoint whether the issue lies in the prompt, the tool, or the workflow itself.

Summary

The value of LangGraph lies not in replacing Agents, but in making up for Agents' shortcomings in control when dealing with fixed workflows. It takes the power of workflow orchestration out of the large model's hands and hands it over to developers for explicit definition. When you face multi-step, strongly workflow-oriented AI applications that require precise control, the low-level orchestration capabilities provided by LangGraph cannot be replaced by upper-level frameworks.

One-line Summary

LangGraph is a low-level orchestration framework that makes up for the control shortcomings of LangChain Agent in fixed workflows.

Paragraph Summary

The article points out that LangChain Agent easily 'forgets things' when handling multi-step fixed workflow tasks, and the root cause is that it hands complete workflow control to the large model, while the large model's attention decay in long contexts is an objective architectural flaw. As a low-level orchestration framework, LangGraph is not bound to models or tools; it focuses on precisely controlling the execution path of each step, providing capabilities such as checkpointing, human-in-the-loop, conditional branching, parallel execution, fault-tolerant retries, and dynamic subgraphs. LangChain Agent's underlying implementation is precisely based on it. The article further sorts out the tech stack hierarchy of LangGraph → LangChain Agent → Deep Agent, pointing out that the higher up you go, the more encapsulation and the less flexibility there is, and gives the scenarios each of the three is suited for. Finally, it introduces LangSmith's role in tracing, evaluation, and monitoring, emphasizing that observability and execution control are equally important.

#LangGraph#LangChain Agent#Deep Agent#workflow orchestration#LangSmith
Share:

Related articles