Model or dataset
The-Pocket/PocketFlow avatar
The-Pocket/PocketFlow

PocketFlow: A 100-Line Minimalist LLM Framework in Python

Pocket Flow: 100-line LLM framework. Let Agents build Agents!

11,210 stars1,212 forksPythonMIT

At a glance

What is it?
PocketFlow is a Python LLM framework whose entire core fits in 100 lines of source code with zero dependencies and no vendor lock-in. It models LLM workflows as graphs of nodes, supporting agents, multi-agent pipelines, RAG, batch processing, and streaming, and installs via pip.
Who is it for?
PocketFlow is the right tool for a developer who wants to understand the mechanics of an LLM framework without learning a large codebase, or who is prototyping an agent and wants to avoid dependency overhead. It is not appropriate for production deployments that require built-in integration with specific vector stores, cloud providers, or authentication systems, since PocketFlow provides none of those.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 66 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What PocketFlow Is and Who It Is For

PocketFlow is a Python library whose entire implementation lives in a single file containing exactly 100 lines of code. The README positions it explicitly against larger LLM frameworks: LangChain (405,000 lines, 166 MB installed), CrewAI (18,000 lines, 173 MB), LangGraph (37,000 lines, 51 MB), SmolAgent (8,000 lines, 198 MB), and AutoGen (7,000 lines core only, 26 MB core only). PocketFlow occupies 100 lines and 56 KB.

The intended audience is developers who want to build agents, RAG pipelines, batch processors, or multi-agent systems without being constrained by the abstractions of a larger framework. Because the entire framework is readable in a single sitting, it is also useful as a teaching tool for anyone who wants to understand how LLM orchestration works at the level of graph traversal and node execution. The README also describes an Agentic Coding pattern where an AI coding assistant such as Cursor AI builds PocketFlow-based agents, citing a claimed 10x productivity gain.

The Graph Abstraction at the Core

The 100 lines capture one abstraction: a graph. Each node in the graph represents a step in the workflow. Edges connect nodes and carry the flow of execution. From this single primitive, PocketFlow implements the common patterns used in LLM applications.

An Agent pattern wraps a reasoning loop: the node calls the LLM, decides on an action, executes it, and routes to the next node based on the result. A multi-agent pattern composes multiple such loops. A RAG pipeline adds a retrieval node before the generation node. A batch processor wraps a node in a loop over a list of inputs. A streaming workflow routes partial outputs from one node to the next as tokens arrive.

Because the framework has no built-in integrations, the user writes the LLM call, the vector store query, and the tool execution directly. PocketFlow provides the routing and state management. This is the trade-off: maximum control over every external call, at the cost of writing that integration code yourself.

Installing PocketFlow and Running a First Flow

Installation uses pip:

bash
pip install pocketflow

Alternatively, the README suggests copying the 100-line source file directly into a project, which avoids adding a package dependency entirely. The source is at pocketflow/__init__.py in the repository.

The setup.py shows the package is authored by Zachary Huang and hosted at https://github.com/The-Pocket/PocketFlow. The current version registered in setup.py is 0.0.3. The formal GitHub release is v0.0.0 from March 2025, so the pip package version and the GitHub release version may differ.

The documentation is at https://the-pocket.github.io/PocketFlow/ and a video tutorial is linked from the README. The cookbook directory in the repository contains worked examples at three difficulty tiers (labeled Dummy, Intermediate, and Advanced in the README) covering chat bots, structured output extraction, workflow pipelines, research agents, RAG, batch translation, streaming, and guardrails.

What the Cookbook Covers

The cookbook directory provides concrete starting points for the most common patterns. The chat example builds a bot that maintains conversation history. The structured output example extracts typed data from resumes by prompting the LLM. The workflow example implements a writing pipeline that outlines, writes, and applies styling in sequence. The RAG example builds a simple retrieval-augmented generation process. The batch example translates a markdown document into multiple languages in parallel.

More advanced examples cover chat guardrails, multi-agent systems, memory, parallel execution, a supervisor agent that manages worker agents, and an async workflow. The README also lists applications built on PocketFlow including a YouTube video summarizer, a podcast generator, a coding interviewer simulator, and a customer support agent.

PocketFlow has also been ported to TypeScript, Java, C++, Go, Rust, and PHP, each maintained in separate repositories under the The-Pocket organization. These are separate projects; the Python repository is the primary reference.

PocketFlow versus LangChain

The README's comparison table makes the LangChain contrast explicit. LangChain wraps every LLM provider, every vector store, and dozens of task-specific chains (question answering, summarization, and others) in a unified API surface. This breadth makes getting started fast when your use case matches one of the built-in patterns, but it also means pulling in 405,000 lines and 166 MB of code, and accepting LangChain's abstractions over every external service.

PocketFlow wraps none of those services. If you need to call OpenAI, you write the call yourself. If you need to query Pinecone, you write that query yourself. PocketFlow only manages how nodes connect and how state flows between them. The result is a library that installs in 56 KB and has no vendor lock-in, but requires more code per integration point.

For a developer exploring how agents work, or for a project with unusual external dependencies not covered by LangChain, PocketFlow's minimal surface is an advantage. For a developer who wants a working RAG pipeline against a standard vector store in an afternoon, LangChain's ready-made integrations will get there faster.

Limitations and What PocketFlow Does Not Include

PocketFlow provides no built-in retry logic, rate limiting, cost tracking, or observability beyond what the user writes into their own nodes. There is no configuration file, no CLI, and no server component. Every deployment concern is the developer's responsibility.

The zero-dependency claim applies to the 100-line core. Any node that calls an LLM, queries a database, or performs a web search will introduce dependencies, but those belong to the user's code rather than to PocketFlow itself.

The only formal release is v0.0.0 from March 2025. The pip package version in setup.py is 0.0.3. The README has no stability or API guarantee documentation. The last push to the repository was on 2026-07-26, which is about 63 days before 2026-09-28. This is within six months, but the release cadence suggests the project is stable and slow-moving rather than actively releasing new versions.

License and Maintenance

PocketFlow is licensed under MIT. The project is maintained by Zachary Huang at Columbia University (email [email protected] in setup.py). The homepage is https://the-pocket.github.io/PocketFlow/.

The repository structure includes pocketflow/ (the core), cookbook/ (examples), docs/ (documentation source), tests/, and utils/. A .cursorrules file and .cursor/ directory indicate that Cursor AI is a supported development environment, which aligns with the README's emphasis on Agentic Coding as a workflow for building with PocketFlow.

The project's small footprint means that the MIT license is genuinely permissive: the entire framework can be incorporated into a commercial product by copying a single 100-line file, with no dependency chain to audit.

Editorial conclusion

PocketFlow is the right tool for a developer who wants to understand the mechanics of an LLM framework without learning a large codebase, or who is prototyping an agent and wants to avoid dependency overhead. It is not appropriate for production deployments that require built-in integration with specific vector stores, cloud providers, or authentication systems, since PocketFlow provides none of those. Before choosing it for a long-lived project, check whether the cookbook covers your use case and evaluate the maintenance pace: the last push was on 2026-07-26 and the only formal release is v0.0.0 from March 2025.

Frequently asked questions

What is PocketFlow?

PocketFlow is a Python LLM framework with a 100-line core and no dependencies. It models LLM workflows as graphs of connected nodes and supports agents, RAG, batch processing, multi-agent systems, and streaming.

How does PocketFlow compare to LangChain?

PocketFlow has 100 lines and installs in 56 KB with no dependencies. LangChain has 405,000 lines and installs at over 166 MB with many built-in vendor integrations. PocketFlow provides only graph routing; every LLM call and external integration is written by the developer.

How does PocketFlow compare to LangGraph?

Both use a graph abstraction for LLM workflows. LangGraph has 37,000 lines and installs at 51 MB with integrations for PostgresStore, SqliteSaver, and Semantic Search. PocketFlow has 100 lines and 56 KB with no built-in integrations.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. The-Pocket/PocketFlow on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/the-pocket-pocketflow.svg)](https://hysenlabs.com/projects/the-pocket-pocketflow)