Pai — AI skill for Claude Code
用 Python 从零搭建一个完整的 AI 编程助手系统:统一 LLM 调用 + Agent 编排内核 + 飞书 IM 桥接.
How to install Pai
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open wutongyuonce/Pai and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Pai does
用 Python 从零搭建一个完整的 AI 编程助手系统:统一 LLM 调用 + Agent 编排内核 + 飞书 IM 桥接.
Alternatives in AI
- AGENTS.md - Skill Seekers — Concise reference for AI coding agents 11.1k ★
- Azure OpenAI Python — Azure OpenAI with GPT-4 for Python 1.8k ★
- Loushang — AI-native agent harness for coding workflows by python: multi-model LLM orchestration, stateful sessions, tool 1.3k ★
README
Pai
统一 LLM 调用 + Agent 编排内核 + 飞书 IM 桥接 —— 用 Python 从零搭建一个完整的 AI 编程助手系统。
**Pai 就是 AI 世界的"万能外卖中台"。**
- 不同的 AI 厂商(Anthropic Claude、OpenAI GPT、智谱 GLM 等)就像不同的餐厅
- 统一 LLM 接口层就是那个中台,帮你屏蔽各家 API 的差异
- Agent 编排内核就是"外卖骑手调度系统"——接到你的需求后,它会自动规划路线(调用工具、读写文件、执行命令),一步一步帮你完成任务
- 飞书 IM 桥接就是"外卖 App 的聊天客服"——你在飞书群里 @它说一句话,它就像客服一样实时回复你,还能记住之前聊过什么
学完这个项目,你能收获什么?
如果你是一个刚学完 Python 基础语法的小白,通过阅读和理解这个项目,你能获得以下实战能力:
| 能力 | 具体内容 |
|---|---|
| Python 异步编程 | async/await、asyncio 事件循环、并发任务管理 |
| 流式数据处理 | SSE(Server-Sent Events)协议解析、异步迭代器 |
| HTTP 客户端开发 | 使用 httpx 发起流式请求、处理各种 API 认证 |
| 设计模式实战 | 注册表模式、工厂模式、观察者/发布订阅模式、适配器模式 |
| Agent 系统架构 | 理解"模型调用 → 工具执行 → 再次推理"的经典 Agent Loop |
| 会话与持久化 | JSONL 格式存储、会话树结构(支持分叉/切换) |
| 插件/扩展系统 | 动态加载扩展、Skill 系统、MCP 工具代理 |
| IM 机器人开发 | 飞书 Webhook/长连接、消息去重、频道级会话管理 |
技术栈拆解
| 技术 | 为什么用它? |
|---|---|
| Python 3.10+ | 项目主语言,用到了 match、Union 类型标注、dataclass 等现代特性 |
| asyncio | Python 内置的异步框架,让程序能同时处理多个 LLM 请求而不阻塞 |
| httpx | 比 requests 更现代的 HTTP 客户端,原生支持异步和流式响应 |
| dataclass | Python 的数据类装饰器,用来定义清晰的消息、模型、事件等数据结构 |
| setuptools | Python 标准打包工具,让项目可以通过 pip install -e . 安装为可执行命令 |
| lark-oapi(可选) | 飞书官方 SDK,用于对接飞书 IM 消息收发 |
| pytest(开发依赖) | Python 最流行的测试框架,项目里有完整的单元测试覆盖 |
快速开始
1. 环境准备
# 确保 Python 版本 >= 3.10
python --version
# 克隆项目后进入目录
cd XingClaw
2. 配置环境变量
# 复制环境变量模板
cp .env.example .env # Linux/macOS
copy .env.ps1.example .env.ps1 # Windows PowerShell
打开复制的文件,填入你的 API Key:
# 至少需要一个 LLM 的 API Key
ANTHROPIC_API_KEY=sk-ant-你的密钥
# 或者
OPENAI_API_KEY=sk-你的密钥
3. 安装并运行
# 以开发模式安装(推荐)
pip install -e ".[dev]"
# 方式一:CLI 交互模式(最简单的上手方式)
python -m coding_agent --mode interactive --provider anthropic --model-id claude-sonnet-4-5
# 方式二:运行最小示例脚本
python examples/quickstart.py
**Windows 用户**可以直接用开发脚本:
# CLI 模式
.\dev.ps1 -Mode cli
# IM 模式(需要先配置飞书凭据)
.\dev.ps1 -Mode im
4. 运行测试
pytest tes
Related Skills
PAI FileShare Skill
This skill lets you send yourself files by letting your AI (Claude Code, PAI, etc) put it in your local Nextcl
CoreCoder
Minimal AI coding agent (~1,400 LoC Python) inspired by Claude Code. Works with any LLM. Think NanoGPT for cod
TurboLLM
Run any local LLM engine, auto-tuned to your GPU — polished web UI + OpenAI/Anthropic-compatible API. Point Cl
Datafog Python
Offline PII firewall for AI agents and LLM apps: fast local detection and redaction, Claude Code hook, LiteLLM
DuDuClaw
Open-source AI Agent platform — 80+ MCP tools, 7 channels (Slack/Discord/LINE/Telegram), Rust + Python. Self-h
AnyCoder
AI coding agent in your terminal. Works with any LLM - DeepSeek, Qwen, GPT-5, Claude, Gemini, Kimi, Ollama. 10
Related Agents
Prompt Reviewer Code
Locates LLM call sites in any codebase (Go, Python, TypeScript, anything), reconstructs the resolved prompt fr
Dlc Inspector
巡检阿里云 PAI-DLC 上全组 Running 训练任务的健康度——用 dlc skill 列任务并取每个任务最后节点的日志,逐个研判(是否还在前进 / HANG 挂起),把发现整理成分级纯文本报告并用 hiboar
Algorithm
Expert in creating and evolving Ideal State Criteria (ISC) as part of the PAI Algorithm's core principles. Spe