Skip to content

Instantly share code, notes, and snippets.

View ziyoung's full-sized avatar
🤒
I may be slow to respond.

hetech ziyoung

🤒
I may be slow to respond.
  • 上海浦东
View GitHub Profile
@ziyoung
ziyoung / pi_tutorial.md
Last active July 29, 2026 10:37 — forked from dabit3/pi_tutorial.md
How to Build a Custom Agent Framework with PI: The Agent Stack Powering OpenClaw

Pi 教程(基于 DeepSeek)

Pi 是一套用 TypeScript 构建 AI Agent 的工具包。各包分层叠用:

  • pi-ai:跨厂商 LLM 通信(Models 集合、流式、工具定义、用量与费用)
  • pi-agent-core:在 pi-ai 之上加 Agent 循环(调模型 → 执行工具 → 回填 → 重复)
  • pi-coding-agent:完整编码 Agent 运行时(内置文件工具、JSONL 会话、压缩、扩展)
  • pi-tui:终端 UI(差分渲染、Markdown、多行编辑器、自动补全)

本教程按层递进。理解如何组合这些层之后,你可以按自己的产品边界组装 Agent,而不被某一层抽象锁死。