Documents
Home>Documents>AI>Agent>LangChain

Building Complex AI Workflows with LangGraph

5 min readFeb 15, 2025Mar 5, 2026

prj_langgraph Project

prj_langgraph is an experimental project for building complex AI workflows with LangGraph.

What is LangGraph?

A graph-based AI workflow framework built by the LangChain team:

graph TD
    A[시작] --> B[입력 분석]
    B --> C{의도 분류}
    C -->|검색| D[검색 노드]
    C -->|코딩| E[코딩 노드]
    C -->|대화| F[대화 노드]
    D --> G[결과 검증]
    E --> G
    F --> G
    G --> H{품질 OK?}
    H -->|No| B
    H -->|Yes| I[최종 출력]

Basic StateGraph Structure

from langgraph.graph import StateGraph, END
from typing import TypedDict, List

class AgentState(TypedDict):
    messages: List[str]
    next_step: str
    result: str

graph = StateGraph(AgentState)

# 노드 추가
graph.add_node("analyze", analyze_input)
graph.add_node("search", search_web)
graph.add_node("generate", generate_response)

# 엣지 (라우팅) 추가
graph.add_conditional_edges(
    "analyze",
    route_by_intent,
    {"search": "search", "generate": "generate"}
)

graph.add_edge("search", "generate")
graph.add_edge("generate", END)

graph.set_entry_point("analyze")
app = graph.compile()

Multi-Agent Pattern

graph TD
    A[Supervisor Agent] --> B[Researcher]
    A --> C[Coder]
    A --> D[Reviewer]
    B --> A
    C --> A
    D --> A
    A --> E[최종 결과]

LangGraph vs LangChain

FeatureLangChainLangGraph
StructureLinear chainGraph
BranchingLimitedFlexible conditional branching
LoopsDifficultNative support
State managementManualTypedDict-based
Best suited forSimple pipelinesComplex agents

The findings from this experiment were later incorporated into the development of StreamlitLanggraphHandler in the youngjin-langchain-tools package.

Tags
LangGraphAI workflowmulti-agentStateGraphrouting