

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

# 建立代理程式別名
<a name="deploy-agent-proc"></a>

下列程序說明如何為代理程式建立別名和版本。建立別名後，您可以透過使用 [Amazon Bedrock 代理程式執行時期端點](https://docs.aws.amazon.com/general/latest/gr/bedrock.html#bra-rt)提出 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html) 請求，在應用程式中使用代理程式。

**建立別名**
+ 建立代理程式的別名和版本。選擇您偏好方法的索引標籤，然後遵循下列步驟：

------
#### [ Console ]

**建立別名 (以及選擇性地建立新版本)**

  1. 使用具有 Amazon Bedrock 主控台使用許可的 IAM 身分登入AWS 管理主控台。接著，開啟位於 [https://console.aws.amazon.com/bedrock](https://console.aws.amazon.com/bedrock) 的 Amazon Bedrock 主控台。

  1. 從左側導覽窗格選取**代理程式**。接著，在**代理程式**區段中選擇代理程式。

  1. 在**別名**區段中，選擇**建立**。

  1. 輸入唯一的**別名名稱**，並提供選用的**描述**。

  1. 在**與版本建立關聯**下，選擇下列其中一個選項：
     + 若要建立新版本，選擇**建立新版本，並將其與此別名建立關聯**。
     + 若要使用現有版本，選擇**使用現有版本來與此別名建立關聯**。從下拉式功能表中，選擇要與別名建立關聯的版本。

  1. 在**選取輸送量**下，選取下列其中一個選項：
     + 若要讓代理程式在為帳戶設定的速率執行模型推論，請選取**隨需 (ODT)**。如需詳細資訊，請參閱 [Amazon Bedrock 的配額](quotas.md)。
     + 若要讓代理程式使用您先前為模型購買的佈建輸送量，以更高的速率執行模型推論，請選取**佈建輸送量 (PT)**，然後選取佈建模型。如需詳細資訊，請參閱 [使用 Amazon Bedrock 中的佈建輸送量增加模型調用容量](prov-throughput.md)。

  1. 選取**建立別名**。

------
#### [ API ]

  若要建立代理程式的別名，請使用 [Amazon Bedrock 代理程式建置時期端點](https://docs.aws.amazon.com/general/latest/gr/bedrock.html#bra-bt)傳送 [CreateAgentAlias](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgentAlias.html) 請求。

  下列是必要欄位：  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/deploy-agent-proc.html)

  以下是選填欄位：  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/bedrock/latest/userguide/deploy-agent-proc.html)

  ```
      def create_agent_alias(self, name, agent_id):
          """
          Creates an alias of an agent that can be used to deploy the agent.
  
          :param name: The name of the alias.
          :param agent_id: The unique identifier of the agent.
          :return: Details about the alias that was created.
          """
          try:
              response = self.client.create_agent_alias(
                  agentAliasName=name, agentId=agent_id
              )
              agent_alias = response["agentAlias"]
          except ClientError as e:
              logger.error(f"Couldn't create agent alias. {e}")
              raise
          else:
              return agent_alias
  ```

  如需詳細資訊，請參閱 [Hello Amazon Bedrock 代理人](bedrock-agent_example_bedrock-agent_Hello_section.md)。

------