View a markdown version of this page

AgentCore CLI 參考 - Amazon Bedrock AgentCore

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AgentCore CLI 參考

此參考記錄公有 Amazon Bedrock AgentCore CLI 版本。

專案生命週期

從 @aws/agentcore v0.28.1 自動產生 — 請勿手動編輯。

agentcore 建立

agentcore create [options]

建立新的 AgentCore 專案

參數

--name <name> (選用)

資源名稱 【非互動式】

--project-name <name> (選用)

專案名稱 (以字母開頭,僅限英數字元,最多 23 個字元) 【非互動式】

--no-agent (選用)

略過客服人員建立 【非互動式】

--defaults (選用)

使用預設設定建立繫帶專案 (這是預設值) 【非互動式】

--build <type> (選用)

組建類型:CodeZip 或容器 (預設:CodeZip) 【非互動式】

--language <language> (選用)

目標語言:Python 或 TypeScript (預設:Python) 【非互動式】

--framework <framework> (選用)

代理程式架構 (Strands、LangChain_LangGraph、GoogleADK、OpenAIAgents、VercelAI) 【非互動式】

--model-provider <provider> (選用)

模型提供者 (Bedrock、Anthropic、OpenAI、Gemini) 【非互動式】

--api-key <key> (選用)

非 Bedrock 提供者的 API 金鑰 【非互動式】

--memory <option> (選用)

記憶體選項 (無、shortTerm、longAndShortTerm) 【非互動式】

--protocol <protocol> (選用)

通訊協定:HTTP、MCP、A2A、AGUI (預設:HTTP) 【非互動式】

--type <type> (選用)

客服人員類型:建立或匯入 (預設:建立) 【非互動式】

--agent-id <id> (選用)

Bedrock 代理程式 ID (--type Import 需要) 【非互動式】

--agent-alias-id <id> (選用)

Bedrock 代理程式別名 ID (--type Import 需要) 【非互動式】

--region <region> (選用)

Bedrock 代理 AWS 程式的區域 (--type 匯入需要) 【非互動式】

--network-mode <mode> (選用)

網路模式 (PUBLIC、VPC) 【非互動式】

--subnets <ids> (選用)

逗號分隔IDs (VPC 模式需要) 【非互動式】

--security-groups <ids> (選用)

逗號分隔的安全群組 IDs(VPC 模式需要) 【非互動式】

--vpc-id <id> (選用)

VPC ID (使用 VPC 模式的容器建置需要) 【非互動式】

--idle-timeout <seconds> (選用)

閒置工作階段逾時,以秒為單位 (60-28800) 【非互動式】

--max-lifetime <seconds> (選用)

執行個體生命週期上限,以秒為單位 (60-28800) 【非互動式】

--session-storage-mount-path <path> (選用)

/mnt 下工作階段檔案系統儲存的絕對掛載路徑 (例如 /mnt/data) 【非互動式】

--efs-access-point-arn <arn> (選用)

EFS 存取點 ARN (可重複,與 --efs-mount-path 配對) 【非互動式】 (預設:【】)

--efs-mount-path <path> (選用)

EFS 掛載路徑 (例如,/mnt/tools,與 --efs-access-point-arn 配對) 【非互動式】 (預設:【】)

--s3-access-point-arn <arn> (選用)

S3 檔案存取點 ARN (可重複,與 --s3-mount-path 配對) 【非互動式】 (預設:【】)

--s3-mount-path <path> (選用)

S3 檔案掛載路徑 (例如,/mnt/資料集,與 --s3-access-point-arn 配對) 【非互動式】 (預設:【】)

--with-config-bundle (選用)

建立連接至客服人員範本的組態套件 【非互動式】

--output-dir <dir> (選用)

輸出目錄 (預設:目前目錄) 【非互動式】

--skip-git (選用)

略過 git 儲存庫初始化 【非互動式】

--skip-python-setup (選用)

略過 Python 虛擬環境設定 【非互動式】

--skip-install (選用)

略過所有相依性安裝 (npm 安裝、uv 同步) 【非互動式】

--dry-run (選用)

預覽要建立的內容,而不進行變更 【非互動式】

--json (選用)

輸出為 JSON 【非互動式】

--model-id <id> (選用)

繫帶的模型 ID 【非互動式】

--api-key-arn <arn> (選用)

非 Bedrock 繫帶供應商的 API 金鑰 ARN 【非互動式】

--api-base <url> (選用)

繫帶模型提供者 API 端點 (lite_llm) 的基本 URL 【非互動式】

--additional-params <json> (選用)

做為 JSON 物件 (lite_llm) 的提供者特定繫帶參數 【非互動式】

--no-harness-memory (選用)

停用繫帶的記憶體 (這是預設值) 【非互動式】

--max-iterations <n> (選用)

代理程式迴圈反覆運算上限 (硬度) 【非互動式】

--max-tokens <n> (選用)

每次反覆運算的字符上限 (硬度) 【非互動式】

--timeout <seconds> (選用)

以秒為單位的最長執行持續時間 (硬度) 【非互動式】

--truncation-strategy <strategy> (選用)

截斷策略:sliping_window 或摘要 (硬度) 【非互動式】

--container <uri-or-path> (選用)

容器映像 URI 或 Dockerfile 路徑 (硬度) 【非互動式】

代理程式核心部署

agentcore deploy|dp [options]

AWS 透過 CDK 將專案基礎設施部署至 。

參數

--target <target> (選用)

部署目標名稱 (預設:「預設」) 【非互動式】

-y, --yes (選用)

自動確認提示、從 env 讀取登入資料 【非互動式】

-v, --verbose (選用)

顯示資源層級部署事件 【非互動式】

--json (選用)

輸出為 JSON 【非互動式】

--dry-run (選用)

預覽部署而不部署 【非互動式】

--diff (選用)

顯示 CDK 差異而不部署 【非互動式】

agentcore 開發

agentcore dev|d [options] [prompt]

啟動本機開發伺服器,或在本機叫用 代理程式。

參數

prompt

將提示傳送至執行中的開發伺服器 【非互動式】

-p, --port <port> (選用)

開發伺服器的連接埠。明確設定時使用原狀;預設值會因多執行期專案中的執行期索引而偏移。(預設值:"8080")

-r, --runtime <name> (選用)

執行或叫用的執行時間 (如果多個執行時間則為必要)

-s, --stream (選用)

叫用 【非互動式】 時的串流回應

-l, --logs (選用)

使用 stdout 日誌執行 dev 伺服器 【非互動式】

--exec (選用)

在執行中的開發容器中執行 shell 命令 (僅限容器代理程式) 【非互動式】

--tool <name> (選用)

MCP 工具名稱 (與「呼叫工具」提示搭配使用) 【非互動式】

--input <json> (選用)

MCP 工具引數做為 JSON (與 --tool 搭配使用) 【非互動式】

--skip-deploy (選用)

啟動開發伺服器之前略過自動資源部署

-H, --header <header> (選用)

要轉送到代理程式的自訂標頭 (格式:「名稱:值」、可重複) 【非互動式】 (預設:【】)

-b, --no-browser (選用)

使用終端機 TUI 而非 Web 型聊天 UI

--no-traces (選用)

停用本機 OTEL 追蹤集合

agentcore 套件

agentcore package|pkg [options]

未部署的情況下封裝代理程式成品。

參數

-d, --directory <path> (選用)

包含 agentcore 組態的專案目錄

-r, --runtime <name> (選用)

僅封裝指定的執行時間

agentcore 匯出

agentcore export [options] [command]

將繫帶匯出至 Strands 執行期代理程式。

agentcore 更新

agentcore update [options] [command]

檢查並安裝 CLI 更新

參數

-c, --check (選用)

檢查更新,而不安裝

agentcore 驗證

agentcore validate [options]

驗證 agentcore/ 組態檔案。

參數

-d, --directory <path> (選用)

包含 agentcore 組態的專案目錄

--json (選用)

輸出為 JSON 【非互動式】

調用與執行時間

從 @aws/agentcore v0.28.1 自動產生 — 請勿手動編輯。

agentcore 調用

agentcore invoke|i [options] [prompt]

叫用部署的代理程式端點。

參數

prompt

提示 傳送給客服人員。未提供任何提示且 stdin 不是 TTY 時,也接受管道 stdin 【非互動式】

--prompt <text> (選用)

提示 傳送給客服人員 【非互動式】

--prompt-file <path> (選用)

從檔案讀取提示 (針對超過 shell arg 限制的長或結構化承載) 【非互動式】

--runtime <name> (選用)

選取特定執行時間 【非互動式】

--gateway <name> (選用)

透過閘道叫用 【非互動式】

--gateway-target-name <name> (選用)

閘道上的 HTTP 執行期目標 【非互動式】

--target <name> (選用)

選取部署目標 【非互動式】

--session-id <id> (選用)

使用特定工作階段 ID 進行對話持續性

--user-id <id> (選用)

執行時間調用的使用者 ID (預設值:"default-user")

--api-base <url> (選用)

用於繫帶呼叫的 LiteLLM API 基本 URL 覆寫。僅適用於非互動式模式lite_llm的 。

--additional-params <json> (選用)

作為 JSON 物件的其他 LiteLLM 參數,用於繫帶調用。僅適用於非互動式模式lite_llm的 。

--payment-user-id <id> (選用)

最終使用者/錢包擁有者身分 (預設為 --user-id)

--payment-instrument-id <id> (選用)

付款工具 (錢包) ID

--payment-session-id <id> (選用)

用於預算追蹤的付款工作階段 ID

--auto-session (選用)

自動建立/重複使用付款工作階段進行測試

--json (選用)

輸出為 JSON

--stream (選用)

即時串流回應

--tool <name> (選用)

MCP 工具名稱 (搭配「call-tool」提示使用)

--input <json> (選用)

MCP 工具引數做為 JSON (搭配 --tool 使用)

--exec (選用)

在執行時間容器中執行 shell 命令

--timeout <seconds> (選用)

--exec 命令的逾時,以秒為單位

-H, --header <header> (選用)

自訂標頭 "Name: Value" (可重複)

--bearer-token <token> (選用)

CUSTOM_JWT 驗證的承載字符 (繞過 SigV4)

--harness <name> (選用)

選取要叫用的特定繫帶

--harness-arn <arn> (選用)

依 ARN 叫用繫帶 (不需要專案)

--region <region> (選用)

AWS 區域 (需要 --harness-arn)

--verbose (選用)

列印詳細串流 JSON 事件

--model-id <id> (選用)

覆寫模型

--model-provider <provider> (選用)

模型提供者。有效值:bedrock、open_ai 或 gemini。

--api-key-arn <arn> (選用)

Open_ai/gemini 的 API 金鑰 ARN

--tools <tools> (選用)

覆寫工具 (逗號分隔)

--allowed-tools <tools> (選用)

覆寫允許的工具 (逗號分隔)

--skills <paths> (選用)

Skills (逗號分隔路徑)

--system-prompt <text> (選用)

覆寫系統提示

--actor-id <id> (選用)

覆寫記憶體演員 ID

--max-iterations <n> (選用)

覆寫反覆運算上限

--max-tokens <n> (選用)

覆寫權杖上限

--harness-timeout <seconds> (選用)

覆寫逾時秒數

agentcore exec

agentcore exec [options] [command...]

在部署的代理程式容器中開啟互動式 shell 或執行一次性命令。

參數

command

要執行的命令 (一次性模式,非互動式)

--it (選用)

開啟互動式 PTY shell 工作階段

--runtime <name|arn> (選用)

目標代理程式名稱或執行期 ARN (略過代理程式選擇器)

--harness <name|arn> (選用)

目標繫帶名稱或繫帶 ARN (略過代理程式挑選器)

--session-id <id> (選用)

釘選至特定執行階段工作階段/VM

--shell-id <id> (選用)

重新連線至現有的 shell

--region <region> (選用)

AWS 區域

--bearer-token <token> (選用)

CUSTOM_JWT 身分驗證的承載字符 (略過 SigV4)

--target <name> (選用)

部署目標名稱 (來自 agentcore.json)

--timeout <seconds> (選用)

單擊命令的逾時,以秒為單位

--json (選用)

輸出結果為 JSON (僅限單鏡頭模式,與 --it 相容)

agentcore 執行

agentcore run [options] [command]

執行評估、批次評估或最佳化建議。

agentcore 日誌

agentcore logs|l [options] [command]

串流或搜尋代理程式執行時間日誌。

參數

--runtime <name> (選用)

選取特定執行時間

--since <time> (選用)

開始時間 — 在搜尋模式中預設為 1 小時前 (例如 "1h"、"30m"、"2d"、ISO 8601)

--until <time> (選用)

結束時間 — 預設為現在處於搜尋模式 (例如,「現在」、ISO 8601)

--level <level> (選用)

依日誌層級篩選 (錯誤、警告、資訊、偵錯)

-n, --limit <count> (選用)

要傳回的日誌行數上限

--query <text> (選用)

伺服器端文字篩選條件

--json (選用)

輸出為 JSON 行

agentcore 追蹤

agentcore traces|t [options] [command]

檢視和下載代理程式追蹤。

agentcore 狀態

agentcore status|s [options]

顯示已部署的資源詳細資訊和狀態。

參數

--runtime-id <id> (選用)

依 ID 查詢特定執行時間

--target <name> (選用)

選取部署目標

--type <type> (選用)

依資源類型篩選 (代理程式、執行時間端點、記憶體、登入資料、閘道、評估器、線上評估、付款、政策引擎、政策、config-bundle、資料集、知識庫、繫帶)

--state <state> (選用)

依部署狀態篩選 (已部署、僅限本機、待定移除)

--runtime <name> (選用)

篩選至特定執行時間

--name <name> (選用)

依名稱顯示單一資源的詳細資訊 (知識基礎)

--json (選用)

輸出為 JSON

agentcore 擷取

agentcore fetch [options] [command]

擷取已部署資源的存取資訊。

agentcore 檢視

agentcore view [options] [command]

檢視任務歷史記錄和詳細資訊

資源管理

從 @aws/agentcore v0.28.1 自動產生 — 請勿手動編輯。

agentcore 新增

agentcore add [options] [command] [subcommand]

將資源新增至專案組態。

agentcore 移除

agentcore remove [options] [command] [subcommand]

從專案組態中移除資源。

agentcore 匯入

agentcore import [options] [command]

將執行時間、記憶體或入門工具組匯入此專案。

參數

--source <path> (選用)

.bedrock_agentcore.yaml 組態檔案的路徑

--target <target> (選用)

部署目標名稱 (只有在專案有多個目標時才需要)

-y, --yes (選用)

自動確認提示

評估與資料集

從 @aws/agentcore v0.28.1 自動產生 — 請勿手動編輯。

agentcore 移出

agentcore evals [options] [command]

檢視過去執行的已儲存評估和批次評估結果。

agentcore 批次評估

agentcore batch-evaluations [options] [command] <id>

檢視批次評估任務及其結果。

參數

id

要檢視的批次評估任務 ID

--json (選用)

輸出為 JSON

agentcore 資料集

agentcore dataset [options] [command]

管理資料集內容和版本

最佳化與組態套件

從 @aws/agentcore v0.28.1 自動產生 — 請勿手動編輯。

agentcore config-bundle

agentcore config-bundle|cb [options] [command]

管理組態套件 (使用 agentcore.json 的套件名稱,而非 ID)

agentcore 升級

agentcore promote [options] [command]

提升資源

agentcore 封存

agentcore archive [options] [command]

封存 (刪除) 服務的批次評估或建議,並清除本機歷史記錄。

操作與設定

從 @aws/agentcore v0.28.1 自動產生 — 請勿手動編輯。

agentcore 暫停

agentcore pause [options] [command]

暫停部署的資源 (線上評估組態、A/B 測試)。

agentcore 恢復

agentcore resume [options] [command]

繼續暫停的資源 (線上評估組態、A/B 測試)。

agentcore 停止

agentcore stop [options] [command]

停止執行中的批次評估或 A/B 測試。

agentcore 組態

agentcore config [options] [key] [value]

調整全域組態設定,例如遙測選擇退出狀態

參數

key

點表示法中的 Config 金鑰 (例如 Telemetry.enabled)

value

要設定的值

agentcore 遙測

agentcore telemetry [options] [command]

管理匿名用量分析偏好設定。

agentcore 意見回饋

agentcore feedback [options] [message]

將有關 AgentCore CLI 的意見回饋傳送給團隊。

參數

message

意見回饋訊息 【非互動式】

--screenshot <path> (選用)

PNG 或 JPG 螢幕擷取畫面的路徑 (上限為 100MB) 【非互動式】

--json (選用)

JSON 【非互動式】 的輸出結果