04 — 設定與啟動

啟動 CoStaff

一行指令把整個 stack 拉起來。第一次會 build image,之後走快取。

costaff start

Preflight 檢查

動到 Docker 之前,costaff start 會先驗證 .env:model API key、資料庫 URI、安全 secret、workspace 目錄。致命問題(例如沒設 GOOGLE_API_KEY)會直接中止並印出確切修法 — 而不是讓容器無聲地 crash-loop。確定要跳過就加 --no-preflight

背後做什麼

分層啟動順序:

  1. Postgres — 內建 postgres:15 容器,存 session、project task、identity 表。
  2. 已註冊的 Agent — 每個 Agent 的 A2A endpoint 與 MCP server 起來。
  3. Manager Agent — 協調者,預設 port 18080
  4. Channels — WebChat、Telegram 之類的。

第一次跑會 build Docker image,幾分鐘是正常的。之後 costaff start 走 build cache,秒級。

其他生命週期指令

指令作用
costaff start分層啟動。沒有 image 會 build。
costaff start --no-build啟動但不 build,快。
costaff start --no-preflight跳過 .env preflight 驗證。
costaff stop停所有容器,volume 留著。
costaff restart等同 stop + start

預設 port

服務Host port
Manager Agent18080
Channel(WebChat 等)1809018099,依加入順序自動分配 — costaff channel list 會列出各 channel 的 port
專家 Agent(A2A 健康檢查)1810018199,自動分配,只綁 127.0.0.1
Postgres5432

Manager port 跟別的服務衝突時,在 ~/.costaff/costaff/.envCOSTAFF_AGENT_PORT