How neilblaze/pocketflow works
Project type and purpose
• This is a Python-based, minimalist LLM framework (Pocket Flow) packaged as a library plus an extensive “cookbook” of example applications.
• Purpose: provide a 100-line core Graph abstraction for composing LLM-powered flows (agents, workflows, RAG, map-reduce, etc.), accompanied by tutorials, tests, and documentation.
File structure
• Top level:
• pocketflow/ ← core library (100-line Graph abstraction)
• setup.py ← install entrypoint
• cookbook/ ← dozens of “demo” sub-projects, each with flow.py, main.py, nodes.py, utils.py, requirements.txt
• docs/ ← static documentation site (MkDocs / Jekyll)
• tests/ ← pytest suite exercising core flows, nodes, fallbacks
• README.md, LICENSE, .gitignore
• Patterns:
• Core Graph engine in pocketflow/__init__.py
• Example flows import pocketflow.* and define their own Flow, Node classes
• Utilities folder per demo for LLM calls, embeddings, vector indexes, PDF parsing, database tools, etc.
• docs/core_abstraction, docs/design_pattern, docs/utility_function show high-level patterns
• Tests import sample flows and assert behavior end-to-end
README for additional insights
• Emphasis on:
• Zero dependencies beyond Python stdlib
• Core abstraction = Graph
• Implements multi-agent, workflow, RAG, map-reduce, streaming, memory, supervisor, parallel patterns
• Links to images illustrating abstraction → a node graph that describes directed data flows