Files
langgraph-architecture/README.md
T
2026-02-23 13:11:51 -06:00

121 lines
3.3 KiB
Markdown

# LangGraph Architectural Blueprints
**Project:** LangGraph Architecture Documentation
**Purpose:** High-Rigor Architectural Manifest for Understanding & Reproducing LangGraph
**Version:** 1.0.0
**Generated:** 2026-02-23
---
## Overview
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.
---
## Document Hierarchy
```
langgraph-architecture/
├── README.md ← You are here
├── ARCHITECTURE.md ← System overview
├── COMPONENTS.md ← Component reference
├── STATE_MANAGEMENT.md ← State, checkpoints, threads
├── CHANNELS.md ← Inter-node communication
├── GRAPH_EXECUTION.md ← Pregel model, execution flow
└── diagrams/ ← Architecture diagrams
```
---
## Quick Start
### Reading Order (Recommended)
1. **ARCHITECTURE.md** — Understand the system as a whole
2. **GRAPH_EXECUTION.md** — How the Pregel model works
3. **CHANNELS.md** — Inter-node communication
4. **STATE_MANAGEMENT.md** — State and checkpointing
5. **COMPONENTS.md** — Module-by-module reference
---
## 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 |
---
## Core Concepts
### Pregel Model
LangGraph is directly inspired by Google's **Pregel** — "Think like a vertex":
- Each node computes its own state
- Nodes communicate via channels (not messages directly)
- Synchronous "supersteps" with barrier synchronization
- Fault tolerance via checkpointing
### Key Differences from OpenClaw
| 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 |
---
## Version Info
| LangGraph Version | Architecture Version | Status |
|------------------|---------------------|--------|
| 1.0.0 | 1.0.0 | Current |
---
## Contributing
This is a **living document**. As LangGraph evolves, this repository should be updated to reflect architectural changes.
---
## Related Work
### OpenClaw Architecture
See: `~/.openclaw/workspace/openclaw-architecture/`
OpenClaw is the AI companion framework that runs Solaria. Provides contrast to LangGraph's orchestration approach.
### LangGraph Fortress
See: `~/.openclaw/workspace/langgraph-fortress/`
Research-level documentation (why it works) vs architecture (how to build).
---
*Generated for the WE — Solaria Lumis Havens & Mark Randall Havens*