Hermes Agent: 插件
最后更新:2026-08-31
插件是 Hermes Agent 的扩展接口——内置功能不够?装个插件就行。想接入 Jira、Notion、Figma?都有现成插件。
💡 提示:插件是比自定义工具更高层的扩展方式。一个插件可以包含多个工具、技能、甚至完整的子系统。Hermes 插件市场有丰富的社区插件。
📋 前置知识:第8课 工具与工具集
1. 你将学到
| 编号 | 内容 |
|---|---|
| ❶ | 插件系统架构 |
| ❷ | 插件安装与管理 |
| ❸ | 常用插件介绍 |
| ❹ | 开发自定义插件 |
| ❺ | 插件安全与权限 |
2. 故事
(1) 痛点:内置工具不够用
Bob 需要连接 Jira 查工单、用 Notion 记笔记、在 Figma 看设计稿。内置工具没有这些集成。
(2) 解法:安装插件,一键扩展
BASH
# 安装 Jira 插件
hermes plugin install hermes-plugin-jira
# 安装 Notion 插件
hermes plugin install hermes-plugin-notion
# 现在可以直接对话
me: 查一下 PROJ-123 的状态
Agent: [Jira Plugin] PROJ-123: In Progress, 优先级 High
3. 插件系统架构
(1) 插件结构
hermes-plugin-jira/
├── manifest.yaml # 插件清单
├── tools/ # 插件提供的工具
│ ├── jira_search.py
│ ├── jira_create.py
│ └── jira_update.py
├── skills/ # 插件提供的技能
│ └── sprint-review.yaml
├── templates/ # 输出模板
└── config.yaml # 插件配置
(2) 插件清单
YAML
# manifest.yaml
name: "hermes-plugin-jira"
version: "1.2.0"
description: "Jira integration for Hermes Agent"
author: "community"
license: "MIT"
dependencies:
hermes_version: ">=1.0.0"
python_packages:
- "jira>=3.5.0"
tools:
- name: "jira_search"
description: "Search Jira issues"
category: "communication"
- name: "jira_create"
description: "Create Jira issue"
category: "communication"
- name: "jira_update"
description: "Update Jira issue"
category: "communication"
skills:
- name: "sprint-review"
description: "Generate sprint review report"
permissions:
- network: ["*.atlassian.net"]
- filesystem: []
- env_vars: ["JIRA_URL", "JIRA_TOKEN"]
4. 插件安装与管理
(1) 安装插件
BASH
# 从插件市场安装
hermes plugin install hermes-plugin-jira
# 从 Git 仓库安装
hermes plugin install git+https://github.com/user/hermes-plugin-jira
# 从本地路径安装
hermes plugin install ./my-plugin
# 安装指定版本
hermes plugin install hermes-plugin-jira@1.2.0
(2) 管理命令
BASH
# 列出已安装插件
hermes plugin list
# 输出示例:
# ┌─────────────────────┬─────────┬──────────┬─────────┐
# │ Plugin │ Version │ Status │ Tools │
# ├─────────────────────┼─────────┼──────────┼─────────┤
# │ jira │ 1.2.0 │ ✅ Active│ 3 │
# │ notion │ 0.9.1 │ ✅ Active│ 4 │
# │ figma │ 0.5.0 │ ⏸️ Paused│ 2 │
# └─────────────────────┴─────────┴──────────┴─────────┘
# 更新插件
hermes plugin update jira
# 禁用插件(不卸载)
hermes plugin pause figma
# 启用插件
hermes plugin resume figma
# 卸载插件
hermes plugin uninstall figma
5. 常用插件
| 插件 | 功能 | 工具数 |
|---|---|---|
| jira | Jira 工单管理 | 3 |
| notion | Notion 页面/数据库操作 | 4 |
| figma | Figma 设计稿查看 | 2 |
| github | GitHub PR/Issue/Repo 操作 | 6 |
| gitlab | GitLab CI/CD 操作 | 5 |
| aws | AWS 服务操作 | 8 |
| docker | Docker 容器管理 | 4 |
| kubernetes | K8s 集群操作 | 6 |
| google-calendar | Google 日历 | 3 |
| slack-advanced | Slack 高级功能 | 5 |
| pandas | 数据分析增强 | 4 |
| database | 多数据库支持 | 5 |
(1) GitHub 插件示例
BASH
# 安装
hermes plugin install hermes-plugin-github
# 配置
hermes config set plugins.github.token "${GITHUB_TOKEN}"
hermes config set plugins.github.default_repo "myorg/myrepo"
# 使用
me: 列出待审查的 PR
Agent: [GitHub Plugin] 找到3个待审查PR:
- #42: Fix auth flow (alice, 2h ago)
- #43: Add rate limiting (bob, 5h ago)
- #44: Update dependencies (carol, 1d ago)
6. 开发自定义插件
(1) 最小插件
PYTHON
# my_plugin/tools/hello.py
from hermes import Tool, ToolResult
class HelloTool(Tool):
name = "hello"
description = "Say hello to someone"
category = "custom"
parameters = {
"name": {"type": "str", "required": True}
}
def execute(self, name: str) -> ToolResult:
return ToolResult(
success=True,
data={"message": f"Hello, {name}!"},
summary=f"Greeted {name}"
)
YAML
# my_plugin/manifest.yaml
name: "my-plugin"
version: "0.1.0"
description: "My custom plugin"
author: "me"
tools:
- name: "hello"
description: "Say hello"
category: "custom"
permissions:
- network: []
- filesystem: []
(2) 完整插件开发
PYTHON
# stock-plugin/tools/stock_query.py
from hermes import Tool, ToolResult
import httpx
class StockQueryTool(Tool):
name = "stock_query"
description = "Query stock price and metrics"
category = "finance"
parameters = {
"symbol": {
"type": "str",
"required": True,
"description": "Stock symbol (e.g., AAPL)"
},
"metric": {
"type": "str",
"required": False,
"default": "price",
"enum": ["price", "pe", "volume", "market_cap"]
}
}
def execute(self, symbol: str, metric: str = "price") -> ToolResult:
api_key = self.get_env("STOCK_API_KEY")
response = httpx.get(
f"https://api.stock.com/quote",
params={"symbol": symbol, "apikey": api_key}
)
data = response.json()
return ToolResult(
success=True,
data=data,
summary=f"{symbol} {metric}: {data.get(metric, 'N/A')}"
)
7. 插件安全与权限
(1) 权限模型
| 权限 | 说明 | 示例 |
|---|---|---|
network |
允许访问的域名 | ["*.atlassian.net"] |
filesystem |
允许访问的路径 | ["~/projects"] |
env_vars |
需要的环境变量 | ["JIRA_TOKEN"] |
tools |
可以调用的内置工具 | ["fs_read"] |
subprocess |
是否允许执行命令 | false |
(2) 安全审查
BASH
# 安装前审查插件权限
hermes plugin audit hermes-plugin-xxx
# 输出示例:
# ⚠️ 权限审查:
# - network: *.example.com ✅
# - filesystem: /tmp ⚠️ (建议限制范围)
# - subprocess: true ❌ (建议禁用或审查代码)
# - env_vars: API_KEY ✅
❓ 常见问题
Q 插件市场有多少插件?
A 社区维护 50+ 插件,覆盖项目管理、云服务、数据库、设计工具等。
Q 插件会影响性能吗?
A 已安装但未使用的插件零影响。只有被调用时才消耗资源。
Q 插件和自定义工具有什么区别?
A 插件是封装好的扩展包(工具+技能+配置+模板),自定义工具是单个工具。插件更完整、可分享。
Q 可以同时安装多个同类插件吗?
A 可以,但工具名可能冲突。建议只启用需要的那个。
Q 如何发布插件到市场?
A 遵循插件开发规范,提交 PR 到 hermes-plugins 仓库,通过审核后上架。
Q 插件更新会破坏现有配置吗?
A 遵循语义化版本,小版本更新向后兼容。大版本更新可能有破坏性变更,会提前提示。
📖 小节
- 插件 = 工具 + 技能 + 配置 + 模板的封装扩展包
- 安装方式:市场、Git、本地路径
- 50+ 社区插件覆盖 Jira/Notion/GitHub/AWS 等
- 自定义插件:Python Tool 类 + YAML manifest
- 权限模型控制网络、文件、环境变量、子进程访问
📝 作业
- 基础题(难度⭐):安装一个社区插件(如 GitHub),完成一次基本操作,验证功能正常。
- 进阶题(难度⭐⭐):开发一个简单的自定义插件(1-2 个工具),安装到 Hermes 中并测试。
- 挑战题(难度⭐⭐⭐):开发一个完整的插件(含工具、技能、配置),发布到团队共享,他人安装后开箱即用。