A simple agent is a loop: ask the model, call a tool, repeat. That works until the run takes ten minutes, the pod restarts in the middle, or the next step is “pay this invoice” and a person must approve it first. A loop in memory has no answer for any of those. LangGraph turns the agent into an explicit graph. You define the state, the steps (nodes) that change it and the edges that choose what runs next. A checkpointer saves the state after every step, so a run can resume after a crash, wait for an approval, or be replayed to see what happened. The CNCF Landscape lists it under AI Agent › Agent Framework as “Build resilient language agents as graphs”. It is a NON CNCF tool from LangChain. The kagent brief covers the runtime that hosts it in this project.
CNCF daily · Sprint 6, post 23 of 26 · AI Agent (Agent Framework) · NON CNCF
At a glance
| Category | AI Agent › Agent Framework (Landscape) |
| CNCF status | NON CNCF, listed in the CNCF Landscape |
| Repository | github.com/langchain-ai/langgraph; docs at docs.langchain.com/oss/python/langgraph |
| Languages | Python and JavaScript, each with its own docs |
| Install | pip install -U langgraph for Python; npm install @langchain/langgraph @langchain/core for JavaScript |
| Core ideas | State, nodes, edges, checkpointers (short-term memory per thread) and stores (long-term memory across threads) |
| Key features per the docs | Durable execution, streaming, human-in-the-loop and persistence |
| Works with | LangChain and LangSmith, but the docs say it does not require them |
| Versions seen | A third-party tutorial pins langgraph==1.2.11; I did not confirm the current release, so pin the one you test |
| Hosting | Your own container, or the vendor’s Agent Server and LangSmith Deployment |
The problem LangGraph solves
| Question | A loop in a script | LangGraph |
|---|---|---|
| The pod restarts mid-run | Everything is lost | Resume from the last checkpoint |
| A person must approve a step | Block a process, or build a custom queue | Interrupt the graph and resume with the answer |
| Why did it do that? | Read the logs | Inspect and replay the saved states |
| Conversation memory | Keep it in the process | Checkpointer per thread, store across threads |
| Complicated control flow | Nested ifs in one function | Explicit nodes and edges, with branches and cycles |
| Streaming progress | Custom code | Streaming built in |
Key concepts
| Term | Meaning |
|---|---|
| State | The shared data the graph passes between steps, such as the message list |
| Node | A function that reads the state and returns changes |
| Edge | A link that says which node runs next; it can be conditional |
| StateGraph | The builder you add nodes and edges to, then compile |
| Checkpointer | Saves a snapshot of the state at each step, organised into threads |
| Thread | One conversation or run, identified by a thread_id |
| Store | Long-term memory shared across threads |
| Interrupt | A pause in a node that waits for outside input, such as an approval |
| Streaming | Sending progress and tokens while the graph runs |
| Agent Server | The vendor’s server that runs graphs and handles persistence for you |
Architecture
Blue is the user, approval and backends, grey is hosting, storage and the gateway and teal is the LangGraph agent. Open the zoomable diagram, or download it as SVG or PNG.
| Component | Responsibility |
|---|---|
| ERP user | Asks the copilot a question or requests an action. |
| kagent | Hosts the agent and routes requests to it. The kagent brief says its byo harness can run an image that speaks its A2A contract, which is how a LangGraph agent fits. |
| LangGraph agent | The graph: plan, call tools, decide, answer. |
| Human approval | A person approves writes before they happen. |
| Checkpoint store | A database holding the state after each step. |
| agentgateway | Authentication, limits and audit for model and tool calls. See the agentgateway brief. |
| vLLM and MCP tools | The model server and the ERP functions. See the vLLM brief and the MCP brief. |
A run with an approval
- Invoke. A request arrives with a thread id.
- Tool call. The plan node lets the model choose a step, and the tool node calls an MCP tool.
- Write? If the tool would change data, the graph interrupts.
- Approved. A person approves, and the run resumes from its saved state.
- State. Every step is saved as a checkpoint.
Open the zoomable flow diagram, or download it as SVG or PNG.
Real world: the payment that waited for a manager
An accounts-payable user asks the copilot to pay a vendor’s overdue invoices. The graph looks up the invoices, builds a payment request and reaches the node that would create it. Because that is a write, the graph interrupts and the manager gets an approval task. The manager answers the next morning. The pod has been replaced twice overnight, but the thread’s checkpoint holds the full state, so the graph resumes exactly at the payment node, uses the approval and finishes. The audit trail shows every step and who approved.
Install LangGraph
python3 -m venv .venv && source .venv/bin/activate
pip install -U langgraph
That is the install line in the LangGraph docs. The docs show a hello-world graph that needs no model key:
from langgraph.graph import StateGraph, MessagesState, START, END
def mock_llm(state: MessagesState):
return {"messages": [{"role": "ai", "content": "hello world"}]}
graph = StateGraph(MessagesState)
graph.add_node(mock_llm)
graph.add_edge(START, "mock_llm")
graph.add_edge("mock_llm", END)
graph = graph.compile()
graph.invoke({"messages": [{"role": "user", "content": "hi!"}]})
I did not run it. The add_edge and compile lines are my completion of the docs snippet, which the search result showed only up to add_node; check them against the docs for your version.
For persistence, the docs say to compile with a checkpointer, a store or both. The in-memory classes are for tests:
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.store.memory import InMemoryStore
graph = builder.compile(checkpointer=InMemorySaver(), store=InMemoryStore())
The docs say the checkpointer uses thread_id as its key, so pass one on every call:
config = {"configurable": {"thread_id": "invoice-run-42"}}
graph.invoke({"messages": [...]}, config)
For production, use a database-backed checkpointer such as the PostgreSQL one from the langgraph-checkpoint-postgres package, which I know from the project’s ecosystem but did not verify for this post. The docs also say the vendor’s Agent Server handles persistence automatically.
Try it
An approval step with an interrupt, as a sketch. The names interrupt and Command come from the LangGraph interrupts documentation as I know it; confirm the imports and the resume call for your version before using it.
from langgraph.types import interrupt, Command
def create_payment(state):
# Pause here; the value is shown to whoever approves
answer = interrupt({"action": "create_payment", "invoices": state["invoice_ids"]})
if answer != "approve":
return {"messages": [{"role": "ai", "content": "Payment not approved."}]}
# ... call the ERP MCP tool here ...
return {"messages": [{"role": "ai", "content": "Payment request created."}]}
# first call stops at the interrupt; later, resume with the decision on the same thread
graph.invoke(Command(resume="approve"), config)
Without a checkpointer, an interrupt cannot resume, because the docs say the checkpointer’s thread_id is what loads the saved state.
Production reference design
- Durable checkpointer. Use a database-backed checkpointer, not the in-memory one, and back it up like application data.
- One thread per run. Create a stable
thread_idfor each conversation or job, and map it to the user and tenant. - Small, named nodes. Keep each node doing one thing, so checkpoints and traces are readable.
- Write tools behind interrupts. Anything that changes data waits for approval; reads do not.
- Idempotent tools. A resumed or retried step may run again, so tool calls must tolerate repeats.
- Go through the gateway. Send model and tool calls through agentgateway so identity, limits and audit apply.
- Limit loops. Set a recursion or step limit so a confused agent cannot run forever.
- Stream to the UI. Stream progress so users see steps and are not left waiting.
- Test the graph. Run golden questions with DeepEval, and test the interrupt and resume path.
- Pin versions. Pin
langgraph, the checkpointer package and the model integration packages together.
Security
- State holds data. Checkpoints contain prompts, tool results and possibly personal data; encrypt the database, restrict access and set retention.
- Thread isolation. Make sure a user cannot read or resume another user’s
thread_id; derive it from the authenticated identity. - Approvals are a control. Make sure the approval comes from an authorised person, through a path the agent cannot call itself.
- Prompt injection. Tool results can contain instructions; keep write tools behind approvals and scopes.
- Secrets. Keep model and tool credentials in the gateway or a secret store, not in graph state.
- Dependencies. The framework and its integrations pull many packages; pin, scan and mirror them.
- Trace data. If you send traces to a hosted service, decide whether prompts and data may leave your network.
Troubleshooting
This table comes from the LangGraph documentation and common agent-runtime problems. I did not run LangGraph for this post, so verify each entry in your environment.
| Symptom | Likely cause | How to check | Fix |
|---|---|---|---|
| Interrupt does not resume | No checkpointer, or a different thread_id |
The compile call and the config on each invoke | Compile with a checkpointer and reuse the same thread_id |
| State lost after a restart | In-memory checkpointer | Which saver class is used | Switch to a database-backed checkpointer |
ImportError for graph or saver classes |
API changed between versions | pip show langgraph; the docs for that version |
Match imports to the installed version and pin it |
| Run never ends | A cycle with no exit condition | Trace the node sequence | Fix the conditional edge, and set a step limit |
| Resume repeats a tool call | The step re-ran after the checkpoint | Look at which node was interrupted | Make the tool idempotent, or check state before acting |
| State keeps growing | Message list never trimmed | Size of checkpoints | Trim or summarise messages, set retention |
| Users see each other’s history | Shared thread_id |
How ids are built | Derive the thread id from the user and tenant |
| Model errors inside a node | Provider key or network | The node’s exception | Call the model through the gateway; check credentials and limits |
| Works locally, fails on kagent | The image does not meet the harness contract | kagent logs and the Harness settings | Follow the byo harness requirements in the kagent docs |
| Slow responses | Many sequential model calls | Trace timing per node | Merge steps, parallelise independent nodes, stream output |
Usage cases
- Tool-using copilots. Plan, call tools, answer, with state kept between steps.
- Approval workflows. Pause before payments, deletions or emails.
- Long-running jobs. Research or processing runs that survive restarts.
- Multi-step data tasks. Retrieve, validate, transform and report as separate nodes.
- Debugging agents. Replay checkpoints to see why a decision was made.
- In the Sprint 6 project. The ERP copilot’s graph with checkpoints and approvals, hosted on kagent.
Operational considerations
- Version churn. Agent frameworks change quickly; the docs have separate Python and JavaScript sections and show several styles, so pin versions and read release notes.
- Database operations. The checkpoint store becomes critical state: backups, retention and size growth.
- Framework weight. Simple flows may be clearer as plain code; use the graph when you need persistence, branching or approval.
- Observability. The docs point to LangSmith for tracing; you can send traces to another tool, such as Langfuse, covered in the next posts, but check the integration for your version.
- Vendor platform. The vendor’s Agent Server and deployment product are optional; decide whether you want them or your own container on kagent.
- Not CNCF. It is a company-led open source project; follow its releases and any licence or product changes.
Adoption
The LangGraph docs describe a deployment platform and tracing product for production use, and the framework integrates with LangChain. I did not verify named end users for this post, so none are listed.
Alternatives
| Solution | Model | Best suited to |
|---|---|---|
| kagent built-in engine | Declarative agents on Kubernetes, covered in the earlier brief | Teams that want agents as Kubernetes resources without framework code |
| CrewAI | Role-based multi-agent framework | Teams that think in roles and tasks |
| Pydantic AI | Typed Python agent framework, listed in the same Landscape group | Teams that want strong typing and validation |
| LlamaIndex workflows | Event-driven workflows, strong for retrieval | Data and RAG-heavy agents |
| Temporal or other workflow engines | General durable workflows with code | Long-running business workflows beyond AI |
| Plain code with a queue | Your own loop and database | Small flows with simple needs |
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Explicit graph makes control flow visible | More concepts than a simple loop |
| Checkpoints give resume, replay and inspection | You must run and secure the checkpoint database |
| Built-in human-in-the-loop interrupts | Requires a checkpointer and a stable thread id |
| Streaming and long-running support | The API has changed across versions |
| Works with or without LangChain | Ecosystem pulls the vendor’s tracing and deployment products |
| Python and JavaScript versions | Not a CNCF project |
Recommendation
Adopt for agents that run many steps, call write tools or need approvals. For the ERP copilot, build the agent as a LangGraph graph with a PostgreSQL checkpointer, interrupts on every write tool, calls routed through agentgateway, and the image hosted on kagent through its byo harness. Pin versions, derive thread ids from the authenticated user and tenant, make tools idempotent, and test the resume path as carefully as the happy path. For a single read-only question-and-answer flow, plain code or kagent’s built-in engine is simpler.
References: LangGraph overview (Python) · Persistence · Checkpointers (JavaScript docs) · LangGraph overview (JavaScript) · LangGraph repository · Hostinger LangGraph tutorial (version pins) · CNCF Landscape

