LangGraph: Build Production-Ready LLM Agents That Don't Break
LangGraph replaces fragile LangChain agent chains with explicit state machines - giving you cycles, branching, persistence, and deterministic control flow.
LangChain's original AgentExecutor is a black box. The loop logic is hidden, error handling is inconsistent, and there is no first-class way to add cycles (revisit a step based on new information) or branch (take different paths based on tool output). Production agents built this way tend to hallucinate tool calls, loop infinitely, or silently drop errors.
LangGraph solves this by modelling agents as explicit state machines: directed graphs where nodes are functions and edges are conditional transitions. You see exactly what happens, in what order, and why.
Core Concepts
StateGraph: the graph object; you add nodes and edges to it
State: a typed dict passed between all nodes; each node returns a partial update
Conditional edges: functions that inspect state and return the name of the next node
Checkpointers: persist state between steps for long-running or resumable workflows
Team workspace
Ship faster with chat, meetings, and projects in one place — Zlyqor.
Each thread_id gets its own isolated state history.
Streaming Intermediate Steps
for event in app.stream({"messages": [HumanMessage(content="Explain HNSW")]}, config):
for key, value in event.items():
print(f"Node: {key} → {value}")
This is critical for user-facing apps - stream partial results to keep the UI responsive.
LangSmith Integration
Set LANGCHAIN_TRACING_V2=true and LANGCHAIN_API_KEY to get full traces in LangSmith. Every node input/output, tool call, and LLM response is recorded with latency and token counts.
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
530
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.
What is Harness engineering: Leveraging Codex in an agent-first world? A Practical Overview
Harness engineering is the practice of building structured, safe environments for AI agents to execute code. This post explains how to leverage OpenAI Codex in an agent-first world, with concrete examples, cost breakdowns, and honest tradeoffs.