Placeholder variables in Amazon Bedrock agent prompt templates - Amazon Bedrock

Placeholder variables in Amazon Bedrock agent prompt templates

You can use placeholder variables in agent prompt templates. The variables will be populated by pre-existing configurations when the prompt template is called. Select a tab to see variables that you can use for each prompt template.

Pre-processing
Variable Models supported Replaced by
$functions$ Anthropic Claude Instant, Claude v2.0 Action group API operations and knowledge bases configured for the agent.
$tools$ Anthropic Claude v2.1, Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus, Amazon Titan Text Premier
$conversation_history$ Anthropic Claude Instant, Claude v2.0, Claude v2.1 Conversation history for the current session.
$question$ All User input for the current InvokeAgent call in the session.
Orchestration
Variable Models supported Replaced by
$functions$ Anthropic Claude Instant, Claude v2.0 Action group API operations and knowledge bases configured for the agent.
$tools$ Anthropic Claude v2.1, Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus, Amazon Titan Text Premier
$agent_scratchpad$ All Designates an area for the model to write down its thoughts and actions it has taken. Replaced by predictions and output of the previous iterations in the current turn. Provides the model with context of what has been achieved for the given user input and what the next step should be.
$any_function_name$ Anthropic Claude Instant, Claude v2.0 A randomly chosen API name from the API names that exist in the agent's action groups.
$conversation_history$ Anthropic Claude Instant, Claude v2.0, Claude v2.1 Conversation history for the current session
$instruction$ All Model instructions configured for the agent.
$model_instruction$ Amazon Titan Text Premier Model instructions configured for the agent.
$prompt_session_attributes$ All Session attributes preserved across a prompt.
$question$ All User input for the current InvokeAgent call in the session.
$thought$ Amazon Titan Text Premier Thought prefix to start the thinking of each turn for the model.
$knowledge_base_guideline$ Anthropic Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus Instructions for the model to format the output with citations, if the results contain information from a knowledge base. These instructions are only added if a knowledge base is associated with the agent.

You can use the following placeholder variables if you allow the agent to ask the user for more information by doing one of the following actions:

Variable Models supported Replaced by
$ask_user_missing_parameters$ Anthropic Claude Instant, Claude v2.0 Instructions for the model to ask the user to provide required missing information.
$ask_user_missing_information$ Anthropic Claude v2.1, Claude 3 Sonnet, Claude 3 Haiku, Claude 3 Opus
$ask_user_confirm_parameters$ Anthropic Claude Instant, Anthropic Claude v2.0 Instructions for the model to ask the user to confirm parameters that the agent hasn't yet received or is unsure of.
$ask_user_function$ Anthropic Claude Instant, Anthropic Claude v2.0 A function to ask the user a question.
$ask_user_function_format$ Anthropic Claude Instant, Anthropic Claude v2.0 The format of the function to ask the user a question.
$ask_user_input_examples$ Anthropic Claude Instant, Anthropic Claude v2.0 Few-shot examples to inform the model how to predict when it should ask the user a question.
Knowledge base response generation
Variable Model Replaced by
$query$ All The query generated by the orchestration prompt model response when it predicts the next step to be knowledge base querying.
$search_results$ All The retrieved results for the user query.
Post-processing
Variable Model Replaced by
$latest_response$ All The last orchestration prompt model response.
$bot_response$ Amazon Titan Text Model The action group and knowledge base outputs from the current turn.
$question$ All User input for the current InvokeAgent.call in the session.
$responses$ All The action group and knowledge base outputs from the current turn.