GitHub Copilot
| 必要なシークレット | オーバーレイ |
|---|---|
DISCORD_BOT_TOKEN |
values-github-copilot.yaml |
TELEGRAM_BOT_TOKEN(auth.deviceFlow.notify: telegram と併用) |
values-github-copilot.yaml と下記の上書き設定 |
利用条件¶
Discord または Telegram のボットと、GitHub Copilot の利用権限が必要です。 ログイントークンを再利用するには、永続ストレージも必要です。
Hermes v0.23.0 で、copilot プロバイダーは
GitHub Copilot Labs プラグインに移行しました。
Copilot を選択したプロファイルには、Hermes がプラグインを自動でインストールします。
外向き通信を制限している場合は、Copilot API に加え、初回起動時にプラグインカタログと
GitHub 上のプラグインのソースにアクセスできるようにしてください。
config.model.provider: copilot は変更しないでください。チャートのデバイスログインは
引き続き COPILOT_GITHUB_TOKEN を Hermes のボリュームに保存し、プラグインも同じキーを読み込みます。
別のマシンで GitHub または Copilot の CLI にログインしただけでは、プラグインはその認証情報を使えません。
その場合は、チャートのデバイスログインを使ってください。
インストール¶
helm upgrade --install hermes-agent ./charts/hermes-agent \
--namespace hermes-agent --create-namespace \
-f charts/hermes-agent/values-github-copilot.yaml \
--set-string env.DISCORD_BOT_TOKEN='<real-value>' --wait
複数の認証情報が必要な例では、記載されているすべての値を --set-string で渡すか、
extraEnvFrom で既存の Secret を参照してください。
デプロイ時の設定¶
初回起動時の Pod ログまたは Discord の通知に表示されるデバイスコードを、GitHub で承認します。
2 回目以降の起動¶
トークンは永続ボリューム上の HERMES_HOME/.env に保存されます。次回の起動時に、
初期化コンテナは https://api.github.com/user でトークンを確認し、有効であればログインを省略します。
確認先が HTTP 401 または 403 を返すと、初期化コンテナはデバイスログインをやり直します。
この確認は Copilot のプランに依存しません。チャート 1.18.0 までは
copilot_internal/v2/token で確認していました。このエンドポイントは Copilot Free の有効な
トークンにも 403 を返したため、再起動のたびに新しいコードが必要でした
(#349)。validateUrl を上書きする場合は、
使用可能なトークンに 200 を返し、再ログインが必要な場合にのみ 401 または 403 を返すエンドポイントを使ってください。
Discord の代わりに Telegram を使う¶
auth.deviceFlow.notify: telegram を設定し、Discord 用の値の代わりに
TELEGRAM_BOT_TOKEN、TELEGRAM_HOME_CHANNEL、TELEGRAM_ALLOWED_USERS を指定します。
デバイスコードは Telegram チャットに届きます。readyNotify.enabled: true にすると、
エージェントの起動時に同じチャットへ通知が届きます。Copilot Free アカウントでの実機確認では、
ログインが完了し、起動通知が届き、gpt-4o で応答できました。利用可能なモデルは GitHub のプランに従います。
オーバーレイ全体¶
# values-github-copilot.yaml
#
# Hermes Agent backed by GitHub Copilot, authenticated at startup via the OAuth
# 2.0 Device Authorization Grant (RFC 8628): no API key to paste. The
# "auth-device-login" init container surfaces a verification link + code to your
# Discord home channel (or Telegram: set `auth.deviceFlow.notify: telegram` and
# pass TELEGRAM_BOT_TOKEN, TELEGRAM_HOME_CHANNEL and TELEGRAM_ALLOWED_USERS
# instead of the Discord values), waits for you to approve it on github.com (phone is
# fine), then persists the resulting token to HERMES_HOME/.env where Hermes
# reads it natively. The token lives on the persistent volume, so restarts are
# fast; re-login only happens when it is missing or revoked.
#
# Copilot's token API rejects PATs: a device-flow `gho_`/`ghu_` token is
# required, which is exactly what this flow produces.
#
# All secrets below are DUMMY placeholders. Do NOT commit real keys: override
# them at install time (--set-string) or inject via a SealedSecret + extraEnvFrom
# (see examples/argocd/).
#
# helm upgrade --install hermes-agent ./charts/hermes-agent \
# --namespace hermes-agent --create-namespace \
# -f charts/hermes-agent/values-github-copilot.yaml \
# --set-string env.DISCORD_BOT_TOKEN='<real-bot-token>' --wait
#
# # then watch the login init container for the verification prompt:
# kubectl logs deploy/hermes-agent -n hermes-agent -c auth-device-login -f
config:
model:
# GitHub Copilot provider. Hermes v0.23.0 auto-installs its Labs plugin.
provider: copilot
# Any model your Copilot subscription can reach. Examples: gpt-4o, gpt-4.1,
# claude-sonnet-4.5, gemini-2.5-pro, gpt-5.
default: gpt-4o
terminal:
backend: local
# Authenticate the Copilot credential via the OAuth device flow at startup.
auth:
deviceFlow:
enabled: true
provider: github-copilot
# Deliver the verification link + code to the agent's Discord home channel
# (reuses DISCORD_BOT_TOKEN + DISCORD_HOME_CHANNEL). It is always also
# printed to the init container logs as a fallback.
notify: discord
env:
# The chart's default placeholder is for OpenAI; this deployment doesn't use
# it (the Copilot token is fetched at runtime via device flow). Set to a clear
# sentinel so no real OpenAI key is implied.
OPENAI_API_KEY: "unused"
# --- Discord bot (secret bits) ------------------------------------------
# Setting the token is enough to auto-enable Discord: no config.yaml change.
# The login init container reuses this same bot to post the verification link.
# Create the bot at https://discord.com/developers/applications, enable the
# "Message Content Intent", and invite it to your server.
DISCORD_BOT_TOKEN: "MTA0DUMMYtoken000000000000.DUMMY.replace_me_with_a_real_token"
# Non-secret Discord knobs go here (plain env, not the Secret). The login init
# container also reads DISCORD_HOME_CHANNEL from here to know where to post.
extraEnv:
- name: DISCORD_HOME_CHANNEL # channel id for cron / notification / login delivery
value: "000000000000000000" # DUMMY - your channel id (18 digits)
- name: DISCORD_ALLOWED_USERS # comma-separated user ids allowed to talk
value: "111111111111111111" # DUMMY - your Discord user id
- name: DISCORD_ALLOW_ALL_USERS # true only for throwaway/dev bots
value: "false"
# Persistence is required for device-flow login: the token is written here so it
# survives restarts (otherwise you would re-approve on every restart). Empty
# storageClass = cluster default; on a Raspberry Pi cluster that is typically
# local-path (k3s) or microk8s-hostpath: both ReadWriteOnce, which is exactly
# what this single-writer workload wants.
persistence:
enabled: true
storageClass: ""
accessModes:
- ReadWriteOnce
size: 5Gi
# Defaults are already tuned for small arm64 nodes; shown here for visibility.
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "1"
memory: 1Gi