fp-agent — FP 的安装入口与命令行
FP 是一个基于生命周期钩子的插件化 AI Agent 框架 —— 灵感来自《Rain World》的迭代器「五块卵石」。
fp-agent 是 FP 的唯一命令入口:本身不含引擎,只解析顶层参数、做首跑配置门禁,再把控制权交给对应前端(fp-terminal / fp-webui / fp-acp)。
安装
要求 Python ≥ 3.11。
pip install fp-agent # 基础:自动拉取 fp-core(引擎)+ fp-terminal(终端 REPL)
pip install "fp-agent[webui]" # + Web 界面(fp-webui)
pip install "fp-agent[acp]" # + ACP 协议(fp-acp)
pip install "fp-agent[all]" # 全部
Windows 上必须安装 Git for Windows(安装时勾选 Git Bash)。FP 强制使用 Git Bash:找不到时不会降级到 cmd.exe,而是报错并给出安装指引;也可用配置项 BASH_PATH 显式指定 bash.exe 路径。
快速开始
fp # 交互式终端 REPL(默认 cli 模式)
fp -m "你好" # 单次消息,答完即退
fp --mode webui # 浏览器界面,默认 http://127.0.0.1:8765
fp --mode acp # ACP 服务,走 stdio(无端口)
首跑配置门禁(先于任何前端启动):
- 交互终端缺配置 → 进入向导,依次询问 API 基础地址 → 模型名称 → API 密钥(三项均必填,向导不给任何示例或默认值);写盘后本次启动立即生效,无需重启。
- 非交互场景(管道、
--headless、-m、无 tty 的webui、acp、subagent 子进程)→ 不阻塞,打印含配置文件绝对路径的指引并以退出码 1 退出。 acp一律不进向导(其 stdin 是 IDE 的 JSON-RPC 协议流);--version/--update跳过门禁。
命令行
顶层参数(由 fp/main.py 注册,其余参数原样透传给前端):
| 参数 | 说明 |
|---|---|
--mode, -m |
启动模式,取值 cli(默认)/ webui / acp |
--model |
覆盖本次激活模型:provider/model,或 LLM_PROVIDERS 表内裸模型名;未命中则回退配置激活项并告警 |
--session SID |
恢复指定会话(cli 等价 -r SID;webui/acp 经 FP_RELOAD_SID 同样生效) |
--docs |
查看离线文档(等价 fp docs) |
--version |
打印版本号(fp <fp-core 版本>)并退出 |
--update, -u |
检查并升级本地已安装的 fp 组件(缺失的包不强装,单包失败不阻塞其余) |
子命令(在顶层解析前路由,参数互不干扰):
fp docs [路径 | --list | --path | --open]—— 离线文档(见下节)fp ext <子命令>—— 扩展资产分发:工具 / 命令 / 插件(详见fp ext -h)
透传给前端的参数:
| 模式 | 参数 |
|---|---|
cli |
-m/--message MSG 单次消息;-r/--resume [SID] 恢复会话;--headless 无头驻留 |
webui |
--host(默认 127.0.0.1)、--port(默认 8765)、--expose(监听 0.0.0.0)、--reload(热重载) |
acp |
无参数;JSON-RPC 2.0 走 stdio,不监听端口 |
-m是双义短选项:取值命中cli|webui|acp时视为--mode,否则视为--message。
配置
配置文件 ~/.config/fp/config.json(Windows:%APPDATA%\fp\config.json);运行期数据(会话 / 记忆 / 日志)在 ~/.local/share/fp/。
{
"LLM_API_KEY": "sk-...",
"LLM_API_BASE_URL": "https://api.deepseek.com/v1",
"LLM_MODEL": "deepseek-chat"
}
上述三键均必填——FP 不含任何内置连接默认值。可选键:TEMPERATURE、MAX_TOKENS、TIMEOUT、RETRY_COUNT、MAX_ITERATIONS、MAX_CONTEXT_TOKENS、ACTIVE_LLM、LLM_PROVIDERS(供应商 / 模型两级表)、BASH_PATH。
优先级:配置文件显式值 > 环境变量 > 内置默认(环境变量与键同名)。完整字段与校验规则见 配置指南。
随包离线文档
发布时仓库 docs/ 会被注入 site-packages/fp/docs/,随 wheel 分发,装完即可离线查阅:
fp docs # 用法与文档目录(等价 fp --docs)
fp docs --list # 文档目录树
fp docs --path # 仅打印文档目录绝对路径
fp docs self/README.md # 直接打印某篇(纯文本走 stdout)
fp docs --open # 用系统默认程序打开目录(人类交互用)
默认绝不自动调用 GUI:输出纯文本、不阻塞,供 agent 自举时读取。
文档
| 文档 | 内容 |
|---|---|
| 快速开始 | 安装、首配、内置系统全貌 |
| CLI 入门 | 终端 REPL 操作与按键 |
| 命令参考 | 16 个斜杠命令速查 |
| WebUI 手册 | 浏览器界面使用 |
| 配置指南 | config.json 全字段与优先级 |
| 插件系统 | 生命周期钩子与插件开发 |
| 工具概览 | 内置工具一览 |
| 引擎 | Agent 主循环与钩子挂载点 |
| 架构设计 | 分层与数据流 |
| 自举索引 | 能力边界 + 查找地图 |
上表为仓库内相对路径;PyPI 不解析相对链接,请对照 GitHub 文档目录 阅读。
依赖
| 包 | 版本 | 角色 |
|---|---|---|
fp-core |
>= 0.2.0 |
Agent 核心引擎(必装) |
fp-terminal |
>= 0.2.0 |
终端 REPL(必装) |
fp-webui |
>= 0.2.0 |
Web 界面(extra webui) |
fp-acp |
>= 0.2.0 |
ACP 协议(extra acp) |
| Python | >= 3.11 |
运行时 |
License
MIT © zpb —— 见 LICENSE。
Metadata
Release files for fp-agent 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fp_agent-0.2.3.tar.gz | 461.1 kB | With provenance | Details for fp_agent-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fp_agent-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for fp_agent-0.2.3-py3-none-any.whl |
Total release size: 951.4 kB
Release files / fp_agent-0.2.3.tar.gz
| Download URL | fp_agent-0.2.3.tar.gz |
|---|---|
| Size | 461.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
239cbe15219caf76398ae6a905f5fe2612c9fddb728d32ae709e3dcdad34ab79
|
|
BLAKE2b-256 checksum How to use checksums |
dc6c33272e67ed8910b120f6b6c80a61870254a2ee887827ccabd0368899e2bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / fp_agent-0.2.3-py3-none-any.whl
| Download URL | fp_agent-0.2.3-py3-none-any.whl |
|---|---|
| Size | 490.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1d5246ac575539794cc23caac45bdce0d8d486ff467f92b83ab28c7086b6a6e
|
|
BLAKE2b-256 checksum How to use checksums |
e84031793c33e8b92deb01d018c1512d28f652d401fa9fb251854187a1d10522
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for fp-agent 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for fp_agent-0.2.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.