Skip to content

Hello World Graph

Updated
17 Sept 2026
1 min read
0 sections
Page 11 of 18
Langgraph

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
python
from typing import Dict, TypedDict

from langgraph.graph import StateGraph
python
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
python
graph = StateGraph(AgentState)

graph.add_node("greeter", greeting_node)

# START
graph.set_entry_point("greeter")

# END
graph.set_finish_point("greeter")

app = graph.compile()
python
result = app.invoke({"message": "Alice"})

result['message']
hello world graph
hello world graph
powershell
OUTPUT:

'Hey Alice, how is your day going!'