Use CreateAgentAlias
with an AWS SDK
The following code example shows how to use CreateAgentAlias
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- Python
-
- SDK for Python (Boto3)
-
Create an agent alias.
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
For a complete list of AWS SDK developer guides and code examples, see
Using Amazon Bedrock with an AWS SDK.
This topic also includes information about getting started and details about previous SDK versions.