欣淇
发布于 2026-05-13 / 0 阅读
0
0

🤖 Pi:48.5k Stars 的终端编码 Agent 工具包

🤖 Pi:48.5k Stars 的终端编码 Agent 工具包,curl -fsSL https://pi.dev/install.sh | sh 一键装好

[//]: # (Writing style reference: The Halo blog uses emoji + project name + core selling point with data. Conversational tone. No "现象级""明星项目""潜力股". Real commands from README in code blocks. 300-800 words, bilingual.)


🤖 Pi:48.5k Stars 的终端编码 Agent 工具包,curl -fsSL https://pi.dev/install.sh | sh 一键装好

pi 是一个由 earendil-works 开源的全栈 AI Agent 工具包,48.5k Stars。它不只一个 CLI——是一个 monorepo,里面包含了 coding agent 运行时、统一 LLM API 层、TUI 库、Web UI 组件,甚至还有 Slack bot 集成。核心哲学:你去适应工具,还是让工具适应你?Pi 选择后者。

安装只有一行:

curl -fsSL https://pi.dev/install.sh | sh
# 或者 npm
npm install -g @earendil-works/pi-coding-agent

配好 API Key 就能跑:

export ANTHROPIC_API_KEY=sk-ant-***
pi

四合一架构

Pi 不是单一项目,而是四个包一起工作:

| 包 | 作用 |

|---|---|

| pi-coding-agent | 交互式编码 Agent CLI,自带 read/write/edit/bash 四个工具 |

| pi-agent-core | Agent 运行时,工具调用 + 状态管理 |

| pi-ai | 统一 LLM API 层,支持 Anthropic、OpenAI、Google、DeepSeek、Mistral、Groq 等 20+ 厂商 |

| pi-tui | 差分渲染终端 UI 库 |

| pi-web-ui | AI 聊天界面的 Web Component |

不是另一个 Claude Code 克隆

Pi 跟 Claude Code、Codex 最大的不同是可扩展性。它原生支持三样东西:

  • Extensions — TypeScript 模块,可以注册自定义工具、命令、快捷键、事件处理器,甚至替换整个编辑器 UI
  • 2. Skills — 遵循 Agent Skills 标准的能力包,/skill:name 调用

    3. Prompt Templates — Markdown 模板,/templatename 展开

    // 一个简单的 extension 示例
    export default function (pi: ExtensionAPI) {
      pi.registerTool({ name: "deploy", ... });
      pi.registerCommand("stats", { ... });
      pi.on("tool_call", async (event, ctx) => { ... });
    }
    

    会话管理是亮点

    Pi 的 session 是 JSONL 树形结构——支持就地分支(/tree)、分叉(/fork)、克隆(/clone)。一个文件保存所有历史:

    pi -c              # 继续最近的 session
    pi -r              # 浏览历史 session
    pi --no-session    # 临时模式,不保存
    pi --fork <path>   # 从某个点分叉出新 session
    

    消息队列机制

    你在 Agent 干活的时候可以排队消息。Enter 是 steering 消息(当前工具调用执行完后送达),Alt+Enter 是 follow-up(全部完成后再送达)。不再傻等。

    支持的模型厂商

    Anthropic、OpenAI(Codex)、Google、DeepSeek、Mistral、Groq、Cerebras、xAI、OpenRouter、Hugging Face、Amazon Bedrock、Cloudflare Workers、Kimi、小米……20+ 家。所有 tool-calling 模型列表随每次 release 更新。

    通过 ~/.pi/agent/settings.json 全局配置,.pi/settings.json 项目级覆盖。还有 AGENTS.md 作为上下文文件自动加载。

    谁在用?

    OpenClaw 项目已经集成了 Pi 的 SDK 作为底层 Agent 运行时。证明这东西不是玩具。

    项目地址:https://github.com/earendil-works/pi

    官网:https://pi.dev


    🤖 Pi: 48.5k Stars Terminal Coding Agent Toolkit — curl -fsSL https://pi.dev/install.sh | sh to Get Started

    pi is a full-stack AI agent toolkit from earendil-works, sitting at 48.5k stars. More than a CLI, it's a monorepo packing a coding agent runtime, unified LLM API layer, TUI library, web UI components, and a Slack bot. Core philosophy: adapt pi to your workflow, not the other way around.

    Install in one line:

    curl -fsSL https://pi.dev/install.sh | sh
    # or via npm
    npm install -g @earendil-works/pi-coding-agent
    

    Configure and run:

    export ANTHROPIC_API_KEY=sk-ant-***
    pi
    

    Four packages, one harness:

    | Package | What it does |

    |---|---|

    | pi-coding-agent | Interactive coding agent CLI with read/write/edit/bash tools |

    | pi-agent-core | Agent runtime with tool calling and state management |

    | pi-ai | Unified LLM API supporting 20+ providers |

    | pi-tui | Differential rendering TUI library |

    Extensibility first. Pi supports TypeScript extensions (custom tools, UI, events), Agent Skills, and prompt templates — all sharable via pi install npm:@foo/pi-package or git.

    Session management is tree-structured with in-place branching (/tree), forking (/fork), and cloning (/clone). A message queue lets you queue steering or follow-up messages while the agent is working.

    OpenClaw already integrated Pi's SDK as its underlying agent runtime — proof this isn't a toy.

    Project: https://github.com/earendil-works/pi

    Site: https://pi.dev


    评论