目次
この記事について
本記事は、Agent Builder を使用したデータストア参照型対話エージェントの作成に関する調査記録です。
やりたいこと
Agent Builder を用いたデータストア参照型対話エージェントの作成において、
既存のデータストア機能だとデータ数増加により回答率の低下が発生する為、elastic + dataflow + bigqueryで作成した検索が可能なデータストアを実装したい。
前回の調査日記
あわせて読みたい


AI Agent開発日記 2025/04/29
この記事について 本記事は、Agent Builder を使用したデータストア参照型対話エージェントの作成に関する調査記録です。 やりたいこと Agent Builder を用いたデータス...
agentbuilderのデータストアtoolとしてElastic Cloudで検索できるよう設定する。
- やりたいこと
- agentbuilderのtoolを設定後下記エラーが発生したから解決したい。
- 試したこと
- toolを設定
- 名前
- 有名な曲検索tool
- type
- openapi
- Description
- このtoolはユーザーからの検索指示によってトリガーされます。
Elasticsearchでユーザーのクエリを元に検索し、検索結果を返します。
- このtoolはユーザーからの検索指示によってトリガーされます。
- Schema
- yaml形式
- 内容は下記に記載
- Authentication
- Authentication type
- apikey
- API Key Location
- request header
- apikey
- Raw value
- elasticsearchのapikeyを指定
- Raw value
- Authentication type
- 名前
- toolを設定
- 現状
- agentbuilderのtoolのスキーマと認証情報を設定後、下記の認証情報に間違いがあるというエラーが発生したから修正中。
現状のスキーマ
openapi: 3.0.0
info:
title: Elasticsearch Property Search API
version: v1
servers:
- url: 'elasticのエンドポイントURL'
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: Authorization
security:
- ApiKeyAuth: []
paths:
/famous-song/_search:
post:
summary: Search properties in Elasticsearch
description: Executes a search query against an Elasticsearch index for properties.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
query:
type: object
description: Query in Elasticsearch Query DSL format.
responses:
'200':
description: Successful response with search results.
content:
application/json:
schema:
type: object
properties:
took:
type: integer
description: Time taken for the query in milliseconds.
timed_out:
type: boolean
description: Indicates if the query timed out.
_shards:
type: object
properties:
total:
type: integer
successful:
type: integer
skipped:
type: integer
failed:
type: integer
hits:
type: object
properties:
total:
type: object
properties:
value:
type: integer
relation:
type: string
max_score:
type: number
hits:
type: array
items:
type: object
properties:
_index:
type: string
_type:
type: string
_id:
type: string
_score:
type: number
_source:
type: object
properties:
property_id:
type: integer
location:
type: string
type:
type: string
status:
type: string
nearest_station:
type: string
price:
type: integer
area_sqm:
type: number
エラー内容
generic::UNAUTHENTICATED: {"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/famous-song/_search]","header":{"WWW-Authenticate":["Bearer realm=\"security\"","ApiKey","Basic realm=\"security\", charset=\"UTF-8\""]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/famous-song/_search]","header":{"WWW-Authenticate":["Bearer realm=\"security\"","ApiKey","Basic realm=\"security\", charset=\"UTF-8\""]}},"status":401}