

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

# AgentCore CLI 参考
<a name="agentcore-cli-reference"></a>

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

**Topics**
+ [项目生命周期](#cli-project-lifecycle)
+ [调用运行时间 &amp;](#cli-invocation)
+ [资源管理](#cli-resources)
+ [评估&amp;数据集](#cli-evaluation)
+ [优化&amp;配置包](#cli-optimization)
+ [操作&amp;设置](#cli-operations)

## 项目生命周期
<a name="cli-project-lifecycle"></a>

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

### agentcore 创建
<a name="_agentcore_create"></a>

```
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 部署
<a name="_agentcore_deploy"></a>

```
agentcore deploy|dp [options]
```

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

 **参数** 

 `--target <target>`*（可选）*   
部署目标名称（默认：“默认”）[非交互式]

 `-y, --yes`*（可选）*   
Auto-confirm 提示，从 env 读取凭据 [非交互式]

 `-v, --verbose`*（可选）*   
显示资源级部署事件 [非交互式]

 `--json`*（可选）*   
输出为 JSON [非交互式]

 `--dry-run`*（可选）*   
无需部署即可预览部署 [非交互式]

 `--diff`*（可选）*   
无需部署即可显示 CDK 差异 [非交互式]

### agentcore 开发人员
<a name="_agentcore_dev"></a>

```
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 软件包
<a name="_agentcore_package"></a>

```
agentcore package|pkg [options]
```

无需部署即可打包代理工件。

 **参数** 

 `-d, --directory <path>`*（可选）*   
包含 agentcore 配置的项目目录

 `-r, --runtime <name>`*（可选）*   
仅打包指定的运行时间

### agentcore 导出
<a name="_agentcore_export"></a>

```
agentcore export [options] [command]
```

将安全带导出到 Strands 运行时代理。

### agentcore 更新
<a name="_agentcore_update"></a>

```
agentcore update [options] [command]
```

检查并安装 CLI 更新

 **参数** 

 `-c, --check`*（可选）*   
无需安装即可检查更新

### agentcore 验证
<a name="_agentcore_validate"></a>

```
agentcore validate [options]
```

验证 agentcore/ 配置文件。

 **参数** 

 `-d, --directory <path>`*（可选）*   
包含 agentcore 配置的项目目录

 `--json`*（可选）*   
输出为 JSON [非交互式]

## 调用运行时间 &amp;
<a name="cli-invocation"></a>

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

### agentcore 调用
<a name="_agentcore_invoke"></a>

```
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 高管
<a name="_agentcore_exec"></a>

```
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 运行
<a name="_agentcore_run"></a>

```
agentcore run [options] [command]
```

运行评估、批量评估或优化建议。

### agentcore 日志
<a name="_agentcore_logs"></a>

```
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 跟踪
<a name="_agentcore_traces"></a>

```
agentcore traces|t [options] [command]
```

查看和下载代理跟踪。

### agentcore 状态
<a name="_agentcore_status"></a>

```
agentcore status|s [options]
```

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

 **参数** 

 `--runtime-id <id>`*（可选）*   
按 ID 查找特定的运行时间

 `--target <name>`*（可选）*   
选择部署目标

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

 `--state <state>`*（可选）*   
按部署状态（已部署、仅限本地、待删除）进行筛选

 `--runtime <name>`*（可选）*   
过滤到特定的运行时间

 `--name <name>`*（可选）*   
按名称显示单个资源的详细信息（知识库）

 `--json`*（可选）*   
输出为 JSON

### agentcore 提取
<a name="_agentcore_fetch"></a>

```
agentcore fetch [options] [command]
```

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

### agentcore 视图
<a name="_agentcore_view"></a>

```
agentcore view [options] [command]
```

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

## 资源管理
<a name="cli-resources"></a>

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

### agentcore 添加
<a name="_agentcore_add"></a>

```
agentcore add [options] [command] [subcommand]
```

向项目配置中添加资源。

### agentcore 移除
<a name="_agentcore_remove"></a>

```
agentcore remove [options] [command] [subcommand]
```

从项目配置中移除资源。

### agentcore 导入
<a name="_agentcore_import"></a>

```
agentcore import [options] [command]
```

将运行时、内存或入门工具包导入此项目。

 **参数** 

 `--source <path>`*（可选）*   
.bedrock\_agentcore.yaml 配置文件的路径

 `--target <target>`*（可选）*   
部署目标名称（仅在项目有多个目标时才需要）

 `-y, --yes`*（可选）*   
Auto-confirm 提示

## 评估&amp;数据集
<a name="cli-evaluation"></a>

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

### agentcore 评估
<a name="_agentcore_evals"></a>

```
agentcore evals [options] [command]
```

查看过去运行中保存的评估和批量评估结果。

### agentcore 批量评估
<a name="_agentcore_batch_evaluations"></a>

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

查看批量评估任务及其结果。

 **参数** 

 `id`   
要查看的批量评估任务 ID

 `--json`*（可选）*   
输出为 JSON

### agentcore 数据集
<a name="_agentcore_dataset"></a>

```
agentcore dataset [options] [command]
```

管理数据集内容和版本

## 优化&amp;配置包
<a name="cli-optimization"></a>

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

### agentcore 配置包
<a name="_agentcore_config_bundle"></a>

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

管理配置包（使用 agentcore.json 中的包名称，而不是 ID）

### agentcore 推广
<a name="_agentcore_promote"></a>

```
agentcore promote [options] [command]
```

推广资源

### agentcore 存档
<a name="_agentcore_archive"></a>

```
agentcore archive [options] [command]
```

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

## 操作&amp;设置
<a name="cli-operations"></a>

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

### agentcore 暂停
<a name="_agentcore_pause"></a>

```
agentcore pause [options] [command]
```

暂停已部署的资源（在线评估配置、 A/B 测试）。

### agentcore 简历
<a name="_agentcore_resume"></a>

```
agentcore resume [options] [command]
```

恢复暂停的资源（在线评估配置、 A/B 测试）。

### agentcore 停止
<a name="_agentcore_stop"></a>

```
agentcore stop [options] [command]
```

停止正在运行的批量评估或 A/B 测试。

### agentcore 配置
<a name="_agentcore_config"></a>

```
agentcore config [options] [key] [value]
```

调整全局配置设置，例如遥测选择退出状态

 **参数** 

 `key`   
以点表示法配置密钥（例如，启用 telemetry.enabled）

 `value`   
要设置的值

### agentcore 遥测
<a name="_agentcore_telemetry"></a>

```
agentcore telemetry [options] [command]
```

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

### agentcore 反馈
<a name="_agentcore_feedback"></a>

```
agentcore feedback [options] [message]
```

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

 **参数** 

 `message`   
反馈消息 [非交互式]

 `--screenshot <path>`*（可选）*   
PNG 或 JPG 屏幕截图的路径（最大 100MB）[非交互式]

 `--json`*（可选）*   
输出结果为 JSON [非交互式]