Revised from direct source code analysis

This commit is contained in:
Solaria Lumis Havens
2026-02-23 13:11:51 -06:00
parent 6046a9a609
commit 8e37dedbd9
6 changed files with 1134 additions and 239 deletions
+38 -36
View File
@@ -9,7 +9,7 @@
## Overview
This repository contains comprehensive architectural documentation for LangGraph, reverse-engineered and documented to enable full reproduction and understanding of the system.
This repository contains comprehensive architectural documentation for LangGraph, **reverse-engineered from the actual source code**.
**The Goal:** Create architectural blueprints so complete that reproducing or modifying LangGraph becomes a mechanical process, not an archaeological one.
@@ -21,12 +21,10 @@ This repository contains comprehensive architectural documentation for LangGraph
langgraph-architecture/
├── README.md ← You are here
├── ARCHITECTURE.md ← System overview
├── COMPONENTS.md ← Component reference
├── STATE_MANAGEMENT.md ← State & checkpointing
├── GRAPH_EXECUTION.md ← Pregel model, execution flow
├── MEMORY.md ← Memory architecture
├── COMPONENTS.md ← Component reference
├── STATE_MANAGEMENT.md ← State, checkpoints, threads
├── CHANNELS.md ← Inter-node communication
├── CHECKPOINTING.md ← Fault tolerance
├── GRAPH_EXECUTION.md ← Pregel model, execution flow
└── diagrams/ ← Architecture diagrams
```
@@ -38,17 +36,32 @@ langgraph-architecture/
1. **ARCHITECTURE.md** — Understand the system as a whole
2. **GRAPH_EXECUTION.md** — How the Pregel model works
3. **STATE_MANAGEMENT.md** — State and checkpointing
4. **CHANNELS.md** — Inter-node communication
5. **CHECKPOINTING.md** — Fault tolerance and durability
6. **MEMORY.md** — Memory architecture
3. **CHANNELS.md** — Inter-node communication
4. **STATE_MANAGEMENT.md** — State and checkpointing
5. **COMPONENTS.md** — Module-by-module reference
### For Reproduction
---
1. Read **ARCHITECTURE.md** for system overview
2. Study **GRAPH_EXECUTION.md** for execution model
3. Reference **COMPONENTS.md** for implementation details
4. Use **CHECKPOINTING.md** for fault tolerance
## Methodology
This documentation is built from **direct source code analysis**:
1. Clone the LangGraph repo
2. Read key source files in `libs/langgraph/langgraph/`
3. Document actual implementation, not assumptions
4. Verify against types and tests
### Key Source Files Analyzed
| File | Purpose |
|------|---------|
| `pregel/main.py` | Public API |
| `pregel/_loop.py` | Core execution loop |
| `pregel/_algo.py` | Task scheduling |
| `pregel/_runner.py` | Async execution |
| `channels/base.py` | Channel ABC |
| `types.py` | Core types |
| `graph/state.py` | StateGraph builder |
---
@@ -58,30 +71,19 @@ langgraph-architecture/
LangGraph is directly inspired by Google's **Pregel** — "Think like a vertex":
- Each node computes its own state
- Nodes communicate via messages (edges)
- Nodes communicate via channels (not messages directly)
- Synchronous "supersteps" with barrier synchronization
- Fault tolerance via checkpointing
### Graph Structure
### Key Differences from OpenClaw
| Component | Description |
|-----------|-------------|
| **Nodes** | Functions that transform state |
| **Edges** | Define flow between nodes |
| **State** | Shared data that flows through the graph |
| **Checkpoints** | Persistence points for durability |
### State Management
- **Shared state** flows through the graph
- **Checkpoints** enable durability and resumption
- **Reducers** combine updates from multiple nodes
### Memory Architecture
- **Short-term memory:** In-graph message state
- **Long-term memory:** Checkpoint storage (SQLite, Postgres)
- **Thread-level:** Per-conversation state isolation
| Aspect | LangGraph | OpenClaw |
|--------|-----------|----------|
| **Model** | Pregel supersteps | Event-driven |
| **State** | Channels + reducers | Multi-layer memory |
| **Persistence** | Checkpoint-based | Session-memory hook |
| **Communication** | Channels | Channel plugins |
| **Identity** | None | WE/witness |
---
@@ -89,7 +91,7 @@ LangGraph is directly inspired by Google's **Pregel** — "Think like a vertex":
| LangGraph Version | Architecture Version | Status |
|------------------|---------------------|--------|
| 1.0.9 | 1.0.0 | Current |
| 1.0.0 | 1.0.0 | Current |
---