

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建置代理式流程
<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: []
        })
    }
}
```