BedrockAgentCore / Client / get_recommendation
get_recommendation¶
- BedrockAgentCore.Client.get_recommendation(**kwargs)¶
Retrieves detailed information about a recommendation, including its configuration, status, and results.
See also: AWS API Documentation
Request Syntax
response = client.get_recommendation( recommendationId='string' )
- Parameters:
recommendationId (string) –
[REQUIRED]
The unique identifier of the recommendation to retrieve.
- Return type:
dict
- Returns:
Response Syntax
{ 'recommendationId': 'string', 'recommendationArn': 'string', 'name': 'string', 'description': 'string', 'type': 'SYSTEM_PROMPT_RECOMMENDATION'|'TOOL_DESCRIPTION_RECOMMENDATION', 'recommendationConfig': { 'systemPromptRecommendationConfig': { 'systemPrompt': { 'text': 'string', 'configurationBundle': { 'bundleArn': 'string', 'versionId': 'string', 'systemPromptJsonPath': 'string' } }, 'agentTraces': { 'sessionSpans': [ {...}|[...]|123|123.4|'string'|True|None, ], 'cloudwatchLogs': { 'logGroupArns': [ 'string', ], 'serviceNames': [ 'string', ], 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'rule': { 'filters': [ { 'key': 'string', 'operator': 'Equals'|'NotEquals'|'GreaterThan'|'LessThan'|'GreaterThanOrEqual'|'LessThanOrEqual'|'Contains'|'NotContains', 'value': { 'stringValue': 'string', 'doubleValue': 123.0, 'booleanValue': True|False } }, ] } } }, 'evaluationConfig': { 'evaluators': [ { 'evaluatorArn': 'string' }, ] } }, 'toolDescriptionRecommendationConfig': { 'toolDescription': { 'toolDescriptionText': { 'tools': [ { 'toolName': 'string', 'toolDescription': { 'text': 'string' } }, ] }, 'configurationBundle': { 'bundleArn': 'string', 'versionId': 'string', 'tools': [ { 'toolName': 'string', 'toolDescriptionJsonPath': 'string' }, ] } }, 'agentTraces': { 'sessionSpans': [ {...}|[...]|123|123.4|'string'|True|None, ], 'cloudwatchLogs': { 'logGroupArns': [ 'string', ], 'serviceNames': [ 'string', ], 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'rule': { 'filters': [ { 'key': 'string', 'operator': 'Equals'|'NotEquals'|'GreaterThan'|'LessThan'|'GreaterThanOrEqual'|'LessThanOrEqual'|'Contains'|'NotContains', 'value': { 'stringValue': 'string', 'doubleValue': 123.0, 'booleanValue': True|False } }, ] } } } } }, 'status': 'PENDING'|'IN_PROGRESS'|'COMPLETED'|'FAILED'|'DELETING', 'createdAt': datetime(2015, 1, 1), 'updatedAt': datetime(2015, 1, 1), 'recommendationResult': { 'systemPromptRecommendationResult': { 'recommendedSystemPrompt': 'string', 'configurationBundle': { 'bundleArn': 'string', 'versionId': 'string' }, 'errorCode': 'string', 'errorMessage': 'string' }, 'toolDescriptionRecommendationResult': { 'tools': [ { 'toolName': 'string', 'recommendedToolDescription': 'string' }, ], 'configurationBundle': { 'bundleArn': 'string', 'versionId': 'string' }, 'errorCode': 'string', 'errorMessage': 'string' } } }
Response Structure
(dict) –
recommendationId (string) –
The unique identifier of the recommendation.
recommendationArn (string) –
The Amazon Resource Name (ARN) of the recommendation.
name (string) –
The name of the recommendation.
description (string) –
The description of the recommendation.
type (string) –
The type of recommendation.
recommendationConfig (dict) –
The configuration for the recommendation.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
systemPromptRecommendationConfig,toolDescriptionRecommendationConfig. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
systemPromptRecommendationConfig (dict) –
The configuration for a system prompt recommendation.
systemPrompt (dict) –
The current system prompt to optimize.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
text,configurationBundle. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
text (string) –
The system prompt text provided inline.
configurationBundle (dict) –
The system prompt sourced from a configuration bundle version.
bundleArn (string) –
The Amazon Resource Name (ARN) of the configuration bundle.
versionId (string) –
The version identifier of the configuration bundle.
systemPromptJsonPath (string) –
The JSON path within the configuration bundle that contains the system prompt.
agentTraces (dict) –
The agent traces to analyze for generating recommendations.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
sessionSpans,cloudwatchLogs. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
sessionSpans (list) –
Agent traces provided as inline session spans in OpenTelemetry format.
(document) –
cloudwatchLogs (dict) –
Agent traces read from CloudWatch Logs.
logGroupArns (list) –
The list of CloudWatch log group ARNs to read agent traces from.
(string) –
serviceNames (list) –
The list of service names to filter traces within the specified log groups.
(string) –
startTime (datetime) –
The start time of the time range to read traces from.
endTime (datetime) –
The end time of the time range to read traces from.
rule (dict) –
Optional rule configuration for filtering traces.
filters (list) –
The list of filters to apply when reading agent traces.
(dict) –
A filter for narrowing down agent traces from CloudWatch Logs based on key-value comparisons.
key (string) –
The key or field name to filter on within the agent trace data.
operator (string) –
The comparison operator to use for filtering.
value (dict) –
The value to compare against using the specified operator.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
stringValue,doubleValue,booleanValue. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
stringValue (string) –
A string value for text-based filtering.
doubleValue (float) –
A numeric value for numerical filtering and comparisons.
booleanValue (boolean) –
A boolean value for true/false filtering conditions.
evaluationConfig (dict) –
The evaluation configuration specifying which evaluator to use for assessing recommendation quality.
evaluators (list) –
The list of evaluators to use for assessing recommendation quality.
(dict) –
A reference to an evaluator used for recommendation assessment.
evaluatorArn (string) –
The Amazon Resource Name (ARN) of the evaluator.
toolDescriptionRecommendationConfig (dict) –
The configuration for a tool description recommendation.
toolDescription (dict) –
The current tool descriptions to optimize.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
toolDescriptionText,configurationBundle. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
toolDescriptionText (dict) –
Tool descriptions provided as inline text.
tools (list) –
The list of tool descriptions to optimize.
(dict) –
A tool description input containing the tool name and its current description.
toolName (string) –
The name of the tool.
toolDescription (dict) –
The current description of the tool to optimize.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
text. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
text (string) –
The tool description as inline text.
configurationBundle (dict) –
Tool descriptions sourced from a configuration bundle version.
bundleArn (string) –
The Amazon Resource Name (ARN) of the configuration bundle.
versionId (string) –
The version identifier of the configuration bundle.
tools (list) –
The list of tool entries mapping tool names to their JSON paths within the bundle.
(dict) –
Maps a tool name to its JSON path within a configuration bundle.
toolName (string) –
The name of the tool.
toolDescriptionJsonPath (string) –
The JSON path within the configuration bundle’s components that contains the tool description.
agentTraces (dict) –
The agent traces to analyze for generating tool description recommendations.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
sessionSpans,cloudwatchLogs. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
sessionSpans (list) –
Agent traces provided as inline session spans in OpenTelemetry format.
(document) –
cloudwatchLogs (dict) –
Agent traces read from CloudWatch Logs.
logGroupArns (list) –
The list of CloudWatch log group ARNs to read agent traces from.
(string) –
serviceNames (list) –
The list of service names to filter traces within the specified log groups.
(string) –
startTime (datetime) –
The start time of the time range to read traces from.
endTime (datetime) –
The end time of the time range to read traces from.
rule (dict) –
Optional rule configuration for filtering traces.
filters (list) –
The list of filters to apply when reading agent traces.
(dict) –
A filter for narrowing down agent traces from CloudWatch Logs based on key-value comparisons.
key (string) –
The key or field name to filter on within the agent trace data.
operator (string) –
The comparison operator to use for filtering.
value (dict) –
The value to compare against using the specified operator.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
stringValue,doubleValue,booleanValue. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
stringValue (string) –
A string value for text-based filtering.
doubleValue (float) –
A numeric value for numerical filtering and comparisons.
booleanValue (boolean) –
A boolean value for true/false filtering conditions.
status (string) –
The current status of the recommendation.
createdAt (datetime) –
The timestamp when the recommendation was created.
updatedAt (datetime) –
The timestamp when the recommendation was last updated.
recommendationResult (dict) –
The result of the recommendation, containing the optimized system prompt or tool descriptions. Only present when the recommendation status is
COMPLETED.Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
systemPromptRecommendationResult,toolDescriptionRecommendationResult. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
systemPromptRecommendationResult (dict) –
The result of a system prompt recommendation.
recommendedSystemPrompt (string) –
The optimized system prompt text generated by the recommendation.
configurationBundle (dict) –
The configuration bundle containing the recommended system prompt, if the input was sourced from a configuration bundle.
bundleArn (string) –
The Amazon Resource Name (ARN) of the configuration bundle.
versionId (string) –
The version identifier of the configuration bundle containing the recommendation.
errorCode (string) –
The error code if the recommendation failed.
errorMessage (string) –
The error message if the recommendation failed.
toolDescriptionRecommendationResult (dict) –
The result of a tool description recommendation.
tools (list) –
The list of tools with their recommended descriptions.
(dict) –
The output for a single tool description recommendation.
toolName (string) –
The name of the tool.
recommendedToolDescription (string) –
The optimized tool description text generated by the recommendation.
configurationBundle (dict) –
The configuration bundle containing the recommended tool descriptions, if the input was sourced from a configuration bundle.
bundleArn (string) –
The Amazon Resource Name (ARN) of the configuration bundle.
versionId (string) –
The version identifier of the configuration bundle containing the recommendation.
errorCode (string) –
The error code if the recommendation failed.
errorMessage (string) –
The error message if the recommendation failed.
Exceptions
BedrockAgentCore.Client.exceptions.AccessDeniedExceptionBedrockAgentCore.Client.exceptions.ValidationExceptionBedrockAgentCore.Client.exceptions.ResourceNotFoundExceptionBedrockAgentCore.Client.exceptions.ThrottlingExceptionBedrockAgentCore.Client.exceptions.InternalServerException