Gen-AI Developer Classroom notes 22/Oct/2025

Flight Checkin & Upgrade

  • Overview
    Preview

  • To solve most of the business or enterprise needs we need workflows

Langgraph

  • Langgraph is designed around graphs which make it feasible to run business workflows
  • Main Components of Langgraph (w.r.t) Development
    • Node: A node is a python function or runnable.
      Preview
    • Edge: This is directional flow
      Preview
    • State: This is data which is shared to all the nodes

Setting up a project with langgraph

  • Create a new folder called as hello-graph and cd into it
  • Lets create a python project and dependencies
uv init .
uv add langgraph langgraph-cli[inmem]
uv sync
  • Activate virtual environment
# windows
.venv/Scripts/activate

# linux or mac
source .venv/bin/activate
  • Now open vscode
code .
  • Lets create a simple workflow
    Preview
  • change the main.py code to the following
from langgraph.graph import START, END, StateGraph
from typing import TypedDict


class MyState(TypedDict):
    name: str
    message: str


def say_hello(state: MyState) -> MyState:
    """This is wish node

    Every node in langraph takes state as input and returns 
    state

    Args:
        state (MyState): State

    Returns:
        MyState: State
    """

    state['message'] = f"hello {state['name']}"
    return state

# design your graph
state_graph = StateGraph(MyState)
state_graph.add_node("wish", say_hello)
state_graph.add_edge(START, "wish")
state_graph.add_edge("wish", END)

# compile your graph
graph = state_graph.compile()

  • Now create a langraph.json file with following content
{
    "dependencies": ".",
    "graphs": {
        "main": "main:graph"
    }

}
  • Now in the activate virtual environment execute the following command
langgraph dev --allow-blocking
  • It would open a browser if not http://localhost:2024
    Preview

  • Refer Here for the hello-world langgraph

Lets build a graph which does add two numbers

  • Lets create a new file the same project above called as calc.py

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading