๐Ÿš€
๐Ÿ•ธ๏ธ LangGraph
3. Multiple Input Graph
AI

Multiple Input Graph ๐Ÿ”ข

1. Define a more complex AgentState

Mar 202510 min read

Multiple Input Graph ๐Ÿ”ข

Objectives โœ…
  1. Define a more complex AgentState
  2. Create a processing node that performs operations on list data
  3. Set up a LangGraph that processes and outputs computed results.
  4. Invoke the graph with structured inputs and retrieve outputs
from typing import List, TypedDict
 
from langgraph.graph import StateGraph
 
class AgentState(TypedDict):
    values: List[int]
    name: str
    result: str
 
def process_values(state: AgentState) -> AgentState:
    """This function processes a list of values and returns their sum as a string."""
 
    total = sum(state['values'])
    state['result'] = f"The sum of values for {state['name']} is {total}."
    return state
graph = StateGraph(AgentState)
 
graph.add_node("processor", process_values)
 
# START
graph.set_entry_point("processor")
 
# END
graph.set_finish_point("processor")
 
app = graph.compile()
result = app.invoke({"values": [1, 2, 3, 4, 5], "name": "Alice"})
 
result['result']

"multi input graph"

OUTPUT:
 
'The sum of values for Alice is 15.'

ยฉ 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