iT邦幫忙

2026 iThome 鐵人賽

DAY 5
0

在一個空目錄跑:

agents-cli scaffold create -y

-y 是 auto-approve。我加它是想看預設值,結果順便發現一個文件跟行為不一致的地方。

加了 -y 就不會列 template

我讀的說明寫 --agent 省略時會列出可用的 local template。實際輸出是這樣:

Info: Project name not specified. Defaulting to 'my-agent' in auto-approve mode.
Info: --agent not specified. Defaulting to 'adk' in auto-approve mode.
Info: --deployment-target not specified. Defaulting to 'agent_runtime' in auto-approve mode.
Info: --cicd-runner not specified. Defaulting to 'skip' (simple mode) in auto-approve mode.
> Verifying GCP credentials...
> ✓ Connected to project: project-942b8cd4-519b-4927-98b

✅ Success! Your agent project is ready.

它沒列清單,直接套預設把專案建出來。要看 template 清單就別加 -y,或用 -i 走互動模式。

順便注意最後那行,它靜靜接管了我 gcloud 的 active project。Day 2 講過為什麼那是個地雷。

38 個檔案,四塊

app/                       agent 本體,6 個檔
  agent.py                 你真正會改的地方
  fast_api_app.py          HTTP 層
  app_utils/a2a.py         A2A 路由掛載
  app_utils/reasoning_engine_adapter.py
  app_utils/services.py
  app_utils/typing.py
deployment/terraform/      基礎設施,14 個檔
  single-project/          apis / iam / storage / service / telemetry ...
  shared/
tests/                     7 個檔
  unit/ integration/ eval/
根目錄                     Dockerfile / pyproject.toml / uv.lock
                           .env / .env.example / .gitignore
                           GEMINI.md / README.md
                           agents-cli-manifest.yaml
                           deployment_metadata.json

我用 --prototype 之外的預設跑,所以 Terraform 那 14 個檔也一起產出來了。只想先玩 agent 邏輯的話加 -p,骨架會小很多。

manifest 記住了你的選擇

agents-cli-manifest.yaml 把建立參數留了下來:

name: "my-agent"
acli_version: "1.3.1"
agent_directory: "app"
region: "us-east1"
base_template: "adk"
create_params:
  deployment_target: "agent_runtime"
  session_type: "none"
  cicd_runner: "skip"
  is_a2a: true
  agent_guidance_filename: "GEMINI.md"

is_a2a: true,而我沒有帶任何 A2A 相關旗標。A2A 是內建的,不用開。這跟我前面讀到的說法一致:每個 ADK agent 都直接支援 A2A,不需要額外 template。

region 預設 us-east1,不是我以為的 us-central1。要別的區域在 create 時帶 --region

三個踩得到的地方

  • agent_guidance_filename 預設是 GEMINI.md 我用 Claude Code,拿到的卻是給 Antigravity 用的檔名。要對就自己帶:
--agent-guidance-filename CLAUDE.md

Codex 之類的用 AGENTS.md。這個檔就是 agent 讀的專案指引,檔名錯了等於沒有。

  • --deployment-target 實際接受四個值: agent_runtimecloud_rungkenonenone 這個值在我讀的說明表格裡沒有列到,是打 --help 才看到的。純本機開發用 none 比用 --prototype 更精準。

  • 不要先 mkdir。 CLI 自己建目錄,你先建好它會失敗或行為異常,我照規矩沒先建,順利過關。

明天

打開 app/agent.py,看整個 agent 的定義其實只有十幾行,以及模板選了哪個模型、為什麼在模型層而不是流程層設重試。


上一篇
Day 4:環境(下)1.23 對 2.5 的版本落差
系列文
ADK × A2A × Cloud Run 打造可部署、可互通的 Agent 系統5
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言