View a markdown version of this page

管理资产 - AWS DevOps 代理人

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

管理资产

AWS DevOps 代理将座席空间的配置和参考资料存储为资产,这些资源是客户管理的资源,这些资源决定了代理所知道的内容和行为方式。技能、 AGENTS.md 文件和附件都是资产,您可以通过资产 API 以编程方式创建、读取、更新和删除它们。

本主题介绍资产模型、您需要的 IAM 权限、每种资产类型期望的元数据,以及如何使用适用于 Python 的 AWS CLI 和 AWS SDK (Boto3) 进行端到端的资产管理。有关技能本身的概念概述,请参阅DevOps 特工技能。有关不是您自己创建的代理生成的知识,请参阅。学到的技能

何时使用资产 API

Operator Web App 是创作单项技能或以交互方式上传 AGENTS.md 文件的最快方法。Asset API 以编程方式公开了相同的操作,因此脚本和自动化无需通过 Web 应用程序即可管理资产。直接调用资产 API 的常见原因包括:

  • 使用脚本、终端或笔记本而不是 Web App 创作或更新资产。

  • Bulk-loading 一组入门技能或 AGENTS.md 文件进入新的特工空间。

  • 读取资产的内容以对其进行备份或比较版本。

资产 API 中的每个操作都通过 AWS CLI aws devops-agent <operation> 和作为devops-agent客户端的 AWS SDK 公开。

资产 API 操作

资产 API 公开了以下操作。每行都列出了您必须授权才能调用该操作的 IAM 操作以及该操作适用的资源。每个操作都存在于aidevops:命名空间中,除此之外都适用于形式为 Agent Space 的资源arn:aws:aidevops:<region>:<account-id>:agentspace/<agentSpaceId>ListAssetTypes有关aidevops:权限的更广泛背景信息,请参阅DevOps 代理 IAM 权限

操作 说明 IAM 操作 资源
ListAssetTypes 列出 AWS DevOps 代理支持的资产类型。 aidevops:ListAssetTypes *
CreateAsset 在特工空间中创建新资产(技能 AGENTS.md、附件、自定义代理、测试配置文件或反馈)。 aidevops:CreateAsset 特工空间
GetAsset 检索资产的元数据和版本信息。 aidevops:GetAsset 特工空间
UpdateAsset 更新现有资产的元数据或内容。 aidevops:UpdateAsset 特工空间
DeleteAsset 从代理空间中删除资产及其所有文件。 aidevops:DeleteAsset 特工空间
ListAssets 列出代理空间中的资产,并可选择按资产类型进行筛选。 aidevops:ListAssets 特工空间
ListAssetVersions 列出资产的历史版本。 aidevops:ListAssetVersions 特工空间
GetAssetContent 以 zip 包的形式下载资产的完整内容。 aidevops:GetAssetContent 特工空间
CreateAssetFile 向现有资源添加新文件。 aidevops:CreateAssetFile 特工空间
GetAssetFile 按路径从资源中检索单个文件。 aidevops:GetAssetFile 特工空间
UpdateAssetFile 替换资源中现有文件的内容或元数据。 aidevops:UpdateAssetFile 特工空间
DeleteAssetFile 从资源中移除单个文件。 aidevops:DeleteAssetFile 特工空间
ListAssetFiles 列出资产中的文件。 aidevops:ListAssetFiles 特工空间

示例 IAM policies

以下策略授予对单个代理空间中资产的完全管理权限:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "aidevops:CreateAsset", "aidevops:GetAsset", "aidevops:UpdateAsset", "aidevops:DeleteAsset", "aidevops:ListAssets", "aidevops:ListAssetVersions", "aidevops:GetAssetContent", "aidevops:CreateAssetFile", "aidevops:GetAssetFile", "aidevops:UpdateAssetFile", "aidevops:DeleteAssetFile", "aidevops:ListAssetFiles" ], "Resource": "arn:aws:aidevops:us-east-1:111122223333:agentspace/8f6187a7-0388-4926-8217-3a0fe32f757c" }, { "Effect": "Allow", "Action": "aidevops:ListAssetTypes", "Resource": "*" } ] }

以下策略授予对单个代理空间中资产的只读访问权限:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "aidevops:GetAsset", "aidevops:ListAssets", "aidevops:ListAssetVersions", "aidevops:GetAssetContent", "aidevops:GetAssetFile", "aidevops:ListAssetFiles" ], "Resource": "arn:aws:aidevops:us-east-1:111122223333:agentspace/8f6187a7-0388-4926-8217-3a0fe32f757c" }, { "Effect": "Allow", "Action": "aidevops:ListAssetTypes", "Resource": "*" } ] }

资产类型

每个资产都有一个assetType字符串,用于标识它是哪种资源。通过资产 API 可以创建六种资产类型:skillagents_mdattachmentcustom_agenttest_profile、和feedback。以下各节描述了每种类型。您也可以在运行时调用ListAssetTypes以检索类型标识符。

每项资源都有一个描述资源的自由格式 metadata JSON 对象。里面的按键metadata使用 snake_case(例如,,agent_types)。skill_type请求正文顶层的外部metadata密钥使用 camelCase(例如、agentSpaceIdassetTypeclientToken)。必需metadata密钥和可选密钥取决于资产类型,如以下各节所述。

当您调用UpdateAsset或时UpdateAssetFile,该服务会将 PATCH 语义应用于metadata:替换您包含的密钥,而省略的密钥将保留其存储的值。创建资源assetType后,您无法对其进行更改。

技能

skill资产包了代理在相关时加载的说明和参考材料。简单技能是单个SKILL.md文件;复杂技能是包含SKILL.md文件和可选references/assets/目录的 zip 包。

必需的metadata属性:

  • 名称(字符串)-技能的唯一标识符。仅限小写字母、数字和连字符,1 到 64 个字符。不得以连字符开头或结尾。仅适用于简单技能。对于 zip 上传,服务会nameSKILL.md frontmatter 读取,此处提供的任何值都将被忽略。

  • 描述(字符串)— 以 1—1024 个字符解释代理何时应使用技能。仅适用于简单技能。对于 zip 上传,服务会descriptionSKILL.md frontmatter 读取,此处提供的任何值都将被忽略。

  • agent_t ypes(字符串数组)— 此技能适用于的一个或多个代理类型。用于["GENERIC"]使所有代理类型都可以使用该技能。其他值包括CHATINCIDENT_TRIAGEINCIDENT_RCAINCIDENT_MITIGATION、、PREVENTIONCHANGE_REVIEWCHANGE_RELEASEQUALITY_ASSURANCE_TESTINGRELEASE_SHEPHERDRELEASE_READINESS_REVIEW、和RELEASE_TESTING。该GENERIC值不能与其他值合并。

可选metadata属性:

  • skill_typ e(字符串)-默认为。USERAsset API 仅允许客户创建的技能,因此唯一可接受的值是USER。该服务拒绝设置skill_type为的请求LEARNED,该请求是为代理本身生成的技能保留的。

  • 状态(字符串)-技能的激活状态。可接受的值为ACTIVEINACTIVE(仅限大写)。默认值为 ACTIVE。非活动技能仍保留在特工空间中,但在调查或聊天期间不会由特工装载。UpdateAsset与一起使用metadata.status可在不删除技能的情况下停用或重新激活该技能。技能是唯一支持激活的资产类型;所有其他资产类型都将忽略该status字段。有关有效示例,请参阅激活和停用技能

  • enable_tools(字符串数组)-代理加载此技能时可以调用的工具标识符列表。

示例metadata

{ "name": "rds-performance-investigation", "description": "Investigation procedures for RDS performance issues including connection exhaustion, slow queries, replication lag, and storage capacity. Use this skill when investigating database latency, connection errors, or read/write performance degradation.", "agent_types": ["GENERIC"] }

限制:Zip 上传的内容不得超过 6 MB。一个特工空间最多可以包含 200 个用户创建的技能。

agents_md

agents_md资产是一个 markdown 文件,其中包含特定代理类型的常设代理指令。代理会在每个任务开始 AGENTS.md 时加载匹配项。有关代理说明的更多信息,请参阅代理说明

必需的metadata属性:

  • agent_typ e(字符串)- AGENTS.md 文件适用的代理类型。有效值为 GENERICCHATINCIDENT_TRIAGEINCIDENT_RCAINCIDENT_MITIGATIONPREVENTIONCHANGE_REVIEWCHANGE_RELEASEQUALITY_ASSURANCE_TESTINGRELEASE_SHEPHERDRELEASE_READINESS_REVIEWRELEASE_TESTING

示例metadata

{ "agent_type": "INCIDENT_TRIAGE" }

限制:每个代理空间最多只能包含一个 AGENTS.md agent_type。文件内容必须为 markdown (text/markdown) 且不得超过 25 KB。

连接

attachment资产存储代理可以在调查期间参考的二进制文件或文本文件,例如架构图、runbook PDF 或示例日志文件。

必需的metadata属性:

  • filename(字符串)-原始文件名,包括基本名称和任何扩展名(例如topology.png)。

  • extension(字符串)-不带前导点的文件扩展名(例如pngpdf、、csv)。

  • 大小(数字)-文件的大小(以字节为单位)。

示例metadata

{ "filename": "topology.png", "extension": "png", "size": 184320 }

限制:座席空间中所有附件的总大小不能超过 10 GB。

自定义代理

custom_agent资产定义了具有精选工具和技能的专业代理配置。使用自定义代理将代理范围限定为特定的工作流程或一组功能。

必需的metadata属性:

  • 名称(字符串)-自定义代理的唯一标识符。仅限小写字母、数字和连字符,1 到 64 个字符。不得以连字符开头或结尾。

可选metadata属性:

  • t@@ ools(字符串数组)-允许自定义代理使用的工具标识符。省略时默认为空列表。

  • 技能(字符串数组)-自定义代理加载的技能标识符。省略时默认为空列表。

示例metadata

{ "name": "rds-firefighter", "tools": ["cloudwatch:GetMetricData", "rds:DescribeDBInstances"], "skills": ["rds-performance-investigation"] }

测试配置文件

test_profile资产存储发布测试运行的可重复使用的配置,包括要执行的测试类型和目标端点。

必需的metadata属性:

  • t@@ est_agent_typ e(字符串)— 此配置文件执行的测试类型。有效值为 releaseUiTestingreleaseApiTesting

  • target_url(字符串)— 测试运行的目标网址。

可选metadata属性:

  • 名称(字符串)— 测试配置文件的人类可读标识符。仅限小写字母、数字和连字符,1 到 128 个字符。不得以连字符开头或结尾。

  • 描述(字符串)— 测试配置文件所涵盖内容的 1-1024 个字符的描述。

  • test_personas(字符串数组)— 测试运行期间要锻炼的角色。有效值为 guestauthenticated

  • api_spec(字符串)— 测试运行的 API 规范。与... 相关releaseApiTesting

  • creditials_secret_arn(字符串)— 持有测试运行凭据的 Secrets AWS Manager 机密的 ARN。

示例metadata

{ "name": "checkout-api-tests", "description": "Release API tests for the checkout service.", "test_agent_type": "releaseApiTesting", "target_url": "https://api.example.com", "test_personas": ["guest", "authenticated"], "api_spec": "openapi: 3.0.0", "credentials_secret_arn": "arn:aws:secretsmanager:us-east-1:111122223333:secret:checkout-creds" }

反馈

feedback资产记录客户提供的有关单个代理执行的反馈。使用反馈资产来捕获下游评估渠道可以汇总的判决和注释。

必需的metadata属性:

  • agent_t ypes(字符串数组)-生成执行的代理类型。必须至少包含一个值(例如,INCIDENT_TRIAGE)。

可选metadata属性:

  • e@@ xecution_id(字符串)-与该反馈相关的执行。将其设置为开启CreateAsset;它不能被更改UpdateAsset

示例metadata

{ "execution_id": "b2c3d4e5-6789-01ab-cdef-example22222", "agent_types": ["INCIDENT_TRIAGE"] }

资产内容:文件或 zip

每个CreateAsset请求都包含一个content对象,用于保存资产存储的字节。的形状content取决于您上传的是单个文件还是 zip 包:

  • 单个文本文件 — 最多可content.file.body.text携带 1.5 MB 的 UTF-8 文本。用它来学习简单的技能和 AGENTS.md 文件。

json { "content": { "file": { "path": "SKILL.md", "body": { "text": "# Skill\n\nInstructions go here." } } } }

  • 单个二进制文件 — 最多可content.file.body.bytes携带 6 MB 的 base64 编码二进制内容。将其用于图像或 PDF 等附件。由于 blob 嵌套在并集内,因此请提前对文件进行 base64 编码并使用提交请求--cli-input-json(有关有效示例,请参阅从二进制文件创建技能)。content

json { "content": { "file": { "path": "topology.png", "body": { "bytes": "<base64-encoded bytes>" } } } }

  • Zip bundlecontent.zip.zipFile 携带最大 6 MB 的 base64 编码压缩档案。将其用于在references/assets/目录SKILL.md中包含其他文件的技能。

json { "content": { "zip": { "zipFile": "<base64-encoded zip bytes>" } } }

要在不重新上传整个捆绑包的情况下添加、替换或删除现有资源中的单个文件,请使用CreateAssetFileUpdateAssetFile、和DeleteAssetFile

端到端管理技能

接下来的演练以三种不同的方式创建技能(来自单个文本文件、二进制文件和 zip 包),然后练习读取、更新和删除操作。8f6187a7-0388-4926-8217-3a0fe32f757c替换为您的代理空间 ID。

从单个文本文件创建技能

这是最简单的路径:内联上传单个SKILL.md文件。由于上传内容仅包含一个文本文件,因此您必须提供namedescriptionmetadata

AWS CLI:

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type skill \ --metadata '{ "name": "rds-performance-investigation", "description": "Investigation procedures for RDS performance issues. Use when investigating database latency, connection errors, or query timeouts.", "agent_types": ["GENERIC"] }' \ --content '{ "file": { "path": "SKILL.md", "body": { "text": "# RDS Performance Investigation\n\nUse this skill when customers report database latency, connection errors, query timeouts, or read/write performance degradation." } } }'

Python (Boto3):

import boto3 client = boto3.client("devops-agent") response = client.create_asset( agentSpaceId="8f6187a7-0388-4926-8217-3a0fe32f757c", assetType="skill", metadata={ "name": "rds-performance-investigation", "description": ( "Investigation procedures for RDS performance issues. " "Use when investigating database latency, connection errors, " "or query timeouts." ), "agent_types": ["GENERIC"], }, content={ "file": { "path": "SKILL.md", "body": { "text": ( "# RDS Performance Investigation\n\n" "Use this skill when customers report database latency, " "connection errors, query timeouts, or read/write " "performance degradation." ) }, } }, ) asset_id = response["asset"]["assetId"]

从二进制文件创建技能

如果技能内容不是 UTF-8 文本,则使用二进制上传。以下示例上传了预渲染的 PDF 作为技能主体。由于请求正文包含嵌套在并集内部的 base64 编码的 blob,因此请提前提供来自 JSON 文件的请求--cli-input-json并对 blob 进行 base64 编码。content

下面的-w 0标志告诉 GNU base64 在一行上发出编码的 blob;如果没有它,默认的 76 个字符的换行符会插入换行符,当将 blob 插入 heredoc 时,这些换行符会生成无效 JSON。在 macOS 上,使用base64 -i ops-runbook.pdf(默认情况下 BSD base64 不换行)。

生成请求正文:

base64 -w 0 ops-runbook.pdf > ops-runbook.b64 cat > create-skill.json <<EOF { "agentSpaceId": "8f6187a7-0388-4926-8217-3a0fe32f757c", "assetType": "skill", "metadata": { "name": "ops-runbook", "description": "Operations runbook covering on-call escalation paths.", "agent_types": ["GENERIC"] }, "content": { "file": { "path": "SKILL.pdf", "body": { "bytes": "$(cat ops-runbook.b64)" } } } } EOF

AWS CLI:

aws devops-agent create-asset --cli-input-json file://create-skill.json

Python (Boto3):

with open("ops-runbook.pdf", "rb") as f: body_bytes = f.read() response = client.create_asset( agentSpaceId="8f6187a7-0388-4926-8217-3a0fe32f757c", assetType="skill", metadata={ "name": "ops-runbook", "description": "Operations runbook covering on-call escalation paths.", "agent_types": ["GENERIC"], }, content={ "file": { "path": "SKILL.pdf", "body": {"bytes": body_bytes}, } }, )

使用压缩包创建技能

当技能包含多个文件(例如,SKILL.md加号参考资料和资产)时,请使用 zip 上传。对于 zip 上传,服务会descriptionSKILL.md前面读取name和读取,因此请勿将其包含在内。metadata

zip 布局如下所示:

rds-performance-investigation.zip ├── SKILL.md ├── references/ │ └── rds-metrics-reference.md └── assets/ └── rds-investigation-flowchart.png

SKILL.md必须包含 frontmatter 这样服务才能提取名称和描述:

--- name: rds-performance-investigation description: Investigation procedures for RDS performance issues including connection exhaustion, slow queries, replication lag, and storage capacity. Use this skill when investigating database latency, connection errors, or read/write performance degradation. --- # RDS Performance Investigation ...

生成请求正文:

base64 -w 0 rds-performance-investigation.zip > skill.zip.b64 cat > create-skill.json <<EOF { "agentSpaceId": "8f6187a7-0388-4926-8217-3a0fe32f757c", "assetType": "skill", "metadata": { "agent_types": ["GENERIC"] }, "content": { "zip": { "zipFile": "$(cat skill.zip.b64)" } } } EOF

AWS CLI:

aws devops-agent create-asset --cli-input-json file://create-skill.json

Python (Boto3):

with open("rds-performance-investigation.zip", "rb") as f: zip_bytes = f.read() response = client.create_asset( agentSpaceId="8f6187a7-0388-4926-8217-3a0fe32f757c", assetType="skill", metadata={"agent_types": ["GENERIC"]}, content={"zip": {"zipFile": zip_bytes}}, )

从仓库导入技能

您可以通过直接从 GitHub 存储库目录导入技能来创建技能。 AWS DevOps 特工获取技能内容,从 f SKILL.md rontmatter 中提取名称和描述,然后在你的特工空间中创建技能。这使您可以管理版本控制中的技能,并以编程方式导入或同步这些技能。

先决条件:

  • 您的代理空间必须关联 GitHub 账户。请参阅正在连接 GitHub

  • 存储库目录必须包含带有 frontmatter 的有效 SKILL.md 文件。

AWS CLI:

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type skill \ --metadata '{ "agent_types": ["GENERIC"] }' \ --content '{"sourceUrl": {"url": "https://github.com/my-org/my-repo/tree/main/skills/rds-investigation"}}'

Python (Boto3):

response = client.create_asset( agentSpaceId="8f6187a7-0388-4926-8217-3a0fe32f757c", assetType="skill", metadata={"agent_types": ["GENERIC"]}, content={ "sourceUrl": { "url": "https://github.com/my-org/my-repo/tree/main/skills/rds-investigation" } }, ) asset_id = response["asset"]["assetId"]

该服务获取目录内容,读取和 SKILL.md 的前置内容descriptionname然后导入所有文件。不要包含namedescription metadata — 它们是自动从前面内容中提取的。

同步导入的技能:

要从存储库中提取最新更改,请UpdateAsset致电content.sourceUrl

aws devops-agent update-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId> \ --content '{"sourceUrl": {"url": "https://github.com/my-org/my-repo/tree/main/skills/rds-investigation"}}'
response = client.update_asset( agentSpaceId="8f6187a7-0388-4926-8217-3a0fe32f757c", assetId="<assetId>", content={ "sourceUrl": { "url": "https://github.com/my-org/my-repo/tree/main/skills/rds-investigation" } }, )

同步将技能内容完全替换为存储库目录的当前状态。保留可编辑字段(状态、代理类型)。

查看导入源:

GetAsset返回存储库中导入metadata.source的技能的源信息:

{ "metadata": { "name": "rds-performance-investigation", "description": "Investigation procedures for RDS performance issues...", "source": { "url": "https://github.com/my-org/my-repo/tree/main/skills/rds-investigation", "lastSyncedAt": 1718467200 }, "agent_types": ["GENERIC"], "skill_type": "USER", "status": "ACTIVE" } }

约束

  • 只接受 GitHub 网址。您可以指向一个包含 SKILL.md (例如https://github.com/org/repo/tree/main/skills/my-skill)的目录,该目录会导入包括参考文件在内的整个目录。如果 SKILL.md 位于存储库的根目录,则也可以直接链接到该文件(例如,https://github.com/org/repo/blob/main/SKILL.md),该文件仅导入 SKILL.md。

  • 该目录必须包含 SKILL.md 具有有效前缀的。

  • 目录总大小不得超过 6 MB,且最多 100 个文件。

  • content.sourceUrlcontent.file和互斥 content.zip ——您不能在同一个请求中将它们组合在一起。

  • 仅限元数据的更新(不带content)会保留现有的导入源,并且不会从存储库中重新获取。

获取、列出、更新和删除

GetAsset用于按 ID 检索单个资产:

aws devops-agent get-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId>

用于ListAssets翻阅代理空间中的所有资产:

aws devops-agent list-assets \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --max-results 50 aws devops-agent list-assets \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --max-results 50 \ --next-token <token>

UpdateAsset用于在不重新上传内容的情况下更改一个或多个metadata字段。省略的密钥会保留其现有值:

aws devops-agent update-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId> \ --metadata '{ "agent_types": ["INCIDENT_TRIAGE", "INCIDENT_RCA"] }'

ListAssetVersions用于检查资产的版本历史记录。每次成功UpdateAssetFile调用UpdateAsset或调用都会提高资产的版本号:

aws devops-agent list-asset-versions \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId>

用于DeleteAsset移除资源及其所有文件:

aws devops-agent delete-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId>

向现有技能添加单个文件

如果您已经从 zip 捆绑包中创建了技能,并且想要添加一个新的参考文件,则无需重新上传整个捆绑包。使用CreateAssetFile

aws devops-agent create-asset-file \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId> \ --path references/troubleshooting.md \ --content '{ "text": "# Troubleshooting\n\nAdditional notes." }'

要替换原处的文件,请update-asset-file使用相同的参数。要将其删除,请使用delete-asset-file

激活和停用技能

技能处于激活状态metadata.status。默认情况下,新技能ACTIVE由特工在调查和聊天期间加载。您可以停用技能以使其停止轮换,而无需将其删除,例如,在调查该技能产生意外结果的原因时,然后再将其重新激活。

通过@@ CreateAsset请求metadata.status中包含以下内容来设置创建时的初始状态

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type skill \ --metadata '{ "name": "rds-performance-investigation", "description": "Investigation procedures for RDS performance issues.", "agent_types": ["GENERIC"], "status": "INACTIVE" }' \ --content '{ "file": { "path": "SKILL.md", "body": { "text": "# RDS Performance Investigation" } } }'

使用@@ 停用现有技能UpdateAsset因为metadata是作为部分更新应用的,所以发送时只会status使其他所有字段保持不变:

aws devops-agent update-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId> \ --metadata '{ "status": "INACTIVE" }'

使用"status": "ACTIVE"以下方法@@ 重新激活

aws devops-agent update-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-id <assetId> \ --metadata '{ "status": "ACTIVE" }'

GetAsset并且ListAssets始终包含技能资产statusmetadata的当前值,这样您就可以随时读取实时激活状态。

status字段区分大小写。只接受ACTIVEINACTIVE(大写)。任何其他值都失败了ValidationException。激活仅适用于技能;任何其他资产类型的设置metadata.status均无效,该字段将从响应中删除。

其他资产类型的示例

上面的技能演练适用于所有其他资产类型。唯一的区别是方metadata块,对于附件,则是二进制内容的选择。下面最少的CreateAsset调用说明了每种类型。

创建一个 AGENTS.md:

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type agents_md \ --metadata '{ "agent_type": "INCIDENT_TRIAGE" }' \ --content '{ "file": { "path": "AGENTS.md", "body": { "text": "# Triage Instructions\n\nFollow these steps for new incidents." } } }'

创建附件(二进制内容;从 JSON 文件构建请求,如从二进制文件创建技能中所示):

base64 -w 0 topology.png > topology.png.b64 cat > create-attachment.json <<EOF { "agentSpaceId": "8f6187a7-0388-4926-8217-3a0fe32f757c", "assetType": "attachment", "metadata": { "filename": "topology.png", "extension": "png", "size": 184320 }, "content": { "file": { "path": "topology.png", "body": { "bytes": "$(cat topology.png.b64)" } } } } EOF aws devops-agent create-asset --cli-input-json file://create-attachment.json

创建自定义代理:

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type custom_agent \ --metadata '{ "name": "rds-firefighter", "tools": ["cloudwatch:GetMetricData", "rds:DescribeDBInstances"], "skills": ["rds-performance-investigation"] }' \ --content '{ "file": { "path": "AGENT.md", "body": { "text": "# RDS Firefighter\n\nCustom agent for RDS incidents." } } }'

创建测试配置文件:

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type test_profile \ --metadata '{ "name": "checkout-api-tests", "test_agent_type": "releaseApiTesting", "target_url": "https://api.example.com", "test_personas": ["guest", "authenticated"] }' \ --content '{ "file": { "path": "PROFILE.md", "body": { "text": "# Checkout API test profile" } } }'

创建反馈资产:

aws devops-agent create-asset \ --agent-space-id 8f6187a7-0388-4926-8217-3a0fe32f757c \ --asset-type feedback \ --metadata '{ "execution_id": "b2c3d4e5-6789-01ab-cdef-example22222", "agent_types": ["INCIDENT_TRIAGE"] }' \ --content '{ "file": { "path": "FEEDBACK.md", "body": { "text": "{\"verdict\":\"correct\"}" } } }'

列出支持的资产类型:

aws devops-agent list-asset-types