
AWS CLIからDevOps AgentのRunBook一覧を取得するハックに挑戦してみた
リテールアプリ共創部@大阪の岩田です。
ちょっとした検証のためにDevOps AgentのRun BookをAWS CLIから操作したかったのですが、最新版のAWS CLIでもDevOps AgentのCLI操作には未対応でした。
aws aidevops help
aws: [ERROR]: An error occurred (ParamValidation): argument command: Found invalid choice 'aidevops'
ということで、AWS CLIからDevOps Agentを扱えるようにサービス定義の自作に挑戦してみました。
環境
今回利用した環境は以下の通りです。
- OS: MacOS 26.3
- AWS CLI: aws-cli/2.34.2 Python/3.13.11 Darwin/25.3.0 exe/arm64
AWS CLIの仕組みをおさらい
AWS CLIは内部的にboto3/botocoreに依存しています。そしてbotocoreはパッケージ内にAWSサービスに関する仕様を定義したJSONファイルを保有しており、このJSONファイルに基づいて各種AWSサービスのAPIを呼び出します。そのため適切なJSONファイルが存在しないAWSサービスについてはAPI操作ができないことになります。
以前以下のブログを執筆したのですが、このブログでは最新のbotocoreからJSONファイルをコピーして、非最新のboto3から最新のAWSサービスを操作しています。
今回操作したいDevOps Agentは2026/3/5時点ではサービス定義のJSONファイルが提供されていないため、自力でDevOps AgentのAPI仕様を解析しながらJSONファイルを作っていきます。
やってみる
それではさっそくやっていきましょう。
DevOps AgentのAPI仕様確認
まずはDevOps AgentのAPI仕様を確認していきます。
ブラウザからDevOps Agentのウェブアプリにアクセスし、Run Bookの一覧を表示してみます。
※余談ですがいつの間にかマネコン上だと「Run Book」は「Skills」に名称変更されたようです。ドキュメントの記載はRun Bookのままだったので、本ブログでは基本的に「Run Book」という呼称を利用します。
開発者ツールを確認するとJSからRun Bookの一覧を取得するAPIを呼び出していることが分かります。

開発者ツールからCopy as cURLすると以下のようなcommandに相当するリクエストを発行しているようです。
curl 'https://dp.aidevops.us-east-1.api.aws/knowledge/agent-space/<エージェントスペースのID>/items/list?knowledgeItemType=RUNBOOK' \
-X 'POST' \
-H 'accept: */*' \
-H 'accept-language: ja,en-US;q=0.9,en;q=0.8' \
-H 'amz-sdk-invocation-id: 7b41fddb-c368-4f96-9759-e1cc3a0a8988' \
-H 'amz-sdk-request: attempt=1; max=3' \
-H 'authorization: AWS4-HMAC-SHA256 Credential=<アクセスキーID>/20260305/us-east-1/aidevops/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=<SigV4の署名>' \
-H 'content-length: 0' \
-H 'origin: https://<エージェントスペースのID>.aidevops.global.app.aws' \
-H 'priority: u=1, i' \
-H 'referer: https://<エージェントスペースのID>.aidevops.global.app.aws/' \
-H 'sec-ch-ua: "Not:A-Brand";v="99", "Google Chrome";v="145", "Chromium";v="145"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: cross-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36' \
-H 'x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' \
-H 'x-amz-date: 20260305T065944Z' \
-H 'x-amz-security-token: <一時トークン>' \
-H 'x-amz-user-agent: aws-sdk-js/0.0.1 ua/2.1 os/macOS lang/js md/browser#Chromium_145 api/cloudsmithdataplane#0.0.1 m/N,E,e'
このリクエストに対するレスポンスは以下でした
{
"knowledgeItems": [
{
"knowledgeItemId": "ki-40c93ec8-6f3a-4075-be49-a4c68744aac8",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "RUNBOOK",
"properties": {
"runbook": {
"title": "Default Run Book",
"description": "Always use this Run Book"
}
},
"version": 2,
"sourceReferences": [],
"createdAt": 1767764986,
"lastModifiedAt": 1767765909,
"lifeCycleStatus": "ACTIVE"
}
]
}
もう1つ類似のリクエストで以下も発行されていました。
curl 'https://dp.aidevops.us-east-1.api.aws/knowledge/agent-space/<エージェントスペースのID>/items/list?knowledgeItemType=SKILL' \
-X 'POST' \
-H 'accept: */*' \
-H 'accept-language: ja,en-US;q=0.9,en;q=0.8' \
-H 'amz-sdk-invocation-id: 7265ba0d-16ee-453b-bd77-13d4b93d2e93' \
-H 'amz-sdk-request: attempt=1; max=3' \
-H 'authorization: AWS4-HMAC-SHA256 Credential=<アクセスキーID>/20260305/us-east-1/aidevops/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=<SigV4の署名>' \
-H 'content-length: 0' \
-H 'origin: https://<エージェントスペースのID>.aidevops.global.app.aws' \
-H 'priority: u=1, i' \
-H 'referer: https://<エージェントスペースのID>.aidevops.global.app.aws/' \
-H 'sec-ch-ua: "Not:A-Brand";v="99", "Google Chrome";v="145", "Chromium";v="145"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: cross-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36' \
-H 'x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' \
-H 'x-amz-date: 20260305T065944Z' \
-H 'x-amz-security-token: <一時トークン>' \
-H 'x-amz-user-agent: aws-sdk-js/0.0.1 ua/2.1 os/macOS lang/js md/browser#Chromium_145 api/cloudsmithdataplane#0.0.1 m/N,E,e'
こちらのレスポンスは以下でした。
{
"knowledgeItems": [
{
"knowledgeItemId": "ki-c1f32902-0107-4098-93e9-569371ae62e9",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "SKILL",
"properties": {
"skill": {
"name": "inactive",
"description": "非アクティブです",
"skillType": "USER",
"agentType": "GENERIC",
"agentTypes": [
"GENERIC"
]
}
},
"version": 3,
"sourceReferences": [],
"createdAt": 1772689564,
"lastModifiedAt": 1772689659,
"lifeCycleStatus": "INACTIVE"
},
{
"knowledgeItemId": "ki-5e1ac8c3-156b-482d-b158-663a51334aba",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "SKILL",
"properties": {
"skill": {
"name": "test",
"description": "test",
"skillType": "USER",
"agentType": "GENERIC",
"agentTypes": [
"GENERIC"
]
}
},
"version": 1,
"sourceReferences": [],
"createdAt": 1772691022,
"lastModifiedAt": 1772691022,
"lifeCycleStatus": "ACTIVE"
},
{
"knowledgeItemId": "ki-fa508885-266c-4611-bd8e-9a1b0722b352",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "SKILL",
"properties": {
"skill": {
"name": "skill",
"description": "これはSkill??",
"skillType": "USER",
"agentType": "GENERIC",
"agentTypes": [
"GENERIC"
]
}
},
"version": 2,
"sourceReferences": [],
"createdAt": 1772689645,
"lastModifiedAt": 1772692304,
"lifeCycleStatus": "ACTIVE"
}
]
}
knowledge/agent-space/<エージェントスペースのID>/items/listというエンドポイントにPOSTメソッドでリクエストを送るとRunBookもしくはSkillの一覧が取得できそうですね。クエリストリングのknowledgeItemTypeでRUNBOOKもしくはSKILLを指定することで取得対象をフィルタできるようです。マネコンの表示がRun Bookの頃に登録したものがRUNBOOKで、マネコン表示がSkillsに変更されて以降に登録したものがSKILLになるのでしょうか?
よく見ると色々とレスポンスの構造も変わっています。
サービス定義のJSONファイルを作成
ある程度API仕様がなんとなく理解できたのでサービス定義のJSONファイルを自作していきます。
まずはJSONを保存するディレクトリを作成します。APIバージョンは不明なので、re:Invent 2025の開催期間に合わせて適当に2025-12-01とします。
mkdir -p ~/.aws/models/aidevops/2025-12-01
続いて上記ディレクトリの配下にエンドポイントを定義するendpoint-rule-set-1.jsonを作成します。
endpoint-rule-set-1.json
{
"version": "1.0",
"parameters": {
"Region": {
"builtIn": "AWS::Region",
"required": false,
"documentation": "The AWS region used to dispatch the request.",
"type": "string"
}
},
"rules": [
{
"conditions": [
],
"rules": [
{
"conditions": [
{
"fn": "isSet",
"argv": [
{
"ref": "Region"
}
]
}
],
"rules": [
{
"conditions": [
{
"fn": "aws.partition",
"argv": [
{
"ref": "Region"
}
],
"assign": "PartitionResult"
}
],
"rules": [
{
"conditions": [
{
"fn": "stringEquals",
"argv": [
{
"fn": "getAttr",
"argv": [
{
"ref": "PartitionResult"
},
"name"
]
},
"aws"
]
}
],
"endpoint": {
"url": "https://dp.aidevops.us-east-1.api.aws",
"properties": {
"authSchemes": [
{
"name": "sigv4",
"signingRegion": "us-east-1"
}
]
},
"headers": {
}
},
"type": "endpoint"
}
],
"type": "tree"
}
],
"type": "tree"
},
{
"conditions": [
],
"error": "Invalid Configuration: Missing Region",
"type": "error"
}
],
"type": "tree"
}
]
}
続いてAPIのパスやパラメータを定義するservice-2.jsonを作成します。
service-2.json
{
"version":"2.0",
"metadata":{
"apiVersion":"2018-05-10",
"auth":["aws.auth#sigv4"],
"endpointPrefix":"dp.aidevops",
"protocol":"rest-json",
"protocols":["rest-json"],
"serviceFullName":"AWS AI DevOps",
"serviceId":"AIDevOps",
"signatureVersion":"v4",
"signingName":"aidevops",
"uid":"aidevops-2018-05-10"
},
"operations":{
"ListItems":{
"name":"ListItems",
"http":{
"method":"POST",
"requestUri":"/knowledge/agent-space/{agentSpaceId}/items/list",
"responseCode":200
},
"input":{"shape":"ListItemsRequest"},
"output":{"shape":"ListItemsResponse"},
"errors":[
{"shape":"AccessDeniedException"},
{"shape":"ForbiddenException"}
]
}
},
"shapes":{
"AccessDeniedException":{
"type":"structure",
"members":{
"message":{"shape":"String"}
},
"error":{
"httpStatusCode":403,
"senderFault":true
},
"exception":true
},
"ForbiddenException":{
"type":"structure",
"members":{
"message":{"shape":"String"}
},
"error":{
"httpStatusCode":403,
"senderFault":true
},
"exception":true
},
"ListItemsResponse": {
"type":"structure",
"members":{
"knowledgeItems":{
"shape":"KnowledgeItems"
}
}
},
"KnowledgeItems": {
"type":"list",
"member":{"shape":"ListItemsModel"}
},
"ListItemsModel":{
"type":"structure",
"members":{
"knowledgeItemId":{
"shape":"KnowledgeItemId"
},
"agentSpaceArn":{
"shape":"AgentSpaceArn"
},
"knowledgeItemType":{
"shape":"KnowledgeItemType"
},
"properties":{
"shape":"KnowledgeItemProperties"
},
"version":{
"shape":"Integer"
},
"createdAt":{
"shape":"Integer"
},
"lastModifiedAt":{
"shape":"Integer"
},
"lifeCycleStatus":{
"shape":"String"
}
}
},
"KnowledgeItemId":{
"type":"string"
},
"AgentSpaceArn":{
"type":"string"
},
"ListItemsRequest": {
"type":"structure",
"required":[
"agentSpaceId"
],
"members":{
"agentSpaceId":{
"shape":"Id",
"location":"uri",
"locationName":"agentSpaceId"
},
"knowledgeItemType":{
"shape":"KnowledgeItemType",
"location":"querystring",
"locationName":"knowledgeItemType"
}
}
},
"Id":{
"type":"string",
"pattern":"[0-9a-zA-Z]{10}"
},
"KnowledgeItemProperties":{
"type": "structure",
"members": {
"runbook": {
"shape": "Runbook"
},
"skill": {
"shape": "Skill"
}
}
},
"Runbook":{
"type": "structure",
"members": {
"title": {
"shape": "String"
},
"description": {
"shape": "String"
}
}
},
"Skill":{
"type": "structure",
"members": {
"name": {
"shape": "String"
},
"description": {
"shape": "String"
},
"skillType": {
"shape": "String"
},
"agentType": {
"shape": "String"
},
"agentTypes": {
"shape": "AgentTypes"
}
}
},
"String":{"type":"string"},
"Integer":{"type":"integer"},
"KnowledgeItemType":{
"type":"string",
"enum":[
"RUNBOOK",
"SKILL"
]
},
"AgentTypes": {
"type": "list",
"member": {
"shape": "String"
}
}
}
}
先程開発者ツールから確認できたリクエスト/レスポンスの構造に合わせて定義しています。各項目の必須/任意や最大桁数などは不明なので、あまり厳密には定義せずに極力"shape": "String"のような緩い定義としています。
必要なJSONファイルは最低限これらの2つになります。その他paginators-1.jsonやwaiters-2.jsonについては今回作成していません。
いざAWS CLIからRun Bookを取得!!
JSONファイルの準備が整ったので、AWS CLIを操作してみましょう。
aws aidevops list-items --agent-space-id <エージェントスペースのID> --region us-east1 --debug
--debugオプションを付与したので、大量のデバッグログが出力されます。ログは以下の通りでした。
デバッグログ
2026-03-05 16:34:08,000 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.34.2 Python/3.13.11 Darwin/25.3.0 exe/arm64
2026-03-05 16:34:08,000 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['aidevops', 'list-items', '--agent-space-id', '<エージェントスペースのID>', '--region', 'us-east1', '--debug']
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_s3 at 0x10d7b6b60>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_ddb at 0x10d4f0540>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.configure.configure.ConfigureCommand'>>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x10d4377e0>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x10d4587c0>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_history_commands at 0x10d653a60>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.devcommands.CLIDevCommand'>>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.login.login.LoginCommand'>>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.login.logout.LogoutCommand'>>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_waiters at 0x10d7c3560>
2026-03-05 16:34:08,027 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x10d7eea50>>
2026-03-05 16:34:08,027 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/data/cli.json
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_types at 0x10d62f060>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function no_sign_request at 0x10d62f380>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_verify_ssl at 0x10d62f2e0>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_read_timeout at 0x10d62f4c0>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_connect_timeout at 0x10d62f420>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <built-in method update of dict object at 0x10d869880>
2026-03-05 16:34:08,028 - MainThread - botocore.session - DEBUG - Setting config variable for region to 'us-east1'
2026-03-05 16:34:08,028 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.34.2 Python/3.13.11 Darwin/25.3.0 exe/arm64
2026-03-05 16:34:08,028 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['aidevops', 'list-items', '--agent-space-id', '<エージェントスペースのID>', '--region', 'us-east1', '--debug']
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x10d7c20c0>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x10c1e4680>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x10d2c5d00>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x10d247ce0>
2026-03-05 16:34:08,028 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x10d2c5260>
2026-03-05 16:34:08,031 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2026-03-05 16:34:08,034 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x10d6522a0>
2026-03-05 16:34:08,034 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x10d4deb60>
2026-03-05 16:34:08,045 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /<ホームディレクトリ>/.aws/models/aidevops/2025-12-01/service-2.json
2026-03-05 16:34:08,046 - MainThread - botocore.hooks - DEBUG - Event building-command-table.aidevops: calling handler <function add_waiters at 0x10d7c3560>
2026-03-05 16:34:08,057 - MainThread - botocore.hooks - DEBUG - Event building-command-table.aidevops: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x10d7eea50>>
2026-03-05 16:34:08,057 - MainThread - awscli.clidriver - DEBUG - OrderedDict({'agent-space-id': <awscli.arguments.CLIArgument object at 0x10d8b1550>, 'knowledge-item-type': <awscli.arguments.CLIArgument object at 0x10d8a5d10>})
2026-03-05 16:34:08,057 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.aidevops.list-items: calling handler <function add_streaming_output_arg at 0x10d7c1760>
2026-03-05 16:34:08,057 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.aidevops.list-items: calling handler <function add_cli_input_json at 0x10d2c65c0>
2026-03-05 16:34:08,057 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.aidevops.list-items: calling handler <function add_cli_input_yaml at 0x10d2c7380>
2026-03-05 16:34:08,057 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.aidevops.list-items: calling handler <function unify_paging_params at 0x10d4f0d60>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.aidevops.list-items: calling handler <function add_generate_skeleton at 0x10d62d940>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.aidevops.list-items: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x10d8b17f0>>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.aidevops.list-items: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x10d8b1940>>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.aidevops.list-items: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x10d8b1a90>>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event building-command-table.aidevops_list-items: calling handler <function add_waiters at 0x10d7c3560>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event building-command-table.aidevops_list-items: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x10d7eea50>>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dp.aidevops.list-items.agent-space-id: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10d7ef4d0>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.aidevops.list-items: calling handler <awscli.argprocess.ParamShorthandParser object at 0x10d7ecd70>
2026-03-05 16:34:08,068 - MainThread - awscli.arguments - DEBUG - Unpacked value of '<エージェントスペースのID>' for parameter "agent_space_id": '<エージェントスペースのID>'
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dp.aidevops.list-items.knowledge-item-type: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10d7ef4d0>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dp.aidevops.list-items.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10d7ef4d0>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dp.aidevops.list-items.cli-input-yaml: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10d7ef4d0>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dp.aidevops.list-items.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10d7ef4d0>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event calling-command.aidevops.list-items: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x10d8b17f0>>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event calling-command.aidevops.list-items: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x10d8b1940>>
2026-03-05 16:34:08,068 - MainThread - botocore.hooks - DEBUG - Event calling-command.aidevops.list-items: calling handler <bound method GenerateCliSkeletonArgument.generate_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x10d8b1a90>>
2026-03-05 16:34:08,069 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2026-03-05 16:34:08,069 - MainThread - botocore.credentials - INFO - Found credentials in environment variables.
2026-03-05 16:34:08,070 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/endpoints.json
2026-03-05 16:34:08,078 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x10c0fe020>
2026-03-05 16:34:08,090 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /<ホームディレクトリ>/.aws/models/aidevops/2025-12-01/endpoint-rule-set-1.json
2026-03-05 16:34:08,090 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/partitions.json
2026-03-05 16:34:08,090 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.aidevops: calling handler <function add_generate_presigned_url at 0x10c0818a0>
2026-03-05 16:34:08,090 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for aidevops via: environment_service
2026-03-05 16:34:08,090 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for aidevops via: environment_global
2026-03-05 16:34:08,090 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for aidevops via: config_service
2026-03-05 16:34:08,090 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for aidevops via: config_global
2026-03-05 16:34:08,090 - MainThread - botocore.configprovider - DEBUG - No configured endpoint found.
2026-03-05 16:34:08,091 - MainThread - botocore.regions - DEBUG - Creating a regex based endpoint for dp.aidevops, us-east1
2026-03-05 16:34:08,092 - MainThread - botocore.endpoint - DEBUG - Setting dp.aidevops timeout as (60, 60)
2026-03-05 16:34:08,092 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.aidevops.ListItems: calling handler <function base64_decode_input_blobs at 0x10d2c5da0>
2026-03-05 16:34:08,092 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.aidevops.ListItems: calling handler <function generate_idempotent_uuid at 0x10c0fe3e0>
2026-03-05 16:34:08,092 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.aidevops.ListItems: calling handler <function _handle_request_validation_mode_member at 0x10c118e00>
2026-03-05 16:34:08,092 - MainThread - botocore.regions - DEBUG - Calling endpoint provider with parameters: {'Region': 'us-east1'}
2026-03-05 16:34:08,092 - MainThread - botocore.regions - DEBUG - Endpoint provider result: https://dp.aidevops.us-east-1.api.aws
2026-03-05 16:34:08,092 - MainThread - botocore.regions - DEBUG - Selecting from endpoint provider's list of auth schemes: "sigv4". User selected auth scheme is: "None"
2026-03-05 16:34:08,092 - MainThread - botocore.regions - DEBUG - Selected auth type "v4" as "v4" with signing context params: {'region': 'us-east-1'}
2026-03-05 16:34:08,093 - MainThread - botocore.hooks - DEBUG - Event before-call.aidevops.ListItems: calling handler <function inject_api_version_header_if_needed at 0x10c0ffec0>
2026-03-05 16:34:08,093 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=ListItems) with params: {'url_path': '/knowledge/agent-space/<エージェントスペースのID>/items/list', 'query_string': {}, 'method': 'POST', 'headers': {'User-Agent': 'aws-cli/2.34.2 md/awscrt#0.31.2 ua/2.1 os/macos#25.3.0 md/arch#arm64 lang/python#3.13.11 md/pyimpl#CPython m/b,Z,g,E cfg/retry-mode#standard md/installer#exe sid/9e6515344981 md/prompt#off md/command#aidevops.list-items'}, 'body': b'', 'url': 'https://dp.aidevops.us-east-1.api.aws/knowledge/agent-space/<エージェントスペースのID>/items/list', 'context': {'client_region': 'us-east1', 'client_config': <botocore.config.Config object at 0x10d8a65d0>, 'has_streaming_input': False, 'auth_type': 'v4', 'unsigned_payload': None, 'auth_options': ['aws.auth#sigv4'], 'signing': {'region': 'us-east-1'}, 'endpoint_properties': {'authSchemes': [{'name': 'sigv4', 'signingRegion': 'us-east-1'}]}}}
2026-03-05 16:34:08,093 - MainThread - botocore.hooks - DEBUG - Event request-created.aidevops.ListItems: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10d8b2660>>
2026-03-05 16:34:08,093 - MainThread - botocore.hooks - DEBUG - Event choose-signer.aidevops.ListItems: calling handler <function set_operation_specific_signer at 0x10c0fe200>
2026-03-05 16:34:08,093 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2026-03-05 16:34:08,093 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/knowledge/agent-space/<エージェントスペースのID>/items/list
host:dp.aidevops.us-east-1.api.aws
x-amz-date:20260305T073408Z
x-amz-security-token:<一時トークン>
host;x-amz-date;x-amz-security-token
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2026-03-05 16:34:08,093 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20260305T073408Z
20260305/us-east-1/aidevops/aws4_request
<ハッシュ値>
2026-03-05 16:34:08,093 - MainThread - botocore.auth - DEBUG - Signature:
<SigV4の署名>
2026-03-05 16:34:08,093 - MainThread - botocore.hooks - DEBUG - Event request-created.aidevops.ListItems: calling handler <bound method UserAgentString.rebuild_and_replace_user_agent_handler of <botocore.useragent.UserAgentString object at 0x10d8a6e90>>
2026-03-05 16:34:08,093 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://dp.aidevops.us-east-1.api.aws/knowledge/agent-space/<エージェントスペースのID>/items/list, headers={'User-Agent': b'aws-cli/2.34.2 md/awscrt#0.31.2 ua/2.1 os/macos#25.3.0 md/arch#arm64 lang/python#3.13.11 md/pyimpl#CPython m/b,Z,g,E cfg/retry-mode#standard md/installer#exe sid/9e6515344981 md/prompt#off md/command#aidevops.list-items', 'X-Amz-Date': b'20260305T073408Z', 'X-Amz-Security-Token': b'<一時トークン>', 'Authorization': b'AWS4-HMAC-SHA256 Credential=<アクセスキーID>/20260305/us-east-1/aidevops/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=<SigV4の署名>', 'Content-Length': '0'}>
2026-03-05 16:34:08,094 - MainThread - botocore.httpsession - DEBUG - Certificate path: /usr/local/aws-cli/awscli/botocore/cacert.pem
2026-03-05 16:34:08,094 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dp.aidevops.us-east-1.api.aws:443
2026-03-05 16:34:09,104 - MainThread - urllib3.connectionpool - DEBUG - https://dp.aidevops.us-east-1.api.aws:443 "POST /knowledge/agent-space/<エージェントスペースのID>/items/list HTTP/1.1" 200 1770
2026-03-05 16:34:09,105 - MainThread - botocore.parsers - DEBUG - Response headers: {'Date': 'Thu, 05 Mar 2026 07:34:08 GMT', 'Content-Type': 'application/json', 'Content-Length': '1770', 'Connection': 'keep-alive', 'x-amz-requestid': '79a5348e-e64c-47b9-b80c-a881a723bba3', 'x-amzn-requestid': '79a5348e-e64c-47b9-b80c-a881a723bba3', 'access-control-allow-origin': '*', 'vary': 'origin, access-control-request-method, access-control-request-headers'}
2026-03-05 16:34:09,105 - MainThread - botocore.parsers - DEBUG - Response body:
b'{"knowledgeItems":[{"knowledgeItemId":"ki-40c93ec8-6f3a-4075-be49-a4c68744aac8","agentSpaceArn":"arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>","knowledgeItemType":"RUNBOOK","properties":{"runbook":{"title":"Default Run Book","description":"Always use this Run Book"}},"version":2,"sourceReferences":[],"createdAt":1767764986,"lastModifiedAt":1767765909,"lifeCycleStatus":"ACTIVE"},{"knowledgeItemId":"ki-c1f32902-0107-4098-93e9-569371ae62e9","agentSpaceArn":"arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>","knowledgeItemType":"SKILL","properties":{"skill":{"name":"inactive","description":"\xe9\x9d\x9e\xe3\x82\xa2\xe3\x82\xaf\xe3\x83\x86\xe3\x82\xa3\xe3\x83\x96\xe3\x81\xa7\xe3\x81\x99","skillType":"USER","agentType":"GENERIC","agentTypes":["GENERIC"]}},"version":3,"sourceReferences":[],"createdAt":1772689564,"lastModifiedAt":1772689659,"lifeCycleStatus":"INACTIVE"},{"knowledgeItemId":"ki-5e1ac8c3-156b-482d-b158-663a51334aba","agentSpaceArn":"arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>","knowledgeItemType":"SKILL","properties":{"skill":{"name":"test","description":"test","skillType":"USER","agentType":"GENERIC","agentTypes":["GENERIC"]}},"version":1,"sourceReferences":[],"createdAt":1772691022,"lastModifiedAt":1772691022,"lifeCycleStatus":"ACTIVE"},{"knowledgeItemId":"ki-fa508885-266c-4611-bd8e-9a1b0722b352","agentSpaceArn":"arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>","knowledgeItemType":"SKILL","properties":{"skill":{"name":"skill","description":"\xe3\x81\x93\xe3\x82\x8c\xe3\x81\xafSkill\xef\xbc\x9f\xef\xbc\x9f","skillType":"USER","agentType":"GENERIC","agentTypes":["GENERIC"]}},"version":2,"sourceReferences":[],"createdAt":1772689645,"lastModifiedAt":1772692304,"lifeCycleStatus":"ACTIVE"}]}'
2026-03-05 16:34:09,107 - MainThread - botocore.hooks - DEBUG - Event needs-retry.aidevops.ListItems: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x10dfcd010>>
2026-03-05 16:34:09,107 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2026-03-05 16:34:09,107 - MainThread - botocore.hooks - DEBUG - Event after-call.aidevops.ListItems: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x10d8b3e00>>
2026-03-05 16:34:09,107 - MainThread - awscli.formatter - DEBUG - RequestId: 79a5348e-e64c-47b9-b80c-a881a723bba3
返却されたレスポンスは以下の通りでした。
{
"knowledgeItems": [
{
"knowledgeItemId": "ki-40c93ec8-6f3a-4075-be49-a4c68744aac8",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "RUNBOOK",
"properties": {
"runbook": {
"title": "Default Run Book",
"description": "Always use this Run Book"
}
},
"version": 2,
"createdAt": 1767764986,
"lastModifiedAt": 1767765909,
"lifeCycleStatus": "ACTIVE"
},
{
"knowledgeItemId": "ki-c1f32902-0107-4098-93e9-569371ae62e9",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "SKILL",
"properties": {
"skill": {
"name": "inactive",
"description": "非アクティブです",
"skillType": "USER",
"agentType": "GENERIC",
"agentTypes": [
"GENERIC"
]
}
},
"version": 3,
"createdAt": 1772689564,
"lastModifiedAt": 1772689659,
"lifeCycleStatus": "INACTIVE"
},
{
"knowledgeItemId": "ki-5e1ac8c3-156b-482d-b158-663a51334aba",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "SKILL",
"properties": {
"skill": {
"name": "test",
"description": "test",
"skillType": "USER",
"agentType": "GENERIC",
"agentTypes": [
"GENERIC"
]
}
},
"version": 1,
"createdAt": 1772691022,
"lastModifiedAt": 1772691022,
"lifeCycleStatus": "ACTIVE"
},
{
"knowledgeItemId": "ki-fa508885-266c-4611-bd8e-9a1b0722b352",
"agentSpaceArn": "arn:aws:aidevops:us-east-1:<AWSアカウントID>:agentspace/<エージェントスペースのID>",
"knowledgeItemType": "SKILL",
"properties": {
"skill": {
"name": "skill",
"description": "これはSkill??",
"skillType": "USER",
"agentType": "GENERIC",
"agentTypes": [
"GENERIC"
]
}
},
"version": 2,
"createdAt": 1772689645,
"lastModifiedAt": 1772692304,
"lifeCycleStatus": "ACTIVE"
}
]
}
無事にAWS CLIからDevOps AgentのAPIが呼び出せました!
レスポンスに含まれる項目とマネコンの表示を見比べると"skillType": "USER"や"agentType": "GENERIC"が気になるところです。今後の機能追加によって他の値が色々増えていくんでしょうかね?今後に期待したいです。
まとめ
ハック的な手法になりますが、AWS CLIからDevOps AgentのRunBook一覧を取得してみました。
あまり役に立つ知識では無いと思いますが、もしbotocoreのバージョンアップに先駆けてAWS CLIから最新のAPIを利用したい場合はこういった手法も利用可能です。
もし必要あれば自己責任の範疇でご利用頂ければと思います。









