Pocket Flow is a 100-line minimalist LLM framework
-
Lightweight: Just 100 lines. Zero bloat, zero dependencies, zero vendor lock-in.
-
Expressive: Everything you love—(Multi-)Agents, Workflow, RAG, and more.
-
Agentic Coding: Let AI Agents (e.g., Cursor AI) build Agents—10x productivity boost!
-
To install,
pip install pocketflow
or just copy the source code (only 100 lines). -
To learn more, check out the documentation. For an in-depth design dive, read the essay.
-
🎉 We now have a discord!
Current LLM frameworks are bloated... You only need 100 lines for LLM Framework!

Abstraction | App-Specific Wrappers | Vendor-Specific Wrappers | Lines | Size | |
---|---|---|---|---|---|
LangChain | Agent, Chain | Many (e.g., QA, Summarization) |
Many (e.g., OpenAI, Pinecone, etc.) |
405K | +166MB |
CrewAI | Agent, Chain | Many (e.g., FileReadTool, SerperDevTool) |
Many (e.g., OpenAI, Anthropic, Pinecone, etc.) |
18K | +173MB |
SmolAgent | Agent | Some (e.g., CodeAgent, VisitWebTool) |
Some (e.g., DuckDuckGo, Hugging Face, etc.) |
8K | +198MB |
LangGraph | Agent, Graph | Some (e.g., Semantic Search) |
Some (e.g., PostgresStore, SqliteSaver, etc.) |
37K | +51MB |
AutoGen | Agent | Some (e.g., Tool Agent, Chat Agent) |
Many [Optional] (e.g., OpenAI, Pinecone, etc.) |
7K (core-only) |
+26MB (core-only) |
PocketFlow | Graph | None | None | 100 | +56KB |
🚀 Through Agentic Coding—the fastest LLM App development paradigm-where humans design and agents code!
✨ Below are examples of LLM Apps:
App Name | Difficulty | Topics | Human Design | Agent Code |
---|---|---|---|---|
Build Cursor with Cursor We’ll reach the singularity soon ... |
★★★ Advanced |
Agent | Design Doc | Flow Code |
Ask AI Paul Graham Ask AI Paul Graham, in case you don't get in |
★★☆ Medium |
RAG Map Reduce TTS |
Design Doc | Flow Code |
Youtube Summarizer Explain YouTube Videos to you like you're 5 |
★☆☆ Beginner |
Map Reduce | Design Doc | Flow Code |
Cold Opener Generator Instant icebreakers that turn cold leads hot |
★☆☆ Beginner |
Map Reduce Web Search |
Design Doc | Flow Code |
-
Want to learn Agentic Coding? Check out my YouTube! Read this Guide!
-
Want to build your own LLM App? Start with this template!
The 100 lines capture the core abstraction of LLM frameworks: Graph!
From there, it’s easy to implement popular design patterns like (Multi-)Agents, Workflow, RAG, etc.