# PocketFlow

> A 100-line minimalist LLM framework with zero dependencies

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: Python
- Licence: MIT
- Repository: https://github.com/The-Pocket/PocketFlow
- Website: https://the-pocket.github.io/PocketFlow/
- Canonical page: https://ai-tldr.dev/tools/pocketflow/

## In short

PocketFlow is a deliberately tiny LLM framework written in about 100 lines of Python. It ships with zero extra dependencies and no vendor-specific wrappers, so there is no bloat and no lock-in to a single model provider. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in Python and licensed MIT.

## Overview

PocketFlow is a deliberately tiny LLM framework written in about 100 lines of Python. It ships with zero extra dependencies and no vendor-specific wrappers, so there is no bloat and no lock-in to a single model provider.

The whole framework is built around one idea: a graph. Nodes do the work and connect to each other, and from that single abstraction you can express common patterns like agents, workflows, and retrieval-augmented generation (RAG).

Because the core is so small, the project leans into "agentic coding" — using AI assistants such as Cursor to help you build your own agents on top of the framework. There are also community ports for TypeScript, Java, C++, Go, Rust, and PHP.

## What it does

- Tiny core: the entire framework is roughly 100 lines of Python with zero dependencies and zero vendor wrappers
- Graph-based design that lets you compose nodes into flows for any LLM application
- Supports popular patterns out of the box: agents, multi-agents, workflows, and RAG
- Model-agnostic — you wire in whichever LLM and tools you want, with no built-in lock-in
- Large cookbook of runnable examples, from a basic chat bot to map-reduce, text-to-SQL, MCP, and voice chat
- Ports available in TypeScript, Java, C++, Go, Rust, and PHP

## Getting started

PocketFlow is published on PyPI. You can install it with pip, or simply copy the 100-line source file straight into your project.

1. Install PocketFlow

   Add the package to your Python environment with pip. Alternatively, you can copy the single 100-line source file from the repository instead of installing anything.

```bash
pip install pocketflow
```

2. Learn the patterns from the cookbook

   The repository includes a cookbook of small, runnable examples covering chat, structured output, workflows, agents, and RAG. Browsing these is the fastest way to see how nodes and flows fit together before building your own.

## When to use it

- Building LLM agents and multi-agent systems without pulling in a heavy framework
- Prototyping workflows and RAG pipelines using a small, easy-to-read core you can fully understand
- Teaching or learning how LLM frameworks work by reading the entire 100-line graph abstraction
- Using AI coding assistants to scaffold custom agents on top of a minimal, dependency-free base
