OPEN-SOURCE LANGGRAPH PROJECT / 2026

Build workflows.
Orchestrate with state.

Explore real Python examples of LangGraph's graph execution, conditional routing, typed state, reducers, message history, and reusable HR/IT subgraphs. Start offline; connect an OpenAI model only when you choose to.

LangGraph StateGraphPythonPydanticReducersSubgraphs

A graph-orchestration learning project—not LLM pretraining, a deployed autonomous-agent platform, or a production benchmark.

18Example topics
in the Python CLI
16Offline examples
without hosted LLM
02Optional OpenAI
integrations

WHAT THE CODE DEMONSTRATES

The building blocks of agent workflows.

These capabilities are based on the current Python source. Each example keeps a focused scope so you can inspect graph execution and state behavior separately.

Nodes & edges

Compile StateGraph workflows with START/END transitions and sequential node execution.

Conditional routes

Route execution using intermediate values and explicit branch mappings.

Typed state

Use TypedDict with input/output or private channels and partial node updates.

Pydantic validation

Validate bounded values explicitly, including calculated outputs.

Custom reducers

Compare overwrites, numeric/list accumulation and distinct-item merging.

Message memory

Demonstrate add_messages and MessagesState without a hosted model.

Subgraph composition

Show wrapper-based and direct shared-schema HR / IT orchestration.

Offline-first runs

Explore sixteen deterministic examples without an LLM API or GPU.

Opt-in LLM calls

Two OpenAI integrations gated behind configuration and explicit selection.

Documentation output

Export Mermaid graph sources and example results as JSON.

Notebook companion

Run a companion Jupyter notebook alongside the CLI implementation.

Windows friendly

Install using a Python virtual environment; optional launcher available.

HIGH-LEVEL DESIGN

State flows through the graph.

LangGraph compiles nodes and edges into executable workflows. The implementation demonstrates branch selection, state updates, message reduction, and nested graph composition.

Request → decision → state update
STARTinitial input
StateGraphnodes + edges
Routerconditional branch
Conditional execution

Different handlers can run based on the state returned by an earlier node. The project's numerical routing example selects multiplication or subtraction.

State schema
TypedDict / Pydantic
Update strategy
Overwrite / reducer
Conversation
add_messages / MessagesState
Composition
Parent graph / subgraph
01 / State contracts

Input, internal, private, and output schemas make data flow explicit. Nodes return partial dictionaries instead of mutating the input state.

02 / Reducers and message history

Examples contrast overwriting a value with additive accumulation, unique-list merging, and message-ID-aware updates using add_messages.

03 / HR ↔ IT subgraphs

Two compositional patterns illustrate calling an IT graph inside an HR node or attaching a compiled IT graph directly when the schemas match. These are workflow examples, not independent deployed agents.

EXAMPLE DIRECTORY

18 practical LangGraph lessons.

Browse by topic. Sixteen examples are deterministic and API-free; two illustrate optional hosted model integration. All eighteen are present in the repository's Python CLI.

Showing all 18 examplesUse --topic to run individually
01 / 18Foundations

A first graph

Build a single greeting node, connect START and END, compile and invoke the graph.

02 / 18Foundations

Node execution

Run an integer-processing node with an explicit input and deterministic output.

03 / 18Optional API

Optional LLM node

Invoke a hosted OpenAI model through a LangGraph node when configured.

04 / 18Foundations

Sequential edges

Compose reverse-string and uppercase nodes with normal graph edges.

05 / 18Routing

Conditional routing

Route data to multiplication or subtraction branches based on the intermediate state.

06 / 18State

TypedDict state

Define structured state keys and route even/odd values using partial state updates.

07 / 18State

Pydantic validation

Validate input bounds and explicitly validate computed output before updating state.

08 / 18State

Input/output schemas

Separate input, internal and output schemas to expose a focused graph interface.

09 / 18State

Private intermediate state

Pass derived counts between nodes without exposing them as public output.

10 / 18Reducers

Overwrite behavior

Compare the default last-write state behavior with reducer-based merging.

11 / 18Reducers

Numeric accumulation

Use Annotated state with operator.add to combine integer updates.

12 / 18Reducers

List accumulation

Append list values across graph nodes using an addition reducer.

13 / 18Reducers

Custom unique merge

Preserve insertion order while combining distinct list values through a custom reducer.

14 / 18Messaging

Message reducer

Merge or replace LangChain messages using stable IDs and add_messages.

15 / 18Messaging

Offline conversation state

Construct a MessagesState graph with structured conversation history, no API required.

16 / 18Optional API

LLM + MessagesState

Use an optional OpenAI model with message state and a personalized prompt.

17 / 18Subgraphs

HR + IT wrapper

Invoke an IT subgraph inside an HR parent node while adapting different state schemas.

18 / 18Subgraphs

Shared-state subgraph

Add a compiled IT subgraph directly as a node in the HR parent graph.

GETTING STARTED

From clone to first graph.

These commands use the filenames currently present in your GitHub repository. Python 3.11 or 3.12 is recommended; a GPU is not required for the orchestration examples.

Install dependencies
git clone https://github.com/su394611-del/Mutli-agents-using-LangGraph.git
cd Mutli-agents-using-LangGraph
py -3.12 -m venv .venv-langgraph
.\.venv-langgraph\Scripts\python.exe -m pip install --upgrade pip
.\.venv-langgraph\Scripts\python.exe -m pip install -r requirements_langgraph_example.txt
List and self-test examples
.\.venv-langgraph\Scripts\python.exe langgraph_example_multi_agents.py --list
.\.venv-langgraph\Scripts\python.exe langgraph_example_multi_agents.py --self-test
Run a selected workflow
.\.venv-langgraph\Scripts\python.exe langgraph_example_multi_agents.py --topic conditional_edges
.\.venv-langgraph\Scripts\python.exe langgraph_example_multi_agents.py --topic subgraph_wrapper
Export graph source and results
.\.venv-langgraph\Scripts\python.exe langgraph_example_multi_agents.py --export-mermaid .\diagrams --json-output .\results.json

SOURCE & DOCUMENTATION

Inspect every implementation detail.

The project exposes its Python functions, example notebook, dependencies and README directly. Explore the exact code behind each behavior rather than relying on a marketing description.

Implementation boundaries

This is a runnable Python learning project for LangGraph orchestration. Its offline examples use deterministic Python operations—not an on-device trained language model.

  • The two OpenAI examples require credentials, network access and optional third-party packages.
  • HR/IT subgraphs model workflow coordination; they do not constitute a deployed multi-agent workforce.
  • No proprietary training data, model weights, distributed training, inference benchmark, or enterprise availability claim is implied.
  • Examples cover graph logic, but production deployments require appropriate persistence, testing, observability, access controls, and failure handling.