🚀
langraph
2. Hello World Graph

Hello World Graph 🌍

Objectives ✅
  1. Understand and define the AgentState structure
  2. Create simple node functions to process and update statte
  3. Set up a basic LangGraph structure
  4. Compile and invoke a LangGraph graph
  5. Understand how data flows through a single-node in LangGraph
from typing import Dict, TypedDict
 
from langgraph.graph import StateGraph
class AgentState(TypedDict): # Our State Schema
    message: str
 
def greeting_node(state: AgentState) -> AgentState:
    '''Simple node that adds a greeting message to the state.'''
 
    state['message'] = "Hey " + state['message'] + ", how is your day going!"
    return state
graph = StateGraph(AgentState)
 
graph.add_node("greeter", greeting_node)
 
# START
graph.set_entry_point("greeter")
 
# END
graph.set_finish_point("greeter")
 
app = graph.compile()
result = app.invoke({"message": "Alice"})
 
result['message']

"hello world graph"

OUTPUT:
 
'Hey Alice, how is your day going!'

© 2024 Driptanil Datta.All rights reserved

Made with Love ❤️

Last updated on Mon Oct 20 2025