PocketFlow
Pocket Flow: 100-line LLM framework. Let Agents build Agents!
Install / Use
/learn @The-Pocket/PocketFlowREADME
English | 中文 | Español | 日本語 | Deutsch | Русский | Português | Français | 한국어
<a href="https://discord.gg/hUHHE9Sa6T">
<img src="https://img.shields.io/discord/1346833819172601907?logo=discord&style=flat">
</a>
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!
Get started with Pocket Flow:
- To install,
pip install pocketflowor just copy the source code (only 100 lines). - To learn more, check out the video tutorial and documentation
- 🎉 Join our Discord to connect with other developers building with Pocket Flow!
- 🎉 Pocket Flow now has Typescript, Java, C++, Go, Rust and PHP versions!
Why Pocket Flow?
Current LLM frameworks are bloated... You only need 100 lines for LLM Framework!
<div align="center"> <img src="https://github.com/The-Pocket/.github/raw/main/assets/meme.jpg" width="400"/>| | Abstraction | App-Specific Wrappers | Vendor-Specific Wrappers | Lines | Size | |----------------|:-----------------------------: |:-----------------------------------------------------------:|:------------------------------------------------------------:|:---------------:|:----------------------------:| | LangChain | Agent, Chain | Many <br><sup><sub>(e.g., QA, Summarization)</sub></sup> | Many <br><sup><sub>(e.g., OpenAI, Pinecone, etc.)</sub></sup> | 405K | +166MB | | CrewAI | Agent, Chain | Many <br><sup><sub>(e.g., FileReadTool, SerperDevTool)</sub></sup> | Many <br><sup><sub>(e.g., OpenAI, Anthropic, Pinecone, etc.)</sub></sup> | 18K | +173MB | | SmolAgent | Agent | Some <br><sup><sub>(e.g., CodeAgent, VisitWebTool)</sub></sup> | Some <br><sup><sub>(e.g., DuckDuckGo, Hugging Face, etc.)</sub></sup> | 8K | +198MB | | LangGraph | Agent, Graph | Some <br><sup><sub>(e.g., Semantic Search)</sub></sup> | Some <br><sup><sub>(e.g., PostgresStore, SqliteSaver, etc.) </sub></sup> | 37K | +51MB | | AutoGen | Agent | Some <br><sup><sub>(e.g., Tool Agent, Chat Agent)</sub></sup> | Many <sup><sub>[Optional]<br> (e.g., OpenAI, Pinecone, etc.)</sub></sup> | 7K <br><sup><sub>(core-only)</sub></sup> | +26MB <br><sup><sub>(core-only)</sub></sup> | | PocketFlow | Graph | None | None | 100 | +56KB |
</div>How does Pocket Flow work?
The 100 lines capture the core abstraction of LLM frameworks: Graph! <br>
<div align="center"> <img src="https://github.com/The-Pocket/.github/raw/main/assets/abstraction.png" width="900"/> </div> <br>From there, it's easy to implement popular design patterns like (Multi-)Agents, Workflow, RAG, etc. <br>
<div align="center"> <img src="https://github.com/The-Pocket/.github/raw/main/assets/design.png" width="900"/> </div> <br> ✨ Below are basic tutorials: <div align="center">| Name | Difficulty | Description |
| :-------------: | :-------------: | :--------------------- |
| Chat | ☆☆☆ <sup>Dummy</sup> | A basic chat bot with conversation history |
| Structured Output | ☆☆☆ <sup>Dummy</sup> | Extracting structured data from resumes by prompting |
| Workflow | ☆☆☆ <sup>Dummy</sup> | A writing workflow that outlines, writes content, and applies styling |
| Agent | ☆☆☆ <sup>Dummy</sup> | A research agent that can search the web and answer questions |
| RAG | ☆☆☆ <sup>Dummy</sup> | A simple Retrieval-augmented Generation process |
| Batch | ☆☆☆ <sup>Dummy</sup> | A batch processor that translates markdown into multiple languages |
| Streaming | ☆☆☆ <sup>Dummy</sup> | A real-time LLM streaming demo with user interrupt capability |
| Chat Guardrail | ☆☆☆ <sup>Dummy</sup> | A travel advisor chatbot that only processes travel-related queries |
| Majority Vote | ☆☆☆ <sup>Dummy</sup> | Improve reasoning accuracy by aggregating multiple solution attempts |
| Map-Reduce | ☆☆☆ <sup>Dummy</sup> | Batch resume qualification using map-reduce pattern |
| CLI HITL | ☆☆☆ <sup>Dummy</sup> | A command-line joke generator with human-in-the-loop feedback |
| Multi-Agent | ★☆☆ <sup>Beginner</sup> | A Taboo word game for async communication between 2 agents |
| Supervisor | ★☆☆ <sup>Beginner</sup> | Research agent is getting unreliable... Let's build a supervision process|
| Parallel | ★☆☆ <sup>Beginner</sup> | A parallel execution demo that shows 3x speedup |
| Parallel Flow | ★☆☆ <sup>Beginner</sup> | A parallel image processing showing 8x speedup |
| Thinking | ★☆☆ <sup>Beginner</sup> | Solve complex reasoning problems through Chain-of-Thought |
| Memory | ★☆☆ <sup>Beginner</sup> | A chat bot with short-term and long-term memory |
| Text2SQL | ★☆☆ <sup>Beginner</sup> | Convert natural language to SQL queries with an auto-debug loop |
| Code Generator | ★☆☆ <sup>Beginner</sup> | Generate test cases, implement solutions, and iteratively improve code |
| MCP | ★☆☆ <sup>Beginner</sup>
Related Skills
node-connect
337.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.3kCommit, push, and open a PR
