Use PrepareAgent with an AWS SDK or CLI - Amazon Bedrock

Use PrepareAgent with an AWS SDK or CLI

The following code example shows how to use PrepareAgent.

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)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

Prepare an agent for internal testing.

def prepare_agent(self, agent_id): """ Creates a DRAFT version of the agent that can be used for internal testing. :param agent_id: The unique identifier of the agent to prepare. :return: The response from Agents for Bedrock if successful, otherwise raises an exception. """ try: prepared_agent_details = self.client.prepare_agent(agentId=agent_id) except ClientError as e: logger.error(f"Couldn't prepare agent. {e}") raise else: return prepared_agent_details
  • For API details, see PrepareAgent in AWS SDK for Python (Boto3) API Reference.

For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.