AgentsforBedrockRuntime / Client / invoke_flow

invoke_flow¶

AgentsforBedrockRuntime.Client.invoke_flow(**kwargs)¶

Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there’s an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.

Note

The CLI doesn’t support streaming operations in Amazon Bedrock, including InvokeFlow.

See also: AWS API Documentation

Request Syntax

response = client.invoke_flow(
    flowIdentifier='string',
    flowAliasIdentifier='string',
    inputs=[
        {
            'nodeName': 'string',
            'nodeOutputName': 'string',
            'content': {
                'document': {...}|[...]|123|123.4|'string'|True|None
            },
            'nodeInputName': 'string'
        },
    ],
    enableTrace=True|False,
    modelPerformanceConfiguration={
        'performanceConfig': {
            'latency': 'standard'|'optimized'
        }
    },
    executionId='string'
)
Parameters:
  • flowIdentifier (string) –

    [REQUIRED]

    The unique identifier of the flow.

  • flowAliasIdentifier (string) –

    [REQUIRED]

    The unique identifier of the flow alias.

  • inputs (list) –

    [REQUIRED]

    A list of objects, each containing information about an input into the flow.

    • (dict) –

      Contains information about an input into the prompt flow and where to send it.

      • nodeName (string) – [REQUIRED]

        The name of the flow input node that begins the prompt flow.

      • nodeOutputName (string) –

        The name of the output from the flow input node that begins the prompt flow.

      • content (dict) – [REQUIRED]

        Contains information about an input into the prompt flow.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: document.

        • document (document) –

          The input to send to the prompt flow input node.

      • nodeInputName (string) –

        The name of the input from the flow input node.

  • enableTrace (boolean) – Specifies whether to return the trace for the flow or not. Traces track inputs and outputs for nodes in the flow. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

  • modelPerformanceConfiguration (dict) –

    Model performance settings for the request.

    • performanceConfig (dict) –

      The latency configuration for the model.

      • latency (string) –

        To use a latency-optimized version of the model, set to optimized.

  • executionId (string) – The unique identifier for the current flow execution. If you don’t provide a value, Amazon Bedrock creates the identifier for you.

Return type:

dict

Returns:

The response of this operation contains an EventStream member. When iterated the EventStream will yield events based on the structure below, where only one of the top level keys will be present for any given event.

Response Syntax

{
    'responseStream': EventStream({
        'flowOutputEvent': {
            'nodeName': 'string',
            'nodeType': 'FlowInputNode'|'FlowOutputNode'|'LambdaFunctionNode'|'KnowledgeBaseNode'|'PromptNode'|'ConditionNode'|'LexNode',
            'content': {
                'document': {...}|[...]|123|123.4|'string'|True|None
            }
        },
        'flowCompletionEvent': {
            'completionReason': 'SUCCESS'|'INPUT_REQUIRED'
        },
        'flowTraceEvent': {
            'trace': {
                'nodeInputTrace': {
                    'nodeName': 'string',
                    'timestamp': datetime(2015, 1, 1),
                    'fields': [
                        {
                            'nodeInputName': 'string',
                            'content': {
                                'document': {...}|[...]|123|123.4|'string'|True|None
                            },
                            'source': {
                                'nodeName': 'string',
                                'outputFieldName': 'string',
                                'expression': 'string'
                            },
                            'type': 'String'|'Number'|'Boolean'|'Object'|'Array',
                            'category': 'LoopCondition'|'ReturnValueToLoopStart'|'ExitLoop',
                            'executionChain': [
                                {
                                    'nodeName': 'string',
                                    'index': 123,
                                    'type': 'Iterator'|'Loop'
                                },
                            ]
                        },
                    ]
                },
                'nodeOutputTrace': {
                    'nodeName': 'string',
                    'timestamp': datetime(2015, 1, 1),
                    'fields': [
                        {
                            'nodeOutputName': 'string',
                            'content': {
                                'document': {...}|[...]|123|123.4|'string'|True|None
                            },
                            'next': [
                                {
                                    'nodeName': 'string',
                                    'inputFieldName': 'string'
                                },
                            ],
                            'type': 'String'|'Number'|'Boolean'|'Object'|'Array'
                        },
                    ]
                },
                'conditionNodeResultTrace': {
                    'nodeName': 'string',
                    'timestamp': datetime(2015, 1, 1),
                    'satisfiedConditions': [
                        {
                            'conditionName': 'string'
                        },
                    ]
                },
                'nodeActionTrace': {
                    'nodeName': 'string',
                    'timestamp': datetime(2015, 1, 1),
                    'requestId': 'string',
                    'serviceName': 'string',
                    'operationName': 'string',
                    'operationRequest': {...}|[...]|123|123.4|'string'|True|None,
                    'operationResponse': {...}|[...]|123|123.4|'string'|True|None
                },
                'nodeDependencyTrace': {
                    'nodeName': 'string',
                    'timestamp': datetime(2015, 1, 1),
                    'traceElements': {
                        'agentTraces': [
                            {
                                'sessionId': 'string',
                                'trace': {
                                    'guardrailTrace': {
                                        'action': 'INTERVENED'|'NONE',
                                        'traceId': 'string',
                                        'inputAssessments': [
                                            {
                                                'topicPolicy': {
                                                    'topics': [
                                                        {
                                                            'name': 'string',
                                                            'type': 'DENY',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ]
                                                },
                                                'contentPolicy': {
                                                    'filters': [
                                                        {
                                                            'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK',
                                                            'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ]
                                                },
                                                'wordPolicy': {
                                                    'customWords': [
                                                        {
                                                            'match': 'string',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ],
                                                    'managedWordLists': [
                                                        {
                                                            'match': 'string',
                                                            'type': 'PROFANITY',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ]
                                                },
                                                'sensitiveInformationPolicy': {
                                                    'piiEntities': [
                                                        {
                                                            'type': 'ADDRESS'|'AGE'|'AWS_ACCESS_KEY'|'AWS_SECRET_KEY'|'CA_HEALTH_NUMBER'|'CA_SOCIAL_INSURANCE_NUMBER'|'CREDIT_DEBIT_CARD_CVV'|'CREDIT_DEBIT_CARD_EXPIRY'|'CREDIT_DEBIT_CARD_NUMBER'|'DRIVER_ID'|'EMAIL'|'INTERNATIONAL_BANK_ACCOUNT_NUMBER'|'IP_ADDRESS'|'LICENSE_PLATE'|'MAC_ADDRESS'|'NAME'|'PASSWORD'|'PHONE'|'PIN'|'SWIFT_CODE'|'UK_NATIONAL_HEALTH_SERVICE_NUMBER'|'UK_NATIONAL_INSURANCE_NUMBER'|'UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER'|'URL'|'USERNAME'|'US_BANK_ACCOUNT_NUMBER'|'US_BANK_ROUTING_NUMBER'|'US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER'|'US_PASSPORT_NUMBER'|'US_SOCIAL_SECURITY_NUMBER'|'VEHICLE_IDENTIFICATION_NUMBER',
                                                            'match': 'string',
                                                            'action': 'BLOCKED'|'ANONYMIZED'
                                                        },
                                                    ],
                                                    'regexes': [
                                                        {
                                                            'name': 'string',
                                                            'regex': 'string',
                                                            'match': 'string',
                                                            'action': 'BLOCKED'|'ANONYMIZED'
                                                        },
                                                    ]
                                                }
                                            },
                                        ],
                                        'outputAssessments': [
                                            {
                                                'topicPolicy': {
                                                    'topics': [
                                                        {
                                                            'name': 'string',
                                                            'type': 'DENY',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ]
                                                },
                                                'contentPolicy': {
                                                    'filters': [
                                                        {
                                                            'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK',
                                                            'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ]
                                                },
                                                'wordPolicy': {
                                                    'customWords': [
                                                        {
                                                            'match': 'string',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ],
                                                    'managedWordLists': [
                                                        {
                                                            'match': 'string',
                                                            'type': 'PROFANITY',
                                                            'action': 'BLOCKED'
                                                        },
                                                    ]
                                                },
                                                'sensitiveInformationPolicy': {
                                                    'piiEntities': [
                                                        {
                                                            'type': 'ADDRESS'|'AGE'|'AWS_ACCESS_KEY'|'AWS_SECRET_KEY'|'CA_HEALTH_NUMBER'|'CA_SOCIAL_INSURANCE_NUMBER'|'CREDIT_DEBIT_CARD_CVV'|'CREDIT_DEBIT_CARD_EXPIRY'|'CREDIT_DEBIT_CARD_NUMBER'|'DRIVER_ID'|'EMAIL'|'INTERNATIONAL_BANK_ACCOUNT_NUMBER'|'IP_ADDRESS'|'LICENSE_PLATE'|'MAC_ADDRESS'|'NAME'|'PASSWORD'|'PHONE'|'PIN'|'SWIFT_CODE'|'UK_NATIONAL_HEALTH_SERVICE_NUMBER'|'UK_NATIONAL_INSURANCE_NUMBER'|'UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER'|'URL'|'USERNAME'|'US_BANK_ACCOUNT_NUMBER'|'US_BANK_ROUTING_NUMBER'|'US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER'|'US_PASSPORT_NUMBER'|'US_SOCIAL_SECURITY_NUMBER'|'VEHICLE_IDENTIFICATION_NUMBER',
                                                            'match': 'string',
                                                            'action': 'BLOCKED'|'ANONYMIZED'
                                                        },
                                                    ],
                                                    'regexes': [
                                                        {
                                                            'name': 'string',
                                                            'regex': 'string',
                                                            'match': 'string',
                                                            'action': 'BLOCKED'|'ANONYMIZED'
                                                        },
                                                    ]
                                                }
                                            },
                                        ],
                                        'metadata': {
                                            'startTime': datetime(2015, 1, 1),
                                            'endTime': datetime(2015, 1, 1),
                                            'totalTimeMs': 123,
                                            'operationTotalTimeMs': 123,
                                            'clientRequestId': 'string',
                                            'usage': {
                                                'inputTokens': 123,
                                                'outputTokens': 123
                                            }
                                        }
                                    },
                                    'preProcessingTrace': {
                                        'modelInvocationInput': {
                                            'traceId': 'string',
                                            'text': 'string',
                                            'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER',
                                            'overrideLambda': 'string',
                                            'promptCreationMode': 'DEFAULT'|'OVERRIDDEN',
                                            'inferenceConfiguration': {
                                                'temperature': ...,
                                                'topP': ...,
                                                'topK': 123,
                                                'maximumLength': 123,
                                                'stopSequences': [
                                                    'string',
                                                ]
                                            },
                                            'parserMode': 'DEFAULT'|'OVERRIDDEN',
                                            'foundationModel': 'string'
                                        },
                                        'modelInvocationOutput': {
                                            'traceId': 'string',
                                            'parsedResponse': {
                                                'rationale': 'string',
                                                'isValid': True|False
                                            },
                                            'rawResponse': {
                                                'content': 'string'
                                            },
                                            'metadata': {
                                                'startTime': datetime(2015, 1, 1),
                                                'endTime': datetime(2015, 1, 1),
                                                'totalTimeMs': 123,
                                                'operationTotalTimeMs': 123,
                                                'clientRequestId': 'string',
                                                'usage': {
                                                    'inputTokens': 123,
                                                    'outputTokens': 123
                                                }
                                            },
                                            'reasoningContent': {
                                                'reasoningText': {
                                                    'text': 'string',
                                                    'signature': 'string'
                                                },
                                                'redactedContent': b'bytes'
                                            }
                                        }
                                    },
                                    'orchestrationTrace': {
                                        'rationale': {
                                            'traceId': 'string',
                                            'text': 'string'
                                        },
                                        'invocationInput': {
                                            'traceId': 'string',
                                            'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR',
                                            'actionGroupInvocationInput': {
                                                'actionGroupName': 'string',
                                                'verb': 'string',
                                                'apiPath': 'string',
                                                'parameters': [
                                                    {
                                                        'name': 'string',
                                                        'type': 'string',
                                                        'value': 'string'
                                                    },
                                                ],
                                                'requestBody': {
                                                    'content': {
                                                        'string': [
                                                            {
                                                                'name': 'string',
                                                                'type': 'string',
                                                                'value': 'string'
                                                            },
                                                        ]
                                                    }
                                                },
                                                'function': 'string',
                                                'executionType': 'LAMBDA'|'RETURN_CONTROL',
                                                'invocationId': 'string'
                                            },
                                            'knowledgeBaseLookupInput': {
                                                'text': 'string',
                                                'knowledgeBaseId': 'string'
                                            },
                                            'codeInterpreterInvocationInput': {
                                                'code': 'string',
                                                'files': [
                                                    'string',
                                                ]
                                            },
                                            'agentCollaboratorInvocationInput': {
                                                'agentCollaboratorName': 'string',
                                                'agentCollaboratorAliasArn': 'string',
                                                'input': {
                                                    'type': 'TEXT'|'RETURN_CONTROL',
                                                    'text': 'string',
                                                    'returnControlResults': {
                                                        'invocationId': 'string',
                                                        'returnControlInvocationResults': [
                                                            {
                                                                'apiResult': {
                                                                    'actionGroup': 'string',
                                                                    'httpMethod': 'string',
                                                                    'apiPath': 'string',
                                                                    'confirmationState': 'CONFIRM'|'DENY',
                                                                    'responseState': 'FAILURE'|'REPROMPT',
                                                                    'httpStatusCode': 123,
                                                                    'responseBody': {
                                                                        'string': {
                                                                            'body': 'string',
                                                                            'images': [
                                                                                {
                                                                                    'format': 'png'|'jpeg'|'gif'|'webp',
                                                                                    'source': {
                                                                                        'bytes': b'bytes'
                                                                                    }
                                                                                },
                                                                            ]
                                                                        }
                                                                    },
                                                                    'agentId': 'string'
                                                                },
                                                                'functionResult': {
                                                                    'actionGroup': 'string',
                                                                    'confirmationState': 'CONFIRM'|'DENY',
                                                                    'function': 'string',
                                                                    'responseBody': {
                                                                        'string': {
                                                                            'body': 'string',
                                                                            'images': [
                                                                                {
                                                                                    'format': 'png'|'jpeg'|'gif'|'webp',
                                                                                    'source': {
                                                                                        'bytes': b'bytes'
                                                                                    }
                                                                                },
                                                                            ]
                                                                        }
                                                                    },
                                                                    'responseState': 'FAILURE'|'REPROMPT',
                                                                    'agentId': 'string'
                                                                }
                                                            },
                                                        ]
                                                    }
                                                }
                                            }
                                        },
                                        'observation': {
                                            'traceId': 'string',
                                            'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT',
                                            'actionGroupInvocationOutput': {
                                                'text': 'string',
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'agentCollaboratorInvocationOutput': {
                                                'agentCollaboratorName': 'string',
                                                'agentCollaboratorAliasArn': 'string',
                                                'output': {
                                                    'type': 'TEXT'|'RETURN_CONTROL',
                                                    'text': 'string',
                                                    'returnControlPayload': {
                                                        'invocationInputs': [
                                                            {
                                                                'apiInvocationInput': {
                                                                    'actionGroup': 'string',
                                                                    'httpMethod': 'string',
                                                                    'apiPath': 'string',
                                                                    'parameters': [
                                                                        {
                                                                            'name': 'string',
                                                                            'type': 'string',
                                                                            'value': 'string'
                                                                        },
                                                                    ],
                                                                    'requestBody': {
                                                                        'content': {
                                                                            'string': {
                                                                                'properties': [
                                                                                    {
                                                                                        'name': 'string',
                                                                                        'type': 'string',
                                                                                        'value': 'string'
                                                                                    },
                                                                                ]
                                                                            }
                                                                        }
                                                                    },
                                                                    'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT',
                                                                    'agentId': 'string',
                                                                    'collaboratorName': 'string'
                                                                },
                                                                'functionInvocationInput': {
                                                                    'actionGroup': 'string',
                                                                    'parameters': [
                                                                        {
                                                                            'name': 'string',
                                                                            'type': 'string',
                                                                            'value': 'string'
                                                                        },
                                                                    ],
                                                                    'function': 'string',
                                                                    'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT',
                                                                    'agentId': 'string',
                                                                    'collaboratorName': 'string'
                                                                }
                                                            },
                                                        ],
                                                        'invocationId': 'string'
                                                    }
                                                },
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'knowledgeBaseLookupOutput': {
                                                'retrievedReferences': [
                                                    {
                                                        'content': {
                                                            'type': 'TEXT'|'IMAGE'|'ROW',
                                                            'text': 'string',
                                                            'byteContent': 'string',
                                                            'row': [
                                                                {
                                                                    'columnName': 'string',
                                                                    'columnValue': 'string',
                                                                    'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING'
                                                                },
                                                            ]
                                                        },
                                                        'location': {
                                                            'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL',
                                                            's3Location': {
                                                                'uri': 'string'
                                                            },
                                                            'webLocation': {
                                                                'url': 'string'
                                                            },
                                                            'confluenceLocation': {
                                                                'url': 'string'
                                                            },
                                                            'salesforceLocation': {
                                                                'url': 'string'
                                                            },
                                                            'sharePointLocation': {
                                                                'url': 'string'
                                                            },
                                                            'customDocumentLocation': {
                                                                'id': 'string'
                                                            },
                                                            'kendraDocumentLocation': {
                                                                'uri': 'string'
                                                            },
                                                            'sqlLocation': {
                                                                'query': 'string'
                                                            }
                                                        },
                                                        'metadata': {
                                                            'string': {...}|[...]|123|123.4|'string'|True|None
                                                        }
                                                    },
                                                ],
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'finalResponse': {
                                                'text': 'string',
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'repromptResponse': {
                                                'text': 'string',
                                                'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER'
                                            },
                                            'codeInterpreterInvocationOutput': {
                                                'executionOutput': 'string',
                                                'executionError': 'string',
                                                'files': [
                                                    'string',
                                                ],
                                                'executionTimeout': True|False,
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            }
                                        },
                                        'modelInvocationInput': {
                                            'traceId': 'string',
                                            'text': 'string',
                                            'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER',
                                            'overrideLambda': 'string',
                                            'promptCreationMode': 'DEFAULT'|'OVERRIDDEN',
                                            'inferenceConfiguration': {
                                                'temperature': ...,
                                                'topP': ...,
                                                'topK': 123,
                                                'maximumLength': 123,
                                                'stopSequences': [
                                                    'string',
                                                ]
                                            },
                                            'parserMode': 'DEFAULT'|'OVERRIDDEN',
                                            'foundationModel': 'string'
                                        },
                                        'modelInvocationOutput': {
                                            'traceId': 'string',
                                            'rawResponse': {
                                                'content': 'string'
                                            },
                                            'metadata': {
                                                'startTime': datetime(2015, 1, 1),
                                                'endTime': datetime(2015, 1, 1),
                                                'totalTimeMs': 123,
                                                'operationTotalTimeMs': 123,
                                                'clientRequestId': 'string',
                                                'usage': {
                                                    'inputTokens': 123,
                                                    'outputTokens': 123
                                                }
                                            },
                                            'reasoningContent': {
                                                'reasoningText': {
                                                    'text': 'string',
                                                    'signature': 'string'
                                                },
                                                'redactedContent': b'bytes'
                                            }
                                        }
                                    },
                                    'postProcessingTrace': {
                                        'modelInvocationInput': {
                                            'traceId': 'string',
                                            'text': 'string',
                                            'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER',
                                            'overrideLambda': 'string',
                                            'promptCreationMode': 'DEFAULT'|'OVERRIDDEN',
                                            'inferenceConfiguration': {
                                                'temperature': ...,
                                                'topP': ...,
                                                'topK': 123,
                                                'maximumLength': 123,
                                                'stopSequences': [
                                                    'string',
                                                ]
                                            },
                                            'parserMode': 'DEFAULT'|'OVERRIDDEN',
                                            'foundationModel': 'string'
                                        },
                                        'modelInvocationOutput': {
                                            'traceId': 'string',
                                            'parsedResponse': {
                                                'text': 'string'
                                            },
                                            'rawResponse': {
                                                'content': 'string'
                                            },
                                            'metadata': {
                                                'startTime': datetime(2015, 1, 1),
                                                'endTime': datetime(2015, 1, 1),
                                                'totalTimeMs': 123,
                                                'operationTotalTimeMs': 123,
                                                'clientRequestId': 'string',
                                                'usage': {
                                                    'inputTokens': 123,
                                                    'outputTokens': 123
                                                }
                                            },
                                            'reasoningContent': {
                                                'reasoningText': {
                                                    'text': 'string',
                                                    'signature': 'string'
                                                },
                                                'redactedContent': b'bytes'
                                            }
                                        }
                                    },
                                    'routingClassifierTrace': {
                                        'invocationInput': {
                                            'traceId': 'string',
                                            'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR',
                                            'actionGroupInvocationInput': {
                                                'actionGroupName': 'string',
                                                'verb': 'string',
                                                'apiPath': 'string',
                                                'parameters': [
                                                    {
                                                        'name': 'string',
                                                        'type': 'string',
                                                        'value': 'string'
                                                    },
                                                ],
                                                'requestBody': {
                                                    'content': {
                                                        'string': [
                                                            {
                                                                'name': 'string',
                                                                'type': 'string',
                                                                'value': 'string'
                                                            },
                                                        ]
                                                    }
                                                },
                                                'function': 'string',
                                                'executionType': 'LAMBDA'|'RETURN_CONTROL',
                                                'invocationId': 'string'
                                            },
                                            'knowledgeBaseLookupInput': {
                                                'text': 'string',
                                                'knowledgeBaseId': 'string'
                                            },
                                            'codeInterpreterInvocationInput': {
                                                'code': 'string',
                                                'files': [
                                                    'string',
                                                ]
                                            },
                                            'agentCollaboratorInvocationInput': {
                                                'agentCollaboratorName': 'string',
                                                'agentCollaboratorAliasArn': 'string',
                                                'input': {
                                                    'type': 'TEXT'|'RETURN_CONTROL',
                                                    'text': 'string',
                                                    'returnControlResults': {
                                                        'invocationId': 'string',
                                                        'returnControlInvocationResults': [
                                                            {
                                                                'apiResult': {
                                                                    'actionGroup': 'string',
                                                                    'httpMethod': 'string',
                                                                    'apiPath': 'string',
                                                                    'confirmationState': 'CONFIRM'|'DENY',
                                                                    'responseState': 'FAILURE'|'REPROMPT',
                                                                    'httpStatusCode': 123,
                                                                    'responseBody': {
                                                                        'string': {
                                                                            'body': 'string',
                                                                            'images': [
                                                                                {
                                                                                    'format': 'png'|'jpeg'|'gif'|'webp',
                                                                                    'source': {
                                                                                        'bytes': b'bytes'
                                                                                    }
                                                                                },
                                                                            ]
                                                                        }
                                                                    },
                                                                    'agentId': 'string'
                                                                },
                                                                'functionResult': {
                                                                    'actionGroup': 'string',
                                                                    'confirmationState': 'CONFIRM'|'DENY',
                                                                    'function': 'string',
                                                                    'responseBody': {
                                                                        'string': {
                                                                            'body': 'string',
                                                                            'images': [
                                                                                {
                                                                                    'format': 'png'|'jpeg'|'gif'|'webp',
                                                                                    'source': {
                                                                                        'bytes': b'bytes'
                                                                                    }
                                                                                },
                                                                            ]
                                                                        }
                                                                    },
                                                                    'responseState': 'FAILURE'|'REPROMPT',
                                                                    'agentId': 'string'
                                                                }
                                                            },
                                                        ]
                                                    }
                                                }
                                            }
                                        },
                                        'observation': {
                                            'traceId': 'string',
                                            'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT',
                                            'actionGroupInvocationOutput': {
                                                'text': 'string',
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'agentCollaboratorInvocationOutput': {
                                                'agentCollaboratorName': 'string',
                                                'agentCollaboratorAliasArn': 'string',
                                                'output': {
                                                    'type': 'TEXT'|'RETURN_CONTROL',
                                                    'text': 'string',
                                                    'returnControlPayload': {
                                                        'invocationInputs': [
                                                            {
                                                                'apiInvocationInput': {
                                                                    'actionGroup': 'string',
                                                                    'httpMethod': 'string',
                                                                    'apiPath': 'string',
                                                                    'parameters': [
                                                                        {
                                                                            'name': 'string',
                                                                            'type': 'string',
                                                                            'value': 'string'
                                                                        },
                                                                    ],
                                                                    'requestBody': {
                                                                        'content': {
                                                                            'string': {
                                                                                'properties': [
                                                                                    {
                                                                                        'name': 'string',
                                                                                        'type': 'string',
                                                                                        'value': 'string'
                                                                                    },
                                                                                ]
                                                                            }
                                                                        }
                                                                    },
                                                                    'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT',
                                                                    'agentId': 'string',
                                                                    'collaboratorName': 'string'
                                                                },
                                                                'functionInvocationInput': {
                                                                    'actionGroup': 'string',
                                                                    'parameters': [
                                                                        {
                                                                            'name': 'string',
                                                                            'type': 'string',
                                                                            'value': 'string'
                                                                        },
                                                                    ],
                                                                    'function': 'string',
                                                                    'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT',
                                                                    'agentId': 'string',
                                                                    'collaboratorName': 'string'
                                                                }
                                                            },
                                                        ],
                                                        'invocationId': 'string'
                                                    }
                                                },
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'knowledgeBaseLookupOutput': {
                                                'retrievedReferences': [
                                                    {
                                                        'content': {
                                                            'type': 'TEXT'|'IMAGE'|'ROW',
                                                            'text': 'string',
                                                            'byteContent': 'string',
                                                            'row': [
                                                                {
                                                                    'columnName': 'string',
                                                                    'columnValue': 'string',
                                                                    'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING'
                                                                },
                                                            ]
                                                        },
                                                        'location': {
                                                            'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL',
                                                            's3Location': {
                                                                'uri': 'string'
                                                            },
                                                            'webLocation': {
                                                                'url': 'string'
                                                            },
                                                            'confluenceLocation': {
                                                                'url': 'string'
                                                            },
                                                            'salesforceLocation': {
                                                                'url': 'string'
                                                            },
                                                            'sharePointLocation': {
                                                                'url': 'string'
                                                            },
                                                            'customDocumentLocation': {
                                                                'id': 'string'
                                                            },
                                                            'kendraDocumentLocation': {
                                                                'uri': 'string'
                                                            },
                                                            'sqlLocation': {
                                                                'query': 'string'
                                                            }
                                                        },
                                                        'metadata': {
                                                            'string': {...}|[...]|123|123.4|'string'|True|None
                                                        }
                                                    },
                                                ],
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'finalResponse': {
                                                'text': 'string',
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            },
                                            'repromptResponse': {
                                                'text': 'string',
                                                'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER'
                                            },
                                            'codeInterpreterInvocationOutput': {
                                                'executionOutput': 'string',
                                                'executionError': 'string',
                                                'files': [
                                                    'string',
                                                ],
                                                'executionTimeout': True|False,
                                                'metadata': {
                                                    'startTime': datetime(2015, 1, 1),
                                                    'endTime': datetime(2015, 1, 1),
                                                    'totalTimeMs': 123,
                                                    'operationTotalTimeMs': 123,
                                                    'clientRequestId': 'string',
                                                    'usage': {
                                                        'inputTokens': 123,
                                                        'outputTokens': 123
                                                    }
                                                }
                                            }
                                        },
                                        'modelInvocationInput': {
                                            'traceId': 'string',
                                            'text': 'string',
                                            'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER',
                                            'overrideLambda': 'string',
                                            'promptCreationMode': 'DEFAULT'|'OVERRIDDEN',
                                            'inferenceConfiguration': {
                                                'temperature': ...,
                                                'topP': ...,
                                                'topK': 123,
                                                'maximumLength': 123,
                                                'stopSequences': [
                                                    'string',
                                                ]
                                            },
                                            'parserMode': 'DEFAULT'|'OVERRIDDEN',
                                            'foundationModel': 'string'
                                        },
                                        'modelInvocationOutput': {
                                            'traceId': 'string',
                                            'rawResponse': {
                                                'content': 'string'
                                            },
                                            'metadata': {
                                                'startTime': datetime(2015, 1, 1),
                                                'endTime': datetime(2015, 1, 1),
                                                'totalTimeMs': 123,
                                                'operationTotalTimeMs': 123,
                                                'clientRequestId': 'string',
                                                'usage': {
                                                    'inputTokens': 123,
                                                    'outputTokens': 123
                                                }
                                            }
                                        }
                                    },
                                    'failureTrace': {
                                        'traceId': 'string',
                                        'failureReason': 'string',
                                        'failureCode': 123,
                                        'metadata': {
                                            'startTime': datetime(2015, 1, 1),
                                            'endTime': datetime(2015, 1, 1),
                                            'totalTimeMs': 123,
                                            'operationTotalTimeMs': 123,
                                            'clientRequestId': 'string',
                                            'usage': {
                                                'inputTokens': 123,
                                                'outputTokens': 123
                                            }
                                        }
                                    },
                                    'customOrchestrationTrace': {
                                        'traceId': 'string',
                                        'event': {
                                            'text': 'string'
                                        }
                                    }
                                },
                                'callerChain': [
                                    {
                                        'agentAliasArn': 'string'
                                    },
                                ],
                                'eventTime': datetime(2015, 1, 1),
                                'collaboratorName': 'string',
                                'agentId': 'string',
                                'agentAliasId': 'string',
                                'agentVersion': 'string'
                            },
                        ]
                    }
                }
            }
        },
        'internalServerException': {
            'message': 'string',
            'reason': 'string'
        },
        'validationException': {
            'message': 'string'
        },
        'resourceNotFoundException': {
            'message': 'string'
        },
        'serviceQuotaExceededException': {
            'message': 'string'
        },
        'throttlingException': {
            'message': 'string'
        },
        'accessDeniedException': {
            'message': 'string'
        },
        'conflictException': {
            'message': 'string'
        },
        'dependencyFailedException': {
            'message': 'string',
            'resourceName': 'string'
        },
        'badGatewayException': {
            'message': 'string',
            'resourceName': 'string'
        },
        'flowMultiTurnInputRequestEvent': {
            'nodeName': 'string',
            'nodeType': 'FlowInputNode'|'FlowOutputNode'|'LambdaFunctionNode'|'KnowledgeBaseNode'|'PromptNode'|'ConditionNode'|'LexNode',
            'content': {
                'document': {...}|[...]|123|123.4|'string'|True|None
            }
        }
    }),
    'executionId': 'string'
}

Response Structure

# This section is too large to render.
# Please see the AWS API Documentation linked below.

AWS API Documentation

Exceptions

  • AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundException

  • AgentsforBedrockRuntime.Client.exceptions.ConflictException

  • AgentsforBedrockRuntime.Client.exceptions.ValidationException

  • AgentsforBedrockRuntime.Client.exceptions.InternalServerException

  • AgentsforBedrockRuntime.Client.exceptions.DependencyFailedException

  • AgentsforBedrockRuntime.Client.exceptions.BadGatewayException

  • AgentsforBedrockRuntime.Client.exceptions.ThrottlingException

  • AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException

  • AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededException