# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Hermes Agent
spec:
    description: |
        Hermes Agent by Nous Research — an autonomous AI agent with persistent memory, tool use, cron scheduling, and 20+ messaging platforms (Telegram, Discord, Slack, WhatsApp, Signal, Matrix, WeChat, WeCom, Feishu, DingTalk, Email, and more). Includes an OpenAI-compatible API server.
    coverImage: https://raw.githubusercontent.com/NousResearch/hermes-agent/main/assets/banner.png
    icon: https://raw.githubusercontent.com/NousResearch/hermes-agent/main/website/static/img/logo.png
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: Domain for accessing Hermes Agent API and Dashboard
        - key: OPENROUTER_API_KEY
          type: STRING
          name: OpenRouter API Key (optional)
          description: API key from openrouter.ai for quick start. You can also configure other providers (Anthropic, OpenAI, custom endpoints) after deployment via config.yaml.
        - key: TELEGRAM_BOT_TOKEN
          type: STRING
          name: Telegram Bot Token (optional)
          description: Bot token from @BotFather on Telegram. Leave empty to skip Telegram. You can add 20+ other platforms after deployment.
        - key: TELEGRAM_ALLOWED_USERS
          type: STRING
          name: Telegram Allowed Users
          description: Comma-separated Telegram user IDs (required if bot token is set). Get your ID from @userinfobot on Telegram.
        - key: HERMES_DASHBOARD
          type: STRING
          name: Enable Dashboard
          description: Set to "true" to enable the web dashboard on port 9119. Default is "false".
    tags:
        - AI
        - Agent
        - Chatbot
    readme: |
        # Hermes Agent

        [Hermes Agent](https://github.com/NousResearch/hermes-agent) is an autonomous AI agent built by [Nous Research](https://nousresearch.com/). It features persistent memory, 40+ built-in tools, cron scheduling, and multi-platform messaging support.

        For full documentation, see [hermes-agent.nousresearch.com](https://hermes-agent.nousresearch.com/docs).

        ## Quick Start

        1. **Bind domain to port 8642**: Go to Networking > Domain, bind your `*.zeabur.app` domain to port **8642**
        2. Connect your tool with **Base URL** `https://<your-domain>/v1` and **API Key** from the Instructions panel
        3. (Optional) Set `Enable Dashboard` to `true` when deploying, then bind another domain to port **9119`. Login with `admin` / the auto-generated password shown in Instructions.

        ## Ports & Domains

        This service exposes two independent ports. Bind a domain only to the ports you actually use:

        | Port | Purpose | When to bind a domain |
        |------|---------|----------------------|
        | **8642** | OpenAI-compatible API server | Required for external API access |
        | **9119** | Web Dashboard (requires `HERMES_DASHBOARD=true`) | Only if you want the browser UI |

        **Messaging platforms (Telegram, Discord, Slack, etc.) use outbound connections — they do not require any public URL or open port.**

        ## Persistent Storage

        All data is stored under `/opt/data` (persistent volume):

        | Path | Description |
        |---|---|
        | `/opt/data/config.yaml` | Main configuration file |
        | `/opt/data/.env` | API keys and secrets |
        | `/opt/data/sessions/` | Conversation history |
        | `/opt/data/memories/` | Persistent memory store |
        | `/opt/data/skills/` | Agent-created skills |
        | `/opt/data/logs/` | Runtime logs |

        ## Messaging Platforms

        **Telegram** is configured at deploy time as an example. You can add any of the 20+ supported platforms (Discord, Slack, WhatsApp, Signal, Matrix, Email, WeChat, WeCom, Feishu, DingTalk, QQ Bot, Mattermost, and more) by setting the corresponding environment variables after deployment.

        See the official [Messaging Gateway guide](https://hermes-agent.nousresearch.com/docs/user-guide/messaging) for setup instructions.

        ## CLI Access

        You can use the Hermes CLI directly via the Zeabur **Exec** tab:

        | Command | Description |
        |---------|-------------|
        | `hermes` | Interactive chat (REPL) |
        | `hermes --tui` | Modern terminal UI |
        | `hermes status` | Show status of all components |
        | `hermes config` | View or edit configuration |
        | `hermes skills` | Browse and install skills |

        ## Notes

        - The Docker image is ~4.5 GB (includes Playwright + Chromium for browser automation). First deployment may take several minutes.
        - First boot may take 30–60 seconds as the agent initializes config files and syncs skills.
        - Recommended: 2+ vCPU / 4+ GB RAM for browser tools.

        ## License

        Hermes Agent is licensed under the [MIT License](https://github.com/NousResearch/hermes-agent/blob/main/LICENSE).
    resourceRequirement:
        minConfig:
            cpu: 1
            ram: 2
        recommendedConfig:
            cpu: 4
            ram: 8
    services:
        - name: Hermes Agent
          icon: https://raw.githubusercontent.com/NousResearch/hermes-agent/main/website/static/img/logo.png
          template: PREBUILT_V2
          spec:
            id: hermes-agent
            source:
                image: nousresearch/hermes-agent:latest
                command:
                    - /bin/bash
                    - -c
                    - /opt/zeabur/startup.sh
                runAsUserID: 10000
            ports:
                - id: api
                  port: 8642
                  type: HTTP
                - id: dashboard
                  port: 9119
                  type: HTTP
            volumes:
                - id: data
                  dir: /opt/data
            instructions:
                - title: API Base URL
                  content: ${ZEABUR_WEB_URL}/v1
                - title: API Key
                  content: ${API_SERVER_KEY}
                - title: Dashboard URL
                  content: Enable HERMES_DASHBOARD=true in Variables, then bind a domain to port 9119. Login with admin / your PASSWORD.
                - title: Dashboard Password
                  content: ${PASSWORD}
            env:
                API_SERVER_ENABLED:
                    default: "true"
                API_SERVER_HOST:
                    default: 0.0.0.0
                API_SERVER_KEY:
                    default: ${PASSWORD}
                    expose: true
                API_SERVER_PORT:
                    default: "8642"
                HERMES_DASHBOARD:
                    default: ${HERMES_DASHBOARD}
                HERMES_DASHBOARD_BASIC_AUTH_PASSWORD:
                    default: ${PASSWORD}
                HERMES_DASHBOARD_BASIC_AUTH_USERNAME:
                    default: admin
                HERMES_DASHBOARD_HOST:
                    default: 0.0.0.0
                HERMES_DASHBOARD_PORT:
                    default: "9119"
                OPENROUTER_API_KEY:
                    default: ${OPENROUTER_API_KEY}
                    expose: true
                TELEGRAM_ALLOWED_USERS:
                    default: ${TELEGRAM_ALLOWED_USERS}
                TELEGRAM_BOT_TOKEN:
                    default: ${TELEGRAM_BOT_TOKEN}
            configs:
                - path: /opt/zeabur/startup.sh
                  template: |
                    #!/bin/bash
                    set -e
                    export HERMES_HOME="/opt/data"
                    export HERMES_SKIP_CONFIG_MIGRATION=1
                    source /opt/hermes/.venv/bin/activate
                    [ -f "$HERMES_HOME/.env" ] || touch "$HERMES_HOME/.env"
                    [ -f "$HERMES_HOME/config.yaml" ] || cp /opt/hermes/cli-config.yaml.example "$HERMES_HOME/config.yaml"
                    if [ "${HERMES_DASHBOARD:-}" = "true" ] || [ "${HERMES_DASHBOARD:-}" = "1" ]; then
                        hermes dashboard --host "${HERMES_DASHBOARD_HOST:-0.0.0.0}" --port "${HERMES_DASHBOARD_PORT:-9119}" --no-open &
                    fi
                    exec hermes gateway run
                  permission: 493
                  envsubst: false
localization:
    zh-CN:
        description: |
            Hermes Agent 由 Nous Research 开发 — 具备持久记忆、工具使用、定时任务及 20+ 消息平台（Telegram、Discord、Slack、WhatsApp、Signal、Matrix、微信、企业微信、飞书、钉钉、Email 等）的自主 AI 代理。内置 OpenAI 兼容 API 服务器。
        variables:
            - key: OPENROUTER_API_KEY
              type: STRING
              name: OpenRouter API 密钥（可选）
              description: 从 openrouter.ai 获取的 API 密钥，适合快速入门。部署后也可通过 config.yaml 配置其他供应商。
            - key: TELEGRAM_BOT_TOKEN
              type: STRING
              name: Telegram Bot Token（可选）
              description: 从 Telegram @BotFather 获取的 Bot Token。留空则跳过。部署后可添加 20+ 其他平台。
            - key: TELEGRAM_ALLOWED_USERS
              type: STRING
              name: Telegram 允许的用户
              description: 以逗号分隔的 Telegram 用户 ID（设置了 Bot Token 则为必填）。可通过 @userinfobot 获取 ID。
        readme: |
            # Hermes Agent

            [Hermes Agent](https://github.com/NousResearch/hermes-agent) 是由 [Nous Research](https://nousresearch.com/) 开发的自主 AI 代理，具备持久记忆、40 多种内置工具、定时任务及多平台消息集成。

            完整文档请见 [hermes-agent.nousresearch.com](https://hermes-agent.nousresearch.com/docs)。

            ## 快速开始

            1. **绑定域名至 port 8642**：前往 Networking > Domain，将 `*.zeabur.app` 绑定至端口 **8642**
            2. 使用 **Base URL** `https://<your-domain>/v1` 和说明面板中的 **API Key** 连接工具
            3. （可选）部署时将 `Enable Dashboard` 设为 `true`，再绑定另一个域名至端口 **9119**。用 `admin` / 说明面板中的密码登录

            ## 端口与域名

            此服务提供两个独立的 HTTP 端口，请只为实际需要的端口绑定域名：

            | 端口 | 用途 | 何时需要绑定域名 |
            |------|------|----------------|
            | **8642** | OpenAI 兼容 API 服务器 | 需要外部 API 访问时 |
            | **9119** | 网页 Dashboard（需设置 `HERMES_DASHBOARD=true`） | 仅在需要浏览器界面时 |

            **消息平台（Telegram、Discord、Slack 等）使用出站连接，不需要公开 URL 或开放任何端口。**

            ## 持久化存储

            所有数据存储在 `/opt/data`（持久化卷）：

            | 路径 | 说明 |
            |---|---|
            | `/opt/data/config.yaml` | 主配置文件 |
            | `/opt/data/.env` | API 密钥与密码 |
            | `/opt/data/sessions/` | 对话历史 |
            | `/opt/data/memories/` | 持久化记忆 |
            | `/opt/data/skills/` | Agent 创建的技能 |
            | `/opt/data/logs/` | 运行日志 |

            ## 消息平台

            部署时默认设置 **Telegram** 作为示例。您可以在部署后设置对应的环境变量，启用 20+ 支持平台中的任一个。

            详见官方 [Messaging Gateway 指南](https://hermes-agent.nousresearch.com/docs/user-guide/messaging)。

            ## CLI 操作

            通过 Zeabur **Exec** 标签页可直接使用 Hermes CLI：

            | 命令 | 说明 |
            |------|------|
            | `hermes` | 交互式聊天（REPL） |
            | `hermes --tui` | 现代终端 UI |
            | `hermes status` | 查看所有组件状态 |
            | `hermes config` | 查看或编辑配置 |
            | `hermes skills` | 浏览与安装技能 |

            ## 注意事项

            - Docker 镜像约 4.5 GB（含 Playwright + Chromium）。首次部署可能需要数分钟。
            - 首次启动需要 30-60 秒来初始化配置文件和同步技能。
            - 建议：2+ vCPU / 4+ GB RAM 以使用浏览器工具。
    zh-TW:
        description: |
            Hermes Agent 由 Nous Research 開發 — 具備持久記憶、工具使用、排程任務及 20+ 訊息平台（Telegram、Discord、Slack、WhatsApp、Signal、Matrix、微信、企業微信、飛書、釘釘、Email 等）的自主 AI 代理。內建 OpenAI 相容 API 伺服器。
        variables:
            - key: OPENROUTER_API_KEY
              type: STRING
              name: OpenRouter API 金鑰（選填）
              description: 從 openrouter.ai 取得的 API 金鑰，適合快速入門。部署後也可透過 config.yaml 設定其他供應商。
            - key: TELEGRAM_BOT_TOKEN
              type: STRING
              name: Telegram Bot Token（選填）
              description: 從 Telegram @BotFather 取得的 Bot Token。留空則跳過。部署後可新增 20+ 其他平台。
            - key: TELEGRAM_ALLOWED_USERS
              type: STRING
              name: Telegram 允許的使用者
              description: 以逗號分隔的 Telegram 使用者 ID（設定了 Bot Token 則為必填）。可透過 @userinfobot 取得 ID。
        readme: |
            # Hermes Agent

            [Hermes Agent](https://github.com/NousResearch/hermes-agent) 是由 [Nous Research](https://nousresearch.com/) 開發的自主 AI 代理，具備持久記憶、40 多種內建工具、排程任務及多平台訊息整合。

            完整文件請見 [hermes-agent.nousresearch.com](https://hermes-agent.nousresearch.com/docs)。

            ## 快速開始

            1. **綁定網域至 port 8642**：前往 Networking > Domain，將 `*.zeabur.app` 綁定至連接埠 **8642**
            2. 使用 **Base URL** `https://<your-domain>/v1` 和指示面板中的 **API Key** 連接工具
            3. （選填）部署時將 `Enable Dashboard` 設為 `true`，再綁定另一個網域至 port **9119**。用 `admin` / 指示面板中的密碼登入

            ## Port 與網域

            此服務提供兩個獨立的 HTTP port，請只為實際需要的 port 綁定網域：

            | Port | 用途 | 何時需要綁定網域 |
            |------|------|----------------|
            | **8642** | OpenAI 相容 API 伺服器 | 需要外部 API 存取時 |
            | **9119** | 網頁 Dashboard（需設定 `HERMES_DASHBOARD=true`） | 僅在需要瀏覽器介面時 |

            **訊息平台（Telegram、Discord、Slack 等）使用對外連線，不需要公開網址或開放任何 port。**

            ## 持久化儲存

            所有資料儲存在 `/opt/data`（持久化磁碟區）：

            | 路徑 | 說明 |
            |---|---|
            | `/opt/data/config.yaml` | 主設定檔 |
            | `/opt/data/.env` | API 金鑰與密碼 |
            | `/opt/data/sessions/` | 對話歷史 |
            | `/opt/data/memories/` | 持久化記憶 |
            | `/opt/data/skills/` | Agent 建立的技能 |
            | `/opt/data/logs/` | 執行日誌 |

            ## 訊息平台

            部署時預設設定 **Telegram** 作為範例。您可以在部署後設定對應的環境變數，啟用 20+ 支援平台中的任一個。

            詳見官方 [Messaging Gateway 指南](https://hermes-agent.nousresearch.com/docs/user-guide/messaging)。

            ## CLI 操作

            透過 Zeabur **Exec** 分頁可直接使用 Hermes CLI：

            | 指令 | 說明 |
            |------|------|
            | `hermes` | 互動式聊天（REPL） |
            | `hermes --tui` | 現代終端 UI |
            | `hermes status` | 查看所有元件狀態 |
            | `hermes config` | 查看或編輯設定 |
            | `hermes skills` | 瀏覽與安裝技能 |

            ## 注意事項

            - Docker 映像檔約 4.5 GB（含 Playwright + Chromium）。首次部署可能需要數分鐘。
            - 首次啟動需要 30-60 秒來初始化設定檔和同步技能。
            - 建議：2+ vCPU / 4+ GB RAM 以使用瀏覽器工具。
