This documentation is a draft for private preview for regions in the AWS European Sovereign Cloud. Documentation content will continue to evolve. Published: January 13, 2026.Use GetPrompt with an AWS SDK
The following code example shows how to use GetPrompt.
- Python
-
- SDK for Python (Boto3)
-
Get an Amazon Bedrock managed prompt.
def get_prompt(client, prompt_id):
"""
Gets an Amazon Bedrock managed prompt.
Args:
client: Amazon Bedrock Agent boto3 client.
prompt_id (str): The identifier of the prompt that you want to get.
Returns:
dict: The response from the GetPrompt operation.
"""
try:
logger.info("Getting prompt ID: %s.", prompt_id)
response = client.get_prompt(
promptIdentifier=prompt_id
)
logger.info("Retrieved prompt ID: %s. Name: %s",
prompt_id,
response['name'])
return response
except ClientError as e:
logger.exception("Client error getting prompt: %s", str(e))
raise
except Exception as e:
logger.exception("Unexpected error getting prompt: %s", str(e))
raise
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.