AI Skill Hub 强烈推荐:PocketFlow-Tutorial-Codebase-Knowledge Agent工作流 是一款优质的Agent工作流。在 GitHub 上收获超过 12.3k 颗 Star,AI 综合评分 8.2 分,在同类工具中表现稳健。如果你正在寻找可靠的Agent工作流解决方案,这是一个值得深入了解的选择。
PocketFlow-Tutorial-Codebase-Knowledge Agent工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
PocketFlow-Tutorial-Codebase-Knowledge Agent工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
# 方式一:pip 安装(推荐)
pip install pocketflow-tutorial-codebase-knowledge
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install pocketflow-tutorial-codebase-knowledge
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge
cd PocketFlow-Tutorial-Codebase-Knowledge
pip install -e .
# 验证安装
python -c "import pocketflow_tutorial_codebase_knowledge; print('安装成功')"
# 命令行使用
pocketflow-tutorial-codebase-knowledge --help
# 基本用法
pocketflow-tutorial-codebase-knowledge input_file -o output_file
# Python 代码中调用
import pocketflow_tutorial_codebase_knowledge
# 示例
result = pocketflow_tutorial_codebase_knowledge.process("input")
print(result)
# pocketflow-tutorial-codebase-knowledge 配置文件示例(config.yml) app: name: "pocketflow-tutorial-codebase-knowledge" debug: false log_level: "INFO" # 运行时指定配置文件 pocketflow-tutorial-codebase-knowledge --config config.yml # 或通过环境变量配置 export POCKETFLOW_TUTORIAL_CODEBASE_KNOWLEDGE_API_KEY="your-key" export POCKETFLOW_TUTORIAL_CODEBASE_KNOWLEDGE_OUTPUT_DIR="./output"
<a href="https://discord.gg/hUHHE9Sa6T"> <img src="https://img.shields.io/discord/1346833819172601907?logo=discord&style=flat"> </a> > Ever stared at a new codebase written by others feeling completely lost? This tutorial shows you how to build an AI agent that analyzes GitHub repositories and creates beginner-friendly tutorials explaining exactly how the code works.
<p align="center"> <img src="./assets/banner.png" width="800" /> </p>
This is a tutorial project of Pocket Flow, a 100-line LLM framework. It crawls GitHub repositories and builds a knowledge base from the code. It analyzes entire codebases to identify core abstractions and how they interact, and transforms complex code into beginner-friendly tutorials with clear visualizations.
🔸 🎉 Reached Hacker News Front Page (April 2025) with >900 up‑votes: Discussion »
🔸 🎊 Online Service Now Live! (May 2025) Try our new online version at https://code2tutorial.com/ – just paste a GitHub link, no installation needed!
1. Clone this repository
git clone https://github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge
3. Install dependencies:
pip install -r requirements.txt
4. Set up LLM in utils/call_llm.py by providing credentials. To do so, you can put the values in a .env file. By default, you can use the AI Studio key with this client for Gemini Pro 2.5 by setting the GEMINI_API_KEY environment variable. If you want to use another LLM, you can set the LLM_PROVIDER environment variable (e.g. XAI), and then set the model, url, and API key (e.g. XAI_MODEL, XAI_URL,XAI_API_KEY). If using Ollama, the url is http://localhost:11434/ and the API key can be omitted. You can use your own models. We highly recommend the latest models with thinking capabilities (Claude 3.7 with thinking, O1). You can verify that it is correctly set up by running:
python utils/call_llm.py
5. Generate a complete codebase tutorial by running the main script:
# Analyze a GitHub repository
python main.py --repo https://github.com/username/repo --include "*.py" "*.js" --exclude "tests/*" --max-size 50000
# Or, analyze a local directory
python main.py --dir /path/to/your/codebase --include "*.py" --exclude "*test*"
# Or, generate a tutorial in Chinese
python main.py --repo https://github.com/username/repo --language "Chinese"
--repo or --dir - Specify either a GitHub repo URL or a local directory path (required, mutually exclusive)-n, --name - Project name (optional, derived from URL/directory if omitted)-t, --token - GitHub token (or set GITHUB_TOKEN environment variable)-o, --output - Output directory (default: ./output)-i, --include - Files to include (e.g., "*.py" "*.js")-e, --exclude - Files to exclude (e.g., "tests/*" "docs/*")-s, --max-size - Maximum file size in bytes (default: 100KB)--language - Language for the generated tutorial (default: "english")--max-abstractions - Maximum number of abstractions to identify (default: 10)--no-cache - Disable LLM response caching (default: caching enabled)The application will crawl the repository, analyze the codebase structure, generate tutorial content in the specified language, and save the output in the specified directory (default: ./output).
<details> <summary> 🐳 <b>Running with Docker</b> </summary>
To run this project in a Docker container, you'll need to pass your API keys as environment variables.
1. Build the Docker image
docker build -t pocketflow-app .
You'll need to provide your GEMINI_API_KEY for the LLM to function. If you're analyzing private GitHub repositories or want to avoid rate limits, also provide your GITHUB_TOKEN. Mount a local directory to /app/output inside the container to access the generated tutorials on your host machine. Example for analyzing a public GitHub repository:
docker run -it --rm \
-e GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE" \
-v "$(pwd)/output_tutorials":/app/output \
pocketflow-app --repo https://github.com/username/repo
Example for analyzing a local directory: docker run -it --rm \
-e GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE" \
-v "/path/to/your/local_codebase":/app/code_to_analyze \
-v "$(pwd)/output_tutorials":/app/output \
pocketflow-app --dir /app/code_to_analyze
</details>
<p align="center"> <img src="./assets/example.png" width="600" /> </p>
🤯 All these tutorials are generated entirely by AI by crawling the GitHub repo!
<br> <div align="center"> <a href="https://youtu.be/AFY67zOpbSo" target="_blank"> <img src="./assets/youtube_thumbnail.png" width="500" alt="Pocket Flow Codebase Tutorial" style="cursor: pointer;"> </a> </div> <br>
创新型工作流工具,将AI能力应用于代码文档化领域。12.3k Stars体现高关注度,适合寻求自动化文档生成方案的开发团队。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
总体来看,PocketFlow-Tutorial-Codebase-Knowledge Agent工作流 是一款质量优秀的Agent工作流,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | PocketFlow-Tutorial-Codebase-Knowledge |
| 原始描述 | 开源AI工作流:Pocket Flow: Codebase to Tutorial。⭐12.3k · Python |
| Topics | 代码转文档AI工作流LLM应用Agent系统自动化工具 |
| GitHub | https://github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge |
| License | MIT |
| 语言 | Python |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端