Langgraph
- Refer Here for langgraph docs
- Langraph helps in building workflows with graph as a central core concept
- This is a framework built on Langchain that is used for creating stateful multi agent workflows using a graph.
- Graph is made up of nodes and edges
- Each node can be a tool, LLM, retriever or custom function
- Each edge controls data flows from one node to another
- State: This is shared across all the nodes
- A node is a python function
def node_1(state: <State>) -> State:
pass
Hello-world graph
- Create a new folder, initialize using uv & add following packages
uv add langgraph "langchain[google-vertexai]" langchain
- Write the following code in main.py
from langgraph.graph import StateGraph, END
from langchain.chat_models import init_chat_model
# Defined the state
class State(dict):
input: str
output: str
# Create a llm
llm = init_chat_model(
"gemini-2.5-flash-lite",
model_provider="google_vertexai"
)
def start_node(state: State) -> State:
state["output"] = f"you said {state['input']}"
return state
def llm_node(state: State) -> State:
response = llm.invoke(state['input'])
state["output"] = state['output'] + f"\n {response.content}"
return state
# Build a graph
graph = StateGraph(State)
graph.add_node("start", start_node)
graph.add_node("llm", llm_node)
graph.set_entry_point("start")
graph.add_edge("start", "llm")
graph.add_edge("llm", END)
if __name__ == "__main__":
# compile the graph
app = graph.compile()
result = app.invoke({"input": "What is capital of france"})
print(result)
- Now create a langgraph.json file with the following content
{
"dependencies": [
"langchain[google-vertexai]",
"langgraph"
],
"graphs": {
"main": "./main.py:graph"
}
}
- Now add one more dependency
langgraph-cli[inmem]
- cd into terminal and execute
langgraph dev which will help in opening a browser page

- Refer Here for the basic graph.
Naive RAG using langgraph
- Assume we have an ecommerce application called as
lttechworld where we sell electronic products
- We will be have three csv files
- ltttechworld_catalog.csv
- ltttechworld_faq.csv
- ltttechworld_troubleshooting.csv
- Refer Here for the changes done to add data and repo
- Lets add chroma dependency
uv add langchain-chroma langchain_core
- Refer Here for the changes done to accomodate naive rag.
