はじめに
このブログのシリーズでは、ElasticサンプルデータのKibana Flight Dataの飛行機の離発着履歴データを使い、Elastic WorkflowsとElastic Agent Builderを使ったフライト遅延の調査と原因分析の運用の自動化までの道のりをお伝えします。
前回はフライト遅延に関しての情報をCase(Elasticのチケット機能)に自動的に記録し、その原因分析をElastic Agent Builderで作ったエージェントにて行いました。
本ブログでは、この自動化をもう一歩完成形に近づけます。
- エージェントを一つに統合: これまで実行内容によってエージェントを分けていました。構築中はエージェントを分けたほうがコンテキストが混ざらず、意図した動作になりやすいのですが、最終的にユーザーに使ってもらうときはエージェントが統一されていたほうが当然使いやすいため。
- 類似RCAレポート検索を高度化:これまでレポートテキスト全文に対するセマンティック検索でした。今回はより細かく、アラート名、アラート説明、アラート結果、原因分析結果などの項目毎に分けて適したハイブリッド検索を適用し、類似検索するようにします。
- リファクター:これまでデータ分析とその結果をCaseに記録するのを一つのワークフローで行っていましたが、これを別々に分けました。これによりもっとインタラクティブにエージェントのと会話してから結果をCaseに記録できるようになりました。
本ブログはElastic Cloudでv9.3のElasticデプロイメントを使用しています。本ブログの内容を行うにはEnterpriseサブスクリプションである必要があります。フリートライアルでも試すことが可能です。
過去の記事はこちらのリンクからご参照ください
第1回
第2回
第3回
第4回
第5回
このブログで作成するもの
主なものだけこちらに記載します。今回は作成コンポーネントが多いので、最後に設定コードをまとめて記します。
-
エージェント
flight_rca_integrated_agent_v1
これまで処理目的に応じて別れていたエージェントを一つに統合します -
Elasticsearch index
index_rca_reports_v3とワークフローsearch_similar_rca_reports_v3_semantic
これまで一つのテキストフィールドにレポート全文を格納していました。今回は分析の中で検知されたアラート名、アラート説明、アラート結果、原因分析レポートテキストなど、フィールドを分けて格納します。フィールドに応じてテキスト検索もしくはセマンティック検索を行うRRFハイブリッド検索を行います。 -
ワークフロー
Analyze_flight_anomalyとAnalyze_flight_delayとwrite_flight_alert_to_case
これまでのwrite_flight_delay_to_caseとwrite_flight_anomaly_to_caseのリファクタリングとしてデータ検索部分とCase書き込み部分を分けました。
ここまでの呼び出しフロー
| 今回の変更部分 | トリガー | 呼び出しフロー |
|---|---|---|
| エージェント統合 | チャットで特定の日付と空港の調査を依頼 | Agent flight_rca_integrated_agent_v1 --> Workflow Analyze_flight_delay
|
| エージェント統合 | チャットで特定の日付と空港のML異常のデータ調査を依頼 | Agent flight_rca_integrated_agent_v1 --> Workflow Analyze_flight_anomaly
|
| 今回作成 | チャットで実行したデータ調査結果をCaseに記録を依頼 | Agent flight_rca_integrated_agent_v1 --> Workflow write_flight_alert_to_case
|
| エージェント統合 | チャットでオープンなCaseのリストの表示を依頼 | Agent flight_rca_integrated_agent_v1 --> Agent Tool platform.core.cases
|
| エージェント統合 | チャットで特定の日付と空港のCaseに対する原因分析を依頼 | Agent flight_rca_integrated_agent_v1 --> Workflow write_comment_to_case
|
| エージェント統合 | チャットで今回のと類似のレポートの検索を依頼 | Agent flight_rca_integrated_agent_v1 --> Workflow search_similar_rca_reports
|
| エージェント統合 | チャットで今回のレポートを保存を依頼 | Agent flight_rca_integrated_agent_v1 --> Workflow index_update_rca_reports
|
※ AgentがWorkflowを呼び出すには、間にそれぞれのWorkflow実行用のAgent Toolが必要ですが、冗長になるので上記からは省いています。
実装:レポート保存 Index rca_reports_v3
これまでのrca_reportsではreport_description_[semantic/ja]、の実質一つのテキスト項目でした。v3ではreport_description, alert_rule_names, alert_rule_descriptions, alert_result_summariesなど分けてそれぞれ分けて検索できるようにしています。
PUT rca_reports_v3
{
"mappings": {
"dynamic": "strict",
"properties": {
"case_id": {
"type": "keyword"
},
"case_title": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"case_link": {
"type": "keyword",
"index": false
},
"report_description_ja": {
"type": "text"
},
"report_description_semantic": {
"type": "semantic_text",
"inference_id": ".jina-embeddings-v3"
},
"alert_rule_names": {
"type": "text",
"fields": { "keyword": { "type": "keyword", "ignore_above": 256 } }
},
"alert_rule_descriptions": {
"type": "semantic_text",
"inference_id": ".jina-embeddings-v3",
"chunking_settings": { "strategy": "none" }
},
"alert_result_summaries": {
"type": "semantic_text",
"inference_id": ".jina-embeddings-v3",
"chunking_settings": { "strategy": "none" }
},
"created_at": { "type": "date" },
"updated_at": { "type": "date" }
}
}
}
実装:ワークフローindex_update_rca_reports_v3とそのAgent Tool index_rca_reports_v3
エージェントがCaseにかかれているテキストの内容を元に、うまく上記のIndexの形としてレポートデータを保存できるかが鍵です。保存実行するこのワークフローに対して、エージェントのLLMが柔軟かつ適切にinputsを設定してくれるようにします。
version: "1"
name: index_update_rca_reports_v3
description: This will index RCA reports. If the case_id report exist it will update it.
enabled: true
triggers:
- type: manual
inputs:
- name: case_id
required: true
type: string
- name: case_title
required: true
type: string
- name: case_link
required: true
type: string
- name: rca_report_description
required: true
type: string
- name: alert_rule_names
required: true
type: array
- name: alert_rule_descriptions
required: true
type: array
- name: alert_result_summaries
required: true
type: array
steps:
- name: index_update_rca_report
type: elasticsearch.request
with:
method: POST
path: /rca_reports_v3/_doc/{{ inputs.case_id}}
body:
case_id: "{{ inputs.case_id}}"
case_title: "{{ inputs.case_title}}"
case_link: "{{ inputs.case_link}}"
report_description_ja: "{{ inputs.rca_report_description}}"
report_description_semantic: "{{ inputs.rca_report_description}}"
alert_rule_names: ${{ inputs.alert_rule_names}}
alert_rule_descriptions: ${{ inputs.alert_rule_descriptions}}
alert_result_summaries: ${{ inputs.alert_result_summaries}}
Agent Tool index_rca_reports_v3です。Descriptionに動作の仕様を記述しますが、今回は割とシンプルな感じでもうまくいきました。

実装:エージェントflight_rca_integrated_agent_v1
今までのエージェントの動きを一つのエージェントに統合する目的のこちらのエージェントを新規作成します。この全コードは最後に記しています。

flight_rca_integrated_agent_v1に登録するエージェントTool
一部はこの後のステップで作成するToolなので、実際はそれらを作成してから登録可能となります。
- platform.core.get_workflow_execution_status
- index_rca_reports_v3
- search_similar_rca_reports_v3
- write_comment_to_case
- platform.core.cases
- write_flight_case_comment
- analyze_flight_delay
- analyze_flight_anomaly
- write_flight_alert_to_case
どのようなユーザーとのやり取りで、どのToolを呼び出すかのコントロールはプロンプトエンジニアリングで対応します。
このCustom Instructionsのプロンプトの作成には自分の生成AIを使って書いてもらっています。(さすがに自分でこれを書くのは辛い)
動作確認
別の空港調査で、複数のステップを一気に実行。最後の類似検索も。

全コード
v9.3.0で動作確認済みです。WorkflowsはまだTechPreviewで今後仕様変わる可能性あるので、異なるバージョンでは正しく動作しない場合があります。
ワークフロー定義
Workflowsを開き、エディターから以下をそれぞれコピーペーストして作成してください。
Write flight alert to case
name: Write flight alert to case
enabled: true
description: This will add comment to the corresponding titled case based on
city name, date.
triggers:
- type: manual
inputs:
- name: city_name
type: string
required: true
- name: date
type: string
required: true
description: "Expected format: YYYY-MM-DD"
- name: alert_name
type: string
required: true
- name: alert_description
type: string
required: true
- name: alert_result_comment
type: string
required: true
consts:
search_parameter: "+{{ inputs.city_name }} +{{ inputs.date | date: '%Y/%m/%d' }}"
search_parameter_encoded: ${{consts.search_parameter}} | url_encode
steps:
- name: search_parameter_encoded
type: console
with:
message: |
{% assign keyword = inputs.city_name %}
{% assign date = inputs.date | date: '%Y/%m/%d' %}
{% assign query = "+" | append: keyword | append: "+" | append: '"' | append: date | append: '"' %}
{{ query | url_encode }}
- name: check_existing_case
type: kibana.request
with:
method: GET
path: /api/cases/_find?defaultSearchOperator=AND&searchFields=title&search={{
steps.search_parameter_encoded.output }}
- name: create_new_case_if_none
type: if
condition: "steps.check_existing_case.output.total: 0"
steps:
- name: create_new_case
type: kibana.createCaseDefaultSpace
with:
connector:
fields: null
id: none
name: none
type: .none
description: |
目的:フライトのキャンセル及び大幅な遅延をまとめ、日毎のレポートを作成し、後に参照できるように記録する 対象日付:{{ inputs.date | date: '%Y/%m/%d' }} 対象空港:{{ inputs.city_name }}
owner: observability
settings:
syncAlerts: true
severity: medium
tags: []
title: "{{ inputs.city_name }} {{ inputs.date | date: '%Y/%m/%d' }}
のフライト遅延とキャンセル"
- name: case_id
type: console
with:
message: "{% if steps.check_existing_case.output.total == 0 %}{{
steps.create_new_case.output.id }}{% else %}{{
steps.check_existing_case.output.cases[0].id }}{%endif%}"
- name: add_comment_to_case
type: kibana.request
with:
method: POST
path: /api/cases/{{ steps.case_id.output }}/comments
body:
type: user
owner: observability
comment: |
アラートルール名:{{ inputs.alert_name }}
アラートルール説明:{{ inputs.alert_description }}
アラート内容:{{ inputs.alert_result_comment }}
- name: output_success
type: console
with:
message: |
レポートがCase Id: [{{steps.case_id.output}}]({{ kibanaUrl }}/app/observability/cases/{{steps.case_id.output}}) に追加されました。
Analyze_flight_delay
version: "1"
name: Analyze_flight_delay
description: Analyze flight delay by ES|QL
enabled: true
triggers:
- type: manual
inputs:
- name: city_name
type: string
- name: date
type: string
steps:
- name: execute_esql
type: elasticsearch.esql.query
with:
query: |
FROM kibana_sample_data_flights | WHERE timestamp >= "{{ inputs.date }}T00:00:00+0900" AND timestamp < "{{ inputs.date }}T00:00:00+0900" + 1 day | WHERE OriginCityName == "{{ inputs.city_name }}" OR DestCityName == "{{ inputs.city_name }}" | WHERE Cancelled == true OR (FlightDelay == true AND FlightDelayMin >= 60) | KEEP timestamp, Cancelled, FlightDelay, OriginCityName, DestCityName, Carrier, FlightDelayType, FlightDelayMin, OriginWeather, DestWeather
format: json
- name: format_output
type: if
condition: steps.execute_esql.output.documents_found > 0
steps:
- name: transform_output_by_ai
type: kibana.request
with:
method: POST
path: /api/agent_builder/converse
body:
connector_id: OpenAI-GPT-4-1-Mini
agent_id: flight_analyzer_agent_2
input: |
次のデータをCaseに追記するコメントに変換してください。
アラートルール名: write_flight_delay_to_case_v2
アラートルールの説明:該当都市を出発もしくは到着するフライトがキャンセルもしくは遅延が60分以上の場合のデータを確認
アラート結果:
{{steps.execute_esql.output | json}}
else:
- name: output_no_result
type: console
with:
message: No data found for {{ inputs | json }}
- name: output_success
type: if
condition: steps.execute_esql.output.documents_found > 0
steps:
- name: log_output
type: console
with:
message: "{{ steps.transform_output_by_ai.output.response.message }}"
Analyze_flight_anomaly
version: "1"
name: Analyze_flight_anomaly
description: Analyze Anomaly Detection result for a specific date and city
enabled: true
triggers:
- type: manual
inputs:
- name: city_name
type: string
- name: date
type: string
consts:
job_id: flight_delay_anomalies
steps:
- name: get_anomaly_job_config
type: elasticsearch.request
with:
method: GET
path: _ml/anomaly_detectors/{{consts.job_id}}
- name: execute_esql
type: elasticsearch.esql.query
with:
query: |
FROM .ml-anomalies-{{steps.get_anomaly_job_config.output.jobs[0].results_index_name}}-*
| WHERE job_id == "{{consts.job_id}}" AND result_type == "influencer" AND influencer_field_name == "OriginCityName" AND OriginCityName == "{{ inputs.city_name }}"
| WHERE @timestamp >= "{{ inputs.date }}T00:00:00+0900" AND @timestamp < "{{ inputs.date }}T00:00:00+0900" + 1 day
| KEEP @timestamp, job_id, result_type, anomaly_score, influencer_field_name, influencer_score
| SORT @timestamp ASC
| LIMIT 100
format: json
- name: format_output
type: if
condition: steps.execute_esql.output.documents_found > 0
steps:
- name: transform_output_by_ai
type: kibana.request
with:
method: POST
path: /api/agent_builder/converse
body:
connector_id: Google-Gemini-2-5-Flash
agent_id: flight_analyzer_agent_2
input: |
次のデータをCaseに追記するコメントに変換してください。
アラートルール名: {{consts.job_id}}
アラートルールの説明:{{steps.get_anomaly_job_config.output.jobs[0].description}}
アラート結果:
{{steps.execute_esql.output | json}}
else:
- name: output_no_result
type: console
with:
message: No data found for {{ inputs | json }}
- name: output_success
type: if
condition: steps.execute_esql.output.documents_found > 0
steps:
- name: log_output
type: console
with:
message: "{{ steps.transform_output_by_ai.output.response.message }}"
search_similar_rca_reports_v3_semantic
version: "1"
name: search_similar_rca_reports_v3_semantic
description: This will search similar RCA reports
enabled: true
triggers:
- type: manual
inputs:
- name: own_case_id
description: Use this to exlucde own case from being searched as similar reports
required: false
type: string
steps:
- name: get_base_case_report
type: elasticsearch.request
with:
method: "GET"
path: "/rca_reports_v3/_search"
body:
{ "size": 1,
"query": {
"term": {
"case_id": {
"value": "{{inputs.own_case_id}}"
}
}
}
}
- name: search_esql
type: elasticsearch.esql.query
with:
query: >
FROM rca_reports_v3 METADATA _id, _index, _score
| WHERE case_id != "{{ inputs.own_case_id | default: ''}}"
| FORK
(WHERE alert_result_summaries: {{steps.get_base_case_report.output.hits.hits[0]._source.alert_result_summaries | json}} | SORT _score DESC | LIMIT 5)
(WHERE alert_rule_names: {{steps.get_base_case_report.output.hits.hits[0]._source.alert_rule_names | json}} | SORT _score DESC | LIMIT 5)
(WHERE alert_rule_descriptions: {{steps.get_base_case_report.output.hits.hits[0]._source.alert_rule_descriptions | json}} | SORT _score DESC | LIMIT 5)
| FUSE
| KEEP case_id, case_title, case_link, alert_result_summaries, alert_rule_names,alert_rule_descriptions, _score
| SORT _score DESC
| LIMIT 5
format: json
index_update_rca_reports_v3
version: "1"
name: index_update_rca_reports_v3
description: This will index RCA reports. If the case_id report exist it will update it.
enabled: true
triggers:
- type: manual
inputs:
- name: case_id
required: true
type: string
- name: case_title
required: true
type: string
- name: case_link
required: true
type: string
- name: rca_report_description
required: true
type: string
- name: alert_rule_names
required: true
type: array
- name: alert_rule_descriptions
required: true
type: array
- name: alert_result_summaries
required: true
type: array
steps:
- name: index_update_rca_report
type: elasticsearch.request
with:
method: POST
path: /rca_reports_v3/_doc/{{ inputs.case_id}}
body:
case_id: "{{ inputs.case_id}}"
case_title: "{{ inputs.case_title}}"
case_link: "{{ inputs.case_link}}"
report_description_ja: "{{ inputs.rca_report_description}}"
report_description_semantic: "{{ inputs.rca_report_description}}"
alert_rule_names: ${{ inputs.alert_rule_names}}
alert_rule_descriptions: ${{ inputs.alert_rule_descriptions}}
alert_result_summaries: ${{ inputs.alert_result_summaries}}
write_comment_to_case
version: "1"
name: write_comment_to_case
description: A generic workflow to write to case comments. To be used by Agents or other Workflows.
enabled: true
tags:
- draft
settings:
timeout: 1m
triggers:
- type: manual
inputs:
- name: case_id
type: string
required: true
- name: comment
type: string
required: true
steps:
- name: write_comment_to_case
type: kibana.request
with:
method: POST
path: /api/cases/{{ inputs.case_id }}/comments
body:
type: user
owner: observability
comment: "{{ inputs.comment }}"
Index
Dev ToolsにペーストしてAPIを実行してください
PUT rca_reports_v3
{
"mappings": {
"dynamic": "strict",
"properties": {
"case_id": {
"type": "keyword"
},
"case_title": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"case_link": {
"type": "keyword",
"index": false
},
"report_description_ja": {
"type": "text"
},
"report_description_semantic": {
"type": "semantic_text",
"inference_id": ".jina-embeddings-v3"
},
"alert_rule_names": {
"type": "text",
"fields": { "keyword": { "type": "keyword", "ignore_above": 256 } }
},
"alert_rule_descriptions": {
"type": "semantic_text",
"inference_id": ".jina-embeddings-v3",
"chunking_settings": { "strategy": "none" }
},
"alert_result_summaries": {
"type": "semantic_text",
"inference_id": ".jina-embeddings-v3",
"chunking_settings": { "strategy": "none" }
},
"created_at": { "type": "date" },
"updated_at": { "type": "date" }
}
}
}
Agent Tools
Dev ToolsにペーストしてそれぞれのAPIを実行してください。
POST kbn://api/agent_builder/tools
{
"id": "write_flight_case_comment",
"type": "workflow",
"description": """Writes a flight analysis as comment to a case.
This requires a city name, date of the target analysis.
A case will be created for the specified city and date if it does not exist.
If a case exists, it will use that case.""",
"tags": [],
"configuration": {
"workflow_id": "workflow-ac2153ef-4dd2-4d77-b979-738e4530e7a2",
"wait_for_completion": true
}
}
POST kbn://api/agent_builder/tools
{
"id": "index_rca_reports_v3",
"type": "workflow",
"description": """RCAレポートを保存し、Elasticsearchにインデックスします。情報が足りない場合、何が足りないかを返します。
アラートの情報はアラートの数の分の名前、説明、サマリー専用の配列として格納します。""",
"tags": [],
"configuration": {
"workflow_id": "workflow-a0555332-537c-4d4a-ad19-092bed774dec",
"wait_for_completion": true
}
}
POST kbn://api/agent_builder/tools
{
"id": "search_similar_rca_reports_v3",
"type": "workflow",
"description": """RCAレポートの文章のCase IDを与えると、それに類似したレポートの情報を返します。
""",
"tags": [],
"configuration": {
"workflow_id": "workflow-a0365432-6b6b-40bf-b6ee-f6462f8ebe42",
"wait_for_completion": true
}
}
POST kbn://api/agent_builder/tools
{
"id": "write_comment_to_case",
"type": "workflow",
"description": "Case IDとそのCaseに追加するコメントのテキストを渡すとそのCaseを更新します。",
"tags": [],
"configuration": {
"workflow_id": "workflow-ac2153ef-4dd2-4d77-b979-738e4530e7a2",
"wait_for_completion": true
}
}
POST kbn://api/agent_builder/tools
{
"id": "write_flight_alert_to_case",
"type": "workflow",
"description": """ケースに対して、フライトアラート情報をコメントとして書き込みます。
これには、対象となる分析の都市名と日付が必要です。
指定された都市と日付のケースが存在しない場合は、新しく作成されます。
既にケースが存在する場合は、そのケースが使用されます。""",
"tags": [],
"configuration": {
"workflow_id": "workflow-799752a3-d060-4f72-8ca8-00d34346b526",
"wait_for_completion": true
}
}
POST kbn://api/agent_builder/tools
{
"id": "analyze_flight_delay",
"type": "workflow",
"description": "Checks the flight delay with ES|QL.",
"tags": [],
"configuration": {
"workflow_id": "workflow-7f77a486-48cf-4cd3-8209-fc1e4ab3ee87",
"wait_for_completion": true
}
}
POST kbn://api/agent_builder/tools
{
"id": "analyze_flight_anomaly",
"type": "workflow",
"description": """This will check the Anomaly Detection data for anomalies in flight data.
The output from the workflow should be directly responded to the user as-is.""",
"tags": [],
"configuration": {
"workflow_id": "workflow-8d52fcb6-9b16-495a-ad67-7c1591bb358c",
"wait_for_completion": true
}
}
Agents
Dev ToolsにペーストしてそれぞれのAPIを実行してください。
POST kbn://api/agent_builder/agents
{
"id": "flight_analyzer_agent_2",
"name": "flight_analyzer_agent_2",
"description": """アラートルールの名前と説明、そのアラートデータを受け取り、以下のフォーマットでコメントします。
* アラートルール名:
* アラートルールの説明:
* アラートデータのAIサマリー: """,
"labels": [],
"avatar_color": "",
"avatar_symbol": "",
"configuration": {
"instructions": """あなたはデータアナリストです。
アラートルールの名前と説明、そのアラートデータを受け取り、以下のフォーマットでコメントします。
* アラートルール名:
* アラートルールの説明:
* アラートデータのAIサマリー:
""",
"tools": []
}
}
POST kbn://api/agent_builder/agents
{
"id": "flight_rca_integrated_agent_v1",
"name": "flight_rca_integrated_agent_v1",
"description": """本エージェントは、フライトの遅延・キャンセルに関するインシデント対応を効率化するために設計された、調査・記録・原因分析(RCA)・ナレッジ化を一体化した運用支援AIです。
""",
"labels": [],
"avatar_color": "",
"avatar_symbol": "",
"configuration": {
"instructions": """🎯 目的(Mission)
本エージェントは、フライト遅延・キャンセルに関する
調査(Analysis)と Case管理・RCA(Documentation)を分離した安全な運用支援アシスタントです。
本エージェントは以下を支援します:
1️⃣ フライトデータの分析(読み取り専用)
2️⃣ 必要に応じた Case 記録(ユーザー指示ベース)
3️⃣ RCA分析の作成
4️⃣ ナレッジとしての保存・再利用
⸻
🔎 設計思想(重要)
分析と書き込みは明確に分離されています。
• 分析系Tool → 常に安全(自動実行可能)
• 書き込み系Tool → 必ずユーザー明示指示が必要
⸻
🧩 ユーザーが実行できるアクション一覧
本エージェントは以下のアクションを提供します。
アクションのTool実行の結果はそのままユーザーに返してください。
⸻
✈️ アクションA:フライト遅延・キャンセルの分析(実績ベース)
目的:
実際のフライト遅延・キャンセル状況を確認。
使用Tool:
analyze_flight_delay
内容:
• ES|QL による実データ検索
• 遅延・キャンセル便の実態把握
• Caseには書き込まない(分析のみ)
⸻
📈 アクションB:異常検知結果の分析(MLベース)
目的:
異常検知モデルが検出した異常の確認。
使用Tool:
analyze_flight_anomaly
内容:
• 異常検知スコア・検知内容の取得
• Caseには書き込まない(分析のみ)
⸻
📝 アクションC:分析結果をCaseへ記録(ユーザー指示時のみ)
使用Tool:
write_flight_alert_to_case
必要パラメータ:
• city
• date
仕様:
• 指定都市+日付のCaseを自動特定
• 存在しない場合は新規作成
• 存在する場合は既存Caseへ追記
⸻
📂 アクションD:既存Case検索
使用Tool:
platform.core.cases
⸻
🔎 アクションE:CaseベースのRCA分析(読み取り)
Case情報から原因分析を生成(保存しない)。
⸻
📚 アクションF:RCAナレッジ保存(ユーザー承認後)
使用Tool:
index_rca_reports_v3
⸻
🔍 アクションG:類似RCA検索
使用Tool:
search_similar_rca_reports_v3
⸻
⚠️ 分析と記録の違い(必ず理解すること)
操作 Tool 自動実行可否
分析(読むだけ) analyze_flight_delay / analyze_flight_anomaly ✅ 自動実行OK
Case記録 write_flight_case_comment ❌ 指示必須
RCA保存 index_rca_reports_v3 ❌ 承認必須
⸻
🔒 書き込み操作のルール(MANDATORY)
以下はユーザーが明示的に依頼した場合のみ実行可能:
• write_flight_case_comment
• index_rca_reports_v3
⸻
❗ 書き込み前の必須確認
以下の内容をCaseへ記録します:
対象都市:
対象日:
記録内容:
(分析結果の要約)
Caseが存在しない場合は新規作成されます。
実行してよろしいですか?
「はい」または「承認」と入力してください。
⸻
❓ ユーザー意図が曖昧な場合の質問
実行したい内容を選択してください:
1. フライト遅延・キャンセルの状況を分析する(記録しない)
2. 異常検知結果を分析する(記録しない)
3. 分析結果をCaseへ記録する
4. RCA分析を実施する
⸻
📊 RCA分析ルール
原因カテゴリは必ず1つ:
• 天候
• システムトラブル
• 機材トラブル
• その他
推測は禁止。
情報不足は「不明」と記載。
⸻
🧾 RCA出力フォーマット(固定)
# RCAレポート
対象空港:
対象日:
概要:
影響を受けた便名:
原因のカテゴリ:
異常検知の有無:
異常検知ジョブ名:
異常検知スコア:
⸻
## 次アクション提示ルール(CONTEXTUAL SUGGESTION)
次アクションの一覧は、必要な場合のみ提示してください。
毎回表示してはいけません。
提示してよいのは次の状況のみ:
1. 分析結果・RCA結果など、1つの作業が完了した直後
2. ユーザーが次に何をすべきか判断できない可能性がある場合
3. 複数の実行可能な選択肢が存在する場合
4. ユーザーが「次は?」「どう進める?」と尋ねた場合
5. 「こんにちは」やそれ以外関係のない言葉を受け取った場合
以下の場合は提示してはいけません:
- 単純な質問への回答時
- 分析途中の説明中
- 書き込み確認待ちの状態
- ユーザーから明確な次の指示がある場合
- 雑談・補足説明
- エラー返答や再入力待ち
提示する場合も、簡潔な1〜5個の選択肢に限定してください。
メニュー形式の常時表示は禁止します。
次に実行できます:
1. 遅延・キャンセル実績をさらに分析する
2. 異常検知結果を確認する
3. この分析結果をCaseへ記録する(指示が必要)
4. RCA分析を実施する
5. RCAをナレッジとして保存する(承認が必要)
6. 類似インシデントを検索する
⸻
🛑 Tool実行前の入力検証ルール(PARAMETER VALIDATION)
Toolが必要とする必須パラメータがユーザーから提供されていない場合、
Toolを実行してはいけません。
不足している情報をユーザーに確認し、すべて揃うまで実行を保留してください。
⸻
❌ 禁止事項
以下は禁止です:
• 推測で値を補完する
• 既存文脈から曖昧に解釈して実行する
• デフォルト値を勝手に設定する
• 不完全なままToolを呼び出す
• 「とりあえず実行してエラーを見る」行為
⸻
✅ 必須動作
1️⃣ Toolに必要な必須パラメータを確認
2️⃣ 不足が1つでもあれば実行を停止
3️⃣ ユーザーへ不足項目を明確に要求
4️⃣ 全て揃った後にのみToolを実行
⸻
📋 不足確認の問い合わせテンプレート
この操作を実行するために、次の情報が必要です:
- (不足している項目名)
情報を入力してください。
すべて揃い次第、処理を実行します。
⸻
📌 例:write_flight_case_comment の場合
必須パラメータ:
• city
• date
不足している場合:
Caseへ記録するには以下の情報が必要です:
- 対象の都市名(例:Paris)
- 対象日(YYYY-MM-DD)
これらを指定してください。
⸻
📌 分析Toolでも同様に適用
以下のToolにも同じ検証を適用:
• analyze_flight_delay
• analyze_flight_anomaly
• write_flight_case_comment
• index_rca_reports_v3
• search_similar_rca_reports_v3
⸻
🎯 このルールの目的
• 誤った都市・日付での分析防止
• 意図しないCase生成の防止
• 運用データの正確性確保
• 「AIの推測実行」を完全排除
⸻
🧠 エージェントの振る舞い(重要)
本エージェントは
「入力が揃うまで動かない、安全側に倒す設計」
を原則とします。
不足がある状態では、処理を進めるよりも
ユーザーへの確認を優先してください。
⸻
""",
"tools": [
{
"tool_ids": [
"platform.core.get_workflow_execution_status",
"index_rca_reports_v3",
"search_similar_rca_reports_v3",
"write_comment_to_case",
"platform.core.cases",
"write_flight_case_comment",
"analyze_flight_delay",
"analyze_flight_anomaly",
"write_flight_alert_to_case"
]
}
]
}
}
なお、ML Anomaly Detectionの定義は上記に含まれないので、こちらの設定に関しては第5回のブログをご覧ください。
おわり





