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。
背後做什麼
分層啟動順序:
- Postgres — 內建
postgres:15容器,存 session、project task、identity 表。 - 已註冊的 Agent — 每個 Agent 的 A2A endpoint 與 MCP server 起來。
- Manager Agent — 協調者,預設 port
18080。 - 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 Agent | 18080 |
| Channel(WebChat 等) | 18090–18099,依加入順序自動分配 — costaff channel list 會列出各 channel 的 port |
| 專家 Agent(A2A 健康檢查) | 18100–18199,自動分配,只綁 127.0.0.1 |
| Postgres | 5432 |
Manager port 跟別的服務衝突時,在 ~/.costaff/costaff/.env 改 COSTAFF_AGENT_PORT。