# 予測分析エージェントのカスタマイズ

> 予測分析エージェントのカスタマイズ - ERCOTの予測分析アプリケーションで使用されるAIエージェントの動作をカスタマイズするための基本ステップ。

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-30T11:40:01.681379+00:00` (UTC).

## Primary page

- [予測分析エージェントのカスタマイズ](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [前提条件](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#prerequisites): In-page section heading.
- [エージェントエクスペリメントの設定](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#set-up-for-agent-experimentation): In-page section heading.
- [1. ログインしてワークベンチに移動する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#1-log-in-and-navigate-to-workbench): In-page section heading.
- [2. Codespaceの作成](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#2-create-a-codespace): In-page section heading.
- [3. Codespaceにファイルをロードする](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#3-load-files-to-the-codespace): In-page section heading.
- [4. ターミナルセッションを開始する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#4-start-a-terminal-session): In-page section heading.
- [5. エージェントのデプロイ](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#5-deploy-the-agent): In-page section heading.
- [6. APIキーの作成](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#6-create-an-api-key): In-page section heading.
- [7. アプリケーションに接続する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#7-connect-to-the-application): In-page section heading.
- [8. ベースラインエージェントのテスト](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#8-test-the-baseline-agent): In-page section heading.
- [9. エージェントのYAMLを開く](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#open-the-agent-yaml): In-page section heading.
- [エージェントを使ったエクスペリメント](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#experiment-with-the-agent): In-page section heading.
- [エージェントの新しいバージョンを作成する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#create-new-agent-versions): In-page section heading.
- [変更内容の保存とパブリッシュ](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#save-and-publish-changes): In-page section heading.
- [更新されたエージェントを登録する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#register-the-updated-agent): In-page section heading.
- [新しいバージョンに置き換える](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#replace-with-the-new-version): In-page section heading.
- [新しいエージェントをテストする](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#test-the-new-agent): In-page section heading.
- [エクスペリメント例](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#samples-for-experimenting): In-page section heading.
- [エクスペリメントA：agentsセクションを変更する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#experiment-a-change-the-agents-section): In-page section heading.
- [エクスペリメントB：分析の深さを調整する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#experiment-b-adjust-the-analysis-depth): In-page section heading.
- [エクスペリメントC：新しいデータソースを追加する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#experiment-c-add-new-data-sources): In-page section heading.
- [エクスペリメントD：出力構造を変更する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#experiment-d-change-the-output-structure): In-page section heading.
- [エクスペリメントE：推論の枠組みを追加する](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#experiment-e-add-a-reasoning-framework): In-page section heading.

## Documentation content

このハウツーでは、ERCOTの予測分析アプリケーションで使用されるAIエージェントの動作をカスタマイズする方法について説明します。 アプリはすでにデプロイされ、実行されています。独自のパーソナルエージェントを接続し、DataRobot UIでYAML設定を直接変更します。

**ERCOTとは？**

ERCOTとは、Electric Reliability Council of Texas（テキサス電気信頼性評議会）のことです。 テキサス州の電力網における電力需要と発電量を予測するために使用される包括的な予測およびデータ分析システムです。 エネルギー取引業者、電力会社、系統運用者、市場参加者が、発電の調整、エネルギー取引、容量計画、系統信頼性管理に関する意思決定を行う際に役立つ、短期、中期、長期の予測データを提供します。

このワークフローにより、YAMLファイルをローカルで編集する必要がなくなります。 設定の変更はすべて、エージェントのデプロイ後にDataRobotのカスタムモデルインターフェイスで実行されます。 DataRobotの [エージェントワークフロー](https://docs.datarobot.com/ja/docs/agentic-ai/index.html.md) の詳細をご確認ください。

この基本ステップを終了すると、以下の作業が完了します。

- DataRobotにAIエージェントをデプロイ。
- DataRobot UIでエージェントの動作を変更。
- ロール、ゴール、トーン、構造、データソースをカスタマイズ。
- 推論ロジックを追加。
- UIベースのYAMLの編集内容を使用するようにデプロイを更新。
- エージェントの各バージョンをテストおよび比較。
- デプロイIDを使用してカスタムエージェントをアプリケーションに接続。

#### 前提条件

ワークショップに先立ち、DataRobotでは以下の準備が完了しています。

- ERCOTの予測分析アプリケーションをデプロイおよび共有。
- エージェントテンプレートリポジトリのクローンを作成。
- サンプルデータの準備とツールの設定。

エージェントテンプレートをダウンロードします。

[デモデータをダウンロード](https://datarobot-doc-assets.s3.us-east-1.amazonaws.com/newsanalystagent.zip)

## エージェントエクスペリメントの設定

はじめに、ダウンロードしたエージェントテンプレートファイルを解凍します。

### 1. ログインしてワークベンチに移動する

DataRobotにログインします。ホームページが表示されます。

ワークベンチに移動し、新しいユースケースを作成します。

「Agents in the AM」という名前を付けます。

### 2. Codespaceの作成

ユースケースの開始ページから、 ノートブックとcodespace をクリックしてCodespacesに移動します。

次に、クリックして新しいcodespaceを作成します。

そして、新しいセッションを開始します。

### 3. Codespaceにファイルをロードする

セッションが初期化されたら、 [前提条件](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#prerequisites) の一部としてダウンロードされた、解凍済みの `newsanalystagent` という名前のファイルフォルダーをドラッグアンドドロップします。

### 4. ターミナルセッションを開始する

ターミナル タイルをクリックして、Codespaceでターミナルセッションを開始します。

エージェントのフォルダーに移動します。

```
cd newsanalystagent 
```

### 5. エージェントのデプロイ

デプロイと監視の準備として、エージェントをレジストリワークショップに送ります。 以下の手順を実行します。

`newsanalystagent` から、以下を実行します。

1. task deployを実行して、エージェントをレジストリに送ります。 (.venv)[notebooks@kernel~/storage/newsanalystagent]$taskdeployRunningpulumiupwith[DEPLOY]modeUsingCPython3.11.14interpreterat:/usr/bin/python3Creatingvirtualenvironmentat:.venvBuiltpulumi-datarobot==0.10.24Installed84packagesin151msPleasechooseastack,orcreateanewone:[Usearrowstomove,typetofilter]><createanewstack>
2. Enterを押して、新しいPulumiスタックを作成します。
3. agent_in_the_am_<LASTNAME>などのスタック名を入力し、Enterを押します。
4. プロンプトが表示されたら、はいを選択してPulumiのアップデートを承認し、実行します。 この処理には3～5分ほどかかるため、その間にエージェントをPOCから本番環境に移行する方法について確認することをお勧めします。

これらの手順では、以下のことが行われます。

- Pulumiによりエージェントコードがパッケージ化される。
- DataRobotでカスタムモデルが作成される。
- DataRobotでデプロイが作成され（3～5分）、デプロイIDが返される。

デプロイIDを保存します。次の手順で必要になります。

### 6. APIキーの作成

ユーザーアイコンをクリックし、 [APIのキーとツール](https://docs.datarobot.com/ja/docs/platform/acct-settings/api-key-mgmt.html.md#api-keys-and-tools) に移動して、APIキーの作成と管理ができる領域にアクセスします。

新しいAPIキーを生成し、 `Agents in the AM` という名前を付けます。

### 7. アプリケーションに接続する

所要時間：5分

共有アプリケーションを開きます。 そのリンクは、サインアップ時に使用したメールアドレスに送信されたメールに記載されています。 前の手順の「Agents in the AM」トークンとデプロイIDを入力します。

表示を更新 をクリックします。 アプリによって接続の成功が確認されます。

### 8. ベースラインエージェントのテスト

所要時間：10分

エージェントのYAMLを修正する前に、アプリケーションでエージェントがどのように動作するかを確認します。

1. 以下を設定します。 フィールド値取引拠点HB_HOUSTON開始日7日前終了日今日
2. 表示を更新をクリックしてデータを読み込みます。
3. 予測チャートを表示し、エラーポイントを選択します。
4. AIで分析をクリックします。

出力内容を文書化して、修正後の出力と比較できるようにします。 以下に具体例を示します。

- トーン
- Length
- 構造
- 強調
- データソース

### 9. エージェントのYAMLを開く

所要時間：20～30分

以降の手順では、ローカルファイルではなく、DataRobot内で設定を変更します。

1. レジストリ > ワークショップに移動します。
2. エージェントを開き、ファイルセクションに移動します。
3. 名前の右側にある鉛筆アイコンをクリックして、agents.yamlを開きます。 YAMLの編集はすべてここで行われます。 この構造では以下を定義します。 以下のようになります。 agents:forecast_analyst:role:"..."goal:"..."backstory:"..."tasks:error_analysis:description:"..."expected_output:"..."

## エージェントを使ったエクスペリメント

上記で定義された構造に基づいて、いくつかの変更を加えて、エージェントの出力を試してみます。

- エージェントのバージョンを作成する 方法について説明します。
- 変更例については、 エクスペリメント のセクションを参照してください。

### エージェントの新しいバージョンを作成する

編集したYAMLファイルを保存してパブリッシュするには、変更ごとに、または変更を組み合わせて、以下の手順を実行します。

1. 変更内容を保存してパブリッシュします。
2. 更新されたエージェントを登録します。
3. モデルを新しいバージョンに置き換えます。
4. 新しいエージェントをテストします。

#### 変更内容の保存とパブリッシュ

YAMLに変更を加えた後、YAMLエディターで 保存 をクリックします。

#### 更新されたエージェントを登録する

更新内容の登録によって、エージェントの新しいバージョンを作成します。

1. レジストリ > ワークショップ に移動します。
2. モデル リストで、エージェント名をクリックします。
3. ワークフローの登録 をクリックします。

#### 新しいバージョンに置き換える

現在のデプロイを新しいバージョンで置き換えます。

1. コンソール > デプロイ に移動します。
2. デプロイを選択し、アクションメニューでモデルの置換を選択します。
3. 新しいバージョンを選択し、選択をクリックして置き換えます。

#### 新しいエージェントをテストする

デプロイしたら、 [ベースラインエージェントのテスト](https://docs.datarobot.com/ja/docs/get-started/how-to/agents-ercot.html.md#8-test-the-baseline-agent) 時に行った分析を再実行します。 その手順で行ったように、出力内容を比較し、文書化します。 以下の点に注意してください。

- 役割
- トーン
- Length
- 構造
- ニュース報道
- インサイト

### エクスペリメント例

繰り返し試してみます。以下の例をいくつか、またはすべて使用して、比較してみてください。

- ロールとゴールを変更する 。
- 分析の深さを調整する 。
- 新しいデータソースを追加する 。
- 出力構造を変更する 。
- 推論の枠組みを追加する 。

あるいは、自分で試してみるのも良いでしょう。

#### エクスペリメントA：agentsセクションを変更する

`agents` セクションのデフォルト構造では、role、goal、およびbackstoryが次のように定義されています。

```
agents:
  forecast_analyst:
    role: "Energy Market Analyst"
    goal: "Interpret and explain ERCOT forecast errors through comprehensive narrative analysis"
    backstory: |
      You synthesize data into clear narratives that explain market dynamics. 
      You interpret patterns and connect causes rather than simply listing facts.
      You understand how natural gas markets, international energy politics, geopolitical events, 
      and regulatory changes impact electricity prices.
      You consider the interconnected nature of global energy markets and their influence on 
      regional power markets like ERCOT. 
```

たとえば、これらの値を以下のいずれかに置き換えてみてください。

**技術的観点:**
```
role: "Grid Operations Engineer"
goal: "Diagnose forecast errors through technical analysis of grid operations"
backstory: |
    You specialize in load balancing, renewable integration, and system constraints. 
```

**財務的観点:**
```
role: "Energy Trading Strategist"
goal: "Identify market inefficiencies and trading opportunities from forecast errors"
backstory: |
    You focus on arbitrage, market signals, and price movements. 
```


#### エクスペリメントB：分析の深さを調整する

分析の深さを変えてみます。

**概要:**
```
expected_output: |
    A concise executive summary (3-4 sentences maximum) explaining the primary driver. 
```

**一歩進んだ操作:**
``` yaml
expected_output: |
    A comprehensive analysis (12-15 sentences) covering immediate causes, market dynamics,


external factors, interconnections, and implications. 
    ```

#### エクスペリメントC：新しいデータソースを追加する

YAMLの `description` セクションで、ニュース検索クエリーを拡張します。 クエリーを追加すると、エージェントの内容がさらに充実します。 28行目から31行目を以下のように置き換えます。

```
Call fetch_energy_news with queries:
- "ERCOT Texas electricity grid"
- "natural gas prices energy markets"
- "international energy politics natural gas LNG"
- "renewable energy solar wind forecast Texas"
- "power plant outages maintenance Texas ERCOT"
- "electricity demand forecast weather Texas"
- "Texas energy policy regulation changes" 
```

#### エクスペリメントD：出力構造を変更する

物語形式を、構造化されセクション分けされた出力形式に置き換えます。

```
expected_output: |
    Format your response with these sections:
    1. EXECUTIVE SUMMARY
    2. WEATHER CONDITIONS
    3. MARKET DYNAMICS
    4. EXTERNAL FACTORS
    5. ROOT CAUSE ANALYSIS
    6. APPENDICES 
```

#### エクスペリメントE：推論の枠組みを追加する

エージェントの段階的な推論を強化します。

```
description: |
  Analyze the forecast error using this reasoning process:
  STEP 1 - Quantify Impact
  STEP 2 - Immediate Causes
  STEP 3 - Market Context
  STEP 4 - External Factors
  STEP 5 - Synthesis 
```

おめでとうございます。ERCOTアプリ向けに修正および適用されたエージェントは、正常に動作しています。 エージェントは、 [ワークベンチのプレイグラウンドタイル](https://docs.datarobot.com/ja/docs/agentic-ai/playground-tools/playground-overview.html.md) でいつでも確認できます。
