View a markdown version of this page

AgentCore CLI 参考 - 亚马逊基岩 AgentCore

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AgentCore CLI 参考

本参考文档记录了亚马逊 Bedrock AgentCore CLI 的公开版本。

项目生命周期

Auto-generated 从 @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>(可选)

非基岩提供商的 API 密钥 [非交互式]

--memory <option>(可选)

内存选项(无、短期、长期AndShortTerm)[非交互式]

--protocol <protocol>(可选)

协议:HTTP、MCP、A2A、AGUI(默认:HTTP)[非交互式]

--type <type>(可选)

代理类型:创建或导入(默认:创建)[非交互式]

--agent-id <id>(可选)

基岩代理 ID(--type 导入必填项)[非交互式]

--agent-alias-id <id>(可选)

基岩代理别名 ID(--type 导入必填项)[非交互式]

--region <region>(可选)

基岩代理的 AWS 区域(--type 导入必填项)[非交互式]

--network-mode <mode>(可选)

网络模式(公共、VPC)[非交互式]

--subnets <ids>(可选)

Comma-separated 子网 ID(VPC 模式必需)[非交互式]

--security-groups <ids>(可选)

Comma-separated 安全组 ID(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/datasets,与--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>(可选)

安全带的型号 [非交互式]

--api-key-arn <arn>(可选)

非基岩安全带提供商的 API 密钥 ARN [非交互式]

--api-base <url>(可选)

线束模型提供商 API 端点 (lite_llm) 的基本网址 [非交互式]

--additional-params <json>(可选)

Provider-specific 将参数作为 JSON 对象 (lite_llm) [非交互式]

--no-harness-memory(可选)

禁用安全带的内存(这是默认设置)[非交互式]

--max-iterations <n>(可选)

最大代理循环迭代次数(线束)[非交互式]

--max-tokens <n>(可选)

每次迭代的最大令牌数(线束)[非交互式]

--timeout <seconds>(可选)

以秒为单位的最大执行时间(线束)[非交互式]

--truncation-strategy <strategy>(可选)

截断策略:sliding_window 或摘要(线束)[非交互式]

--container <uri-or-path>(可选)

容器镜像 URI 或 Dockerfile 路径(线束)[非交互式]

agentcore 部署

agentcore deploy|dp [options]

AWS 通过 CDK 将项目基础设施部署到。

参数

--target <target>(可选)

部署目标名称(默认:“默认”)[非交互式]

-y, --yes(可选)

Auto-confirm 提示,从 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 日志的开发服务器 [非交互式]

--exec(可选)

在正在运行的开发容器中执行 shell 命令(仅限容器代理)[非交互式]

--tool <name>(可选)

MCP 工具名称(与 “呼叫工具” 提示符一起使用)[非交互式]

--input <json>(可选)

采用 JSON 格式的 MCP 工具参数(与--tool 一起使用)[非交互式]

--skip-deploy(可选)

在启动开发服务器之前跳过自动资源部署

-H, --header <header>(可选)

要转发给代理的自定义标头(格式:“名称:值”,可重复)[非交互式](默认:[])

-b, --no-browser(可选)

使用终端 TUI 代替基于 Web 的聊天用户界面

--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 [非交互式]

调用运行时间 &amp;

Auto-generated 从 @aws/agentcore v0.28.1 开始 — 请勿手动编辑。

agentcore 调用

agentcore invoke|i [options] [prompt]

调用已部署的代理端点。

参数

prompt

提示发送给代理。当未提供提示且标准输入不是 TTY 时,还接受管道标准输入 [非交互式]

--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(默认值:“默认用户”)

--api-base <url>(可选)

用于线束调用的 LitellM API 基本 URL 替换。仅lite_llm在非交互模式下可用。

--additional-params <json>(可选)

附加的 LitellM 参数作为 JSON 对象,用于线束调用。仅lite_llm在非交互模式下可用。

--payment-user-id <id>(可选)

End-user/wallet-owner 身份(默认为--user-id)

--payment-instrument-id <id>(可选)

支付工具(钱包)ID

--payment-session-id <id>(可选)

用于预算跟踪的付款会话 ID

--auto-session(可选)

Auto-create/reuse 测试的付款会话

--json(可选)

输出为 JSON

--stream(可选)

实时直播响应

--tool <name>(可选)

MCP 工具名称(与 “呼叫工具” 提示符一起使用)

--input <json>(可选)

采用 JSON 格式的 MCP 工具参数(与--tool 一起使用)

--exec(可选)

在运行时容器中执行 shell 命令

--timeout <seconds>(可选)

--exec 命令的超时时间(以秒为单位)

-H, --header <header>(可选)

自定义标题 “名称:值”(可重复)

--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>(可选)

的 API 密钥 ARN open_ai/gemini

--tools <tools>(可选)

替代工具(以逗号分隔)

--allowed-tools <tools>(可选)

覆盖允许使用的工具(以逗号分隔)

--skills <paths>(可选)

技能(以逗号分隔的路径)

--system-prompt <text>(可选)

覆盖系统提示音

--actor-id <id>(可选)

覆盖内存使用者 ID

--max-iterations <n>(可选)

覆盖最大迭代次数

--max-tokens <n>(可选)

覆盖最大代币数量

--harness-timeout <seconds>(可选)

覆盖超时秒数

agentcore 高管

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>(可选)

Server-side 文本过滤器

--json(可选)

输出为 JSON 行

agentcore 跟踪

agentcore traces|t [options] [command]

查看和下载代理跟踪。

agentcore 状态

agentcore status|s [options]

显示已部署资源的详细信息和状态。

参数

--runtime-id <id>(可选)

按 ID 查找特定的运行时间

--target <name>(可选)

选择部署目标

--type <type>(可选)

按资源类型(代理、运行时终端节点、内存、凭证、网关、评估器、在线评估、支付、策略引擎、策略、配置包、数据集、知识库、工具)进行筛选

--state <state>(可选)

按部署状态(已部署、仅限本地、待删除)进行筛选

--runtime <name>(可选)

过滤到特定的运行时间

--name <name>(可选)

按名称显示单个资源的详细信息(知识库)

--json(可选)

输出为 JSON

agentcore 提取

agentcore fetch [options] [command]

获取已部署资源的访问信息。

agentcore 视图

agentcore view [options] [command]

查看工作历史记录和详细信息

资源管理

Auto-generated 从 @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(可选)

Auto-confirm 提示

评估&amp;数据集

Auto-generated 从 @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]

管理数据集内容和版本

优化&amp;配置包

Auto-generated 从 @aws/agentcore v0.28.1 开始 — 请勿手动编辑。

agentcore 配置包

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

管理配置包(使用 agentcore.json 中的包名称,而不是 ID)

agentcore 推广

agentcore promote [options] [command]

推广资源

agentcore 存档

agentcore archive [options] [command]

存档(删除)有关该服务的批量评估或建议,并清除本地历史记录。

操作&amp;设置

Auto-generated 从 @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

以点表示法配置密钥(例如,启用 telemetry.enabled)

value

要设置的值

agentcore 遥测

agentcore telemetry [options] [command]

管理匿名使用情况分析偏好。

agentcore 反馈

agentcore feedback [options] [message]

向团队发送有关 AgentCore CLI 的反馈。

参数

message

反馈消息 [非交互式]

--screenshot <path>(可选)

PNG 或 JPG 屏幕截图的路径(最大 100MB)[非交互式]

--json(可选)

输出结果为 JSON [非交互式]