🚀
🕸️ LangGraph
4. Sequential Graph
AI

Sequential Graph ♾️

1. Create multiple Nodes that sequentially process and update different parts of the state.

Mar 202510 min read

Sequential Graph ♾️

Objectives ✅
  1. Create multiple Nodes that sequentially process and update different parts of the state.
  2. Connect Nodes together in a graph.
  3. Invoke the Graph and see how the state is transformed step-by-step.
from typing import TypedDict
from langgraph.graph import StateGraph
 
class AgentState(TypedDict):
    name: str
    age: str
    final: str
 
def first_node(state: AgentState) -> AgentState:
    """This is the first node of our sequence."""
    state['final'] = f'Hi, {state['name']}'
 
    return state
 
def second_node(state: AgentState) -> AgentState:
    """This is the second node of our sequence."""
    state['final'] += f'You are {state['age']} years old.'
 
    return state
graph = StateGraph(AgentState)
 
graph.add_node('first_node', first_node)
graph.add_node('second_node', second_node)
 
# START
graph.set_entry_point('first_node')
 
# EDGE
graph.add_edge('first_node', 'second_node')
 
# END
graph.set_finish_point('second_node')
 
app = graph.compile()
result = app.invoke({"name": "Alice", "age": "30"})
 
print(result['final'])

"sequential graph"

OUTPUT:
 
'Hi, AliceYou are 30 years old.'

© 2026 Driptanil Datta. All rights reserved.

Software Developer & Engineer

Disclaimer:The content provided on this blog is for educational and informational purposes only. While I strive for accuracy, all information is provided "as is" without any warranties of completeness, reliability, or accuracy. Any action you take upon the information found on this website is strictly at your own risk.

Copyright & IP:Certain technical content, interview questions, and datasets are curated from external educational sources to provide a centralized learning resource. Respect for original authorship is maintained; no copyright infringement is intended. All trademarks, logos, and brand names are the property of their respective owners.

System Operational

Built with Love ❤️ | Last updated: Mar 16 2026