

# エージェントフローの構築
<a name="speech-agentic"></a>

**注記**  
このドキュメントは Amazon Nova バージョン 1 を対象としています。Amazon Nova 2 Sonic ガイドについては、「[ツールの設定](https://docs.aws.amazon.com/nova/latest/nova2-userguide/sonic-tool-configuration.html)」を参照してください。

より複雑なユースケースでは、タスクを達成するために連携する複数のツールを設定することで、エージェントフローを実装できます。Amazon Nova Sonic は、ユーザーリクエストに基づいてこれらのツールをオーケストレーションできます。

## ナレッジベースの実装の概要
<a name="speech-agentic-example"></a>

**ホテルの予約キャンセルエージェントの例**  
以下は、ホテルの予約キャンセルシステムの設定例です。

```
toolConfiguration: {
    tools: [
      {
        toolSpec: {
          name: "getReservation",
          description: "Retrieves hotel reservation information based on the guest's name and check-in date",
          inputSchema: {
            json: JSON.stringify({
              type: "object",
              properties: {
                name: {
                  type: "string",
                  description: "Full name of the guest who made the reservation"
                },
                checkInDate: {
                  type: "string",
                  description: "The check-in date for the reservation in YYYY-MM-DD format"
                }
              },
              required: ["name", "checkInDate"]
            })
          }
        }
      },
      {
        toolSpec: {
          name: "cancelReservation",
          description: "Cancels a hotel reservation after confirming the cancellation policy with the guest",
          inputSchema: {
            json: JSON.stringify({
              type: "object",
              properties: {
                reservationId: {
                  type: "string",
                  description: "The unique identifier for the reservation to be cancelled"
                },
                confirmCancellation: {
                  type: "boolean",
                  description: "Confirmation from the guest that they understand the cancellation policy and want to proceed",
                  default: false
                }
              },
              required: ["reservationId", "confirmCancellation"]
            })
          }
        }
      }
    ]
  }
```

**ホテルの検索エージェントの例**  
次に、ホテル検索エージェントの設定例を示します。

```
toolSpec: {
    name: "searchHotels",
    description: "Search for hotels by location, star rating, amenities and price range.",
    inputSchema: {
        json: JSON.stringify({
            type: "object",
            properties: {
                location: {
                    type: "string",
                    description: "City or area to search for hotels"
                },
                rating: {
                    type: "number",
                    minimum: 1,
                    maximum: 5,
                    description: "Minimum star rating (1-5)"
                },
                amenities: {
                    type: "array",
                    items: {
                        type: "string"
                    },
                    description: "List of desired amenities"
                },
                price_range: {
                    type: "object",
                    properties: {
                        min: {
                            type: "number",
                            minimum: 0
                        },
                        max: {
                            type: "number",
                            minimum: 0
                        }
                    },
                    description: "Price range per night"
                }
            },
            required: []
        })
    }
}
```