1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure AI Foundry の Agent を VS Code から活用してみた(NewsAPI連携事例)

Posted at

最近、Azure AI Foundry のプレビュー版を試しており、カスタム AI Agent を構築して、NewsAPI.org のニュースデータと連携するプロトタイプを作成しました。本記事では、完成した Agent をどのように使えるか、特に外部クライアントからの利用がまだ制限されている状況下で、どうやって開発環境からうまく使いこなすかを紹介します。

背景と目的

Azure AI Foundry では、簡単にエージェント(LLMベースの会話Bot)を構築できますが、現時点(2025年6月)では、パブリックなAPIエンドポイントを使って自由に呼び出す方法は用意されていないようです

そこで、以下の2つの方法でエージェントと対話できる環境を整えました:

  • Foundry の Web Playground
  • Visual Studio Code 拡張(Azure AI Foundry for VS Code)

これにより、ブラウザまたはローカルの開発環境から簡易的に対話できるようになりました。


全体構成の概要

エージェントは NewsAPI.org のデータを取得し、日付付きの要約を提供する機能を持ちます。以下のような構成になっています:

  1. Azure AI Foundry 上で Agent 作成
  2. Logic Apps を使って NewsAPI.org からニュースデータ取得
  3. エージェントがその情報を受け取り、整形して応答
  4. VS Code または Playground から対話

詳細は別記事にあります。
https://qiita.com/yoshiwatanabe/items/0ef2996fd43a87c16a9b

📷 image.png


エージェント構成の詳細

プロジェクト名:MyFirstAiProject

Agent 名:Agent856

モデル:gpt-4o-mini-test1

インストラクション:

You are going to help user to obtain and understand the latest news about AI

Playgroundでの応答例(ニュースの要約)
📷  image.png


Logic Apps を使った NewsAPI.org 連携

Logic App を作成し、HTTP リクエストで NewsAPI.org から最新記事を取得しています。APIキーは KeyVault に保管し、GETリクエストのクエリには日付などを動的に挿入しています。

Logic Apps の実行履歴からAgent経由でトリガーされたことが確認できます(記事は6月1日に書きました)

📷 Logic App の設定と呼び出し結果
image.png

この Logic App は Foundry のエージェントに getnewsapiorgdata_Tool として登録済みです。

📷 エージェントに Logic App を接続した様子

image.png


VS Code 拡張機能からの利用

ブラウザのPlaygroundと同様に、VS Code 上の拡張機能「Azure AI Foundry」を使えば、ローカルから直接 Playground にアクセスして Agent に話しかけることができます。

拡張機能名:Azure AI Foundry

📷 VS Code で拡張を有効化した画面

image.png

📷 VS Code Playground で Agent にクエリしている様子

ニュース見出しの日付からモデルのカットオフではなくエージェントがツールを利用したことが確認できます(記事は6月1日に書きました)

image.png


現時点での制約と今後

制約

  • 外部クライアント(curl, Python など)から Agent を直接呼び出すための REST API はまだ未公開
  • 認証・認可の管理もエンタープライズ用途では課題が残る

妥協点

  • VS Code からの対話が可能になったことで、ローカル開発においては十分な UX を確保できた

今後の展望

  • Public API のサポートが入ると、Logic App や Power Platform を介さずに Agent を直接操作可能になることが期待されます

まとめ

Azure AI Foundry は今後の拡張が非常に楽しみなプラットフォームです。現時点では Web/VS Code Playground を使う方法に制限されていますが、エージェント設計・外部ツール統合・プロンプト設計において試行錯誤するには十分な柔軟性があります。(なお、別のLogic AppからAgentを呼び出す方法はすでにあるようなので、次回試してみようと思います)

「ちょっと試してみたい」「PoCを作ってみたい」という方には、VS Code 経由の利用が特におすすめです。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?