Bedrock / Client / start_automated_reasoning_policy_build_workflow

start_automated_reasoning_policy_build_workflow

Bedrock.Client.start_automated_reasoning_policy_build_workflow(**kwargs)

Starts a new build workflow for an Automated Reasoning policy. This initiates the process of analyzing source documents and generating policy rules, variables, and types.

See also: AWS API Documentation

Request Syntax

response = client.start_automated_reasoning_policy_build_workflow(
    policyArn='string',
    buildWorkflowType='INGEST_CONTENT'|'REFINE_POLICY'|'IMPORT_POLICY',
    clientRequestToken='string',
    sourceContent={
        'policyDefinition': {
            'version': 'string',
            'types': [
                {
                    'name': 'string',
                    'description': 'string',
                    'values': [
                        {
                            'value': 'string',
                            'description': 'string'
                        },
                    ]
                },
            ],
            'rules': [
                {
                    'id': 'string',
                    'expression': 'string',
                    'alternateExpression': 'string'
                },
            ],
            'variables': [
                {
                    'name': 'string',
                    'type': 'string',
                    'description': 'string'
                },
            ]
        },
        'workflowContent': {
            'documents': [
                {
                    'document': b'bytes',
                    'documentContentType': 'pdf'|'txt',
                    'documentName': 'string',
                    'documentDescription': 'string'
                },
            ],
            'policyRepairAssets': {
                'annotations': [
                    {
                        'addType': {
                            'name': 'string',
                            'description': 'string',
                            'values': [
                                {
                                    'value': 'string',
                                    'description': 'string'
                                },
                            ]
                        },
                        'updateType': {
                            'name': 'string',
                            'newName': 'string',
                            'description': 'string',
                            'values': [
                                {
                                    'addTypeValue': {
                                        'value': 'string',
                                        'description': 'string'
                                    },
                                    'updateTypeValue': {
                                        'value': 'string',
                                        'newValue': 'string',
                                        'description': 'string'
                                    },
                                    'deleteTypeValue': {
                                        'value': 'string'
                                    }
                                },
                            ]
                        },
                        'deleteType': {
                            'name': 'string'
                        },
                        'addVariable': {
                            'name': 'string',
                            'type': 'string',
                            'description': 'string'
                        },
                        'updateVariable': {
                            'name': 'string',
                            'newName': 'string',
                            'description': 'string'
                        },
                        'deleteVariable': {
                            'name': 'string'
                        },
                        'addRule': {
                            'expression': 'string'
                        },
                        'updateRule': {
                            'ruleId': 'string',
                            'expression': 'string'
                        },
                        'deleteRule': {
                            'ruleId': 'string'
                        },
                        'addRuleFromNaturalLanguage': {
                            'naturalLanguage': 'string'
                        },
                        'updateFromRulesFeedback': {
                            'ruleIds': [
                                'string',
                            ],
                            'feedback': 'string'
                        },
                        'updateFromScenarioFeedback': {
                            'ruleIds': [
                                'string',
                            ],
                            'scenarioExpression': 'string',
                            'feedback': 'string'
                        },
                        'ingestContent': {
                            'content': 'string'
                        }
                    },
                ]
            }
        }
    }
)
Parameters:
  • policyArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Automated Reasoning policy for which to start the build workflow.

  • buildWorkflowType (string) –

    [REQUIRED]

    The type of build workflow to start (e.g., DOCUMENT_INGESTION for processing new documents, POLICY_REPAIR for fixing existing policies).

  • clientRequestToken (string) –

    A unique, case-sensitive identifier to ensure that the operation completes no more than once. If this token matches a previous request, Amazon Bedrock ignores the request but doesn’t return an error.

    This field is autopopulated if not provided.

  • sourceContent (dict) –

    [REQUIRED]

    The source content for the build workflow, such as documents to analyze or repair instructions for existing policies.

    • policyDefinition (dict) –

      An existing policy definition that serves as the starting point for the build workflow, typically used in policy repair or update scenarios.

      • version (string) –

        The version of the policy definition format.

      • types (list) –

        The custom user-defined vairable types used in the policy. Types are enum-based variable types that provide additional context beyond the predefined variable types.

        • (dict) –

          Represents a custom user-defined viarble type in an Automated Reasoning policy. Types are enum-based and provide additional context beyond predefined variable types.

          • name (string) – [REQUIRED]

            The name of the custom type.

          • description (string) –

            The description of what the custom type represents.

          • values (list) – [REQUIRED]

            The possible values for this enum-based type, each with its own description.

            • (dict) –

              Represents a single value within a custom type definition, including its identifier and description.

              • value (string) – [REQUIRED]

                The actual value or identifier for this type value.

              • description (string) –

                A human-readable description explaining what this type value represents and when it should be used.

      • rules (list) –

        The formal logic rules extracted from the source document. Rules define the logical constraints that determine whether model responses are valid, invalid, or satisfiable.

        • (dict) –

          Represents a formal logic rule in an Automated Reasoning policy. For example, rules can be expressed as if-then statements that define logical constraints.

          • id (string) – [REQUIRED]

            The unique identifier of the rule within the policy.

          • expression (string) – [REQUIRED]

            The formal logic expression of the rule.

          • alternateExpression (string) –

            The human-readable form of the rule expression, often in natural language or simplified notation.

      • variables (list) –

        The variables that represent concepts in the policy. Variables can have values assigned when translating natural language into formal logic. Their descriptions are crucial for accurate translation.

        • (dict) –

          Represents a variable in an Automated Reasoning policy. Variables represent concepts that can have values assigned during natural language translation.

          • name (string) – [REQUIRED]

            The name of the variable. Use descriptive names that clearly indicate the concept being represented.

          • type (string) – [REQUIRED]

            The data type of the variable. Valid types include bool, int, real, enum, and custom types that you can provide.

          • description (string) – [REQUIRED]

            The description of the variable that explains what it represents and how users might refer to it. Clear and comprehensive descriptions are essential for accurate natural language translation.

    • workflowContent (dict) –

      The actual content to be processed in the build workflow, such as documents to analyze or repair instructions to apply.

      Note

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

      • documents (list) –

        The list of documents to be processed in a document ingestion workflow.

        • (dict) –

          Represents a source document used in the policy build workflow, containing the content and metadata needed for policy generation.

          • document (bytes) – [REQUIRED]

            The actual content of the source document that will be analyzed to extract policy rules and concepts.

          • documentContentType (string) – [REQUIRED]

            The MIME type of the document content (e.g., text/plain, application/pdf, text/markdown).

          • documentName (string) – [REQUIRED]

            A descriptive name for the document that helps identify its purpose and content.

          • documentDescription (string) –

            A detailed description of the document’s content and how it should be used in the policy generation process.

      • policyRepairAssets (dict) –

        The assets and instructions needed for a policy repair workflow, including repair annotations and guidance.

        • annotations (list) – [REQUIRED]

          Specific annotations or modifications to apply during the policy repair process, such as rule corrections or variable updates.

          • (dict) –

            Contains the various operations that can be performed on an Automated Reasoning policy, including adding, updating, and deleting rules, variables, and types.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: addType, updateType, deleteType, addVariable, updateVariable, deleteVariable, addRule, updateRule, deleteRule, addRuleFromNaturalLanguage, updateFromRulesFeedback, updateFromScenarioFeedback, ingestContent.

            • addType (dict) –

              An operation to add a new custom type to the policy, defining a set of possible values for policy variables.

              • name (string) – [REQUIRED]

                The name of the new custom type. This name will be used to reference the type in variable definitions and rules.

              • description (string) – [REQUIRED]

                A description of what the custom type represents and how it should be used in the policy.

              • values (list) – [REQUIRED]

                The list of possible values that variables of this type can take, each with its own description and identifier.

                • (dict) –

                  Represents a single value within a custom type definition, including its identifier and description.

                  • value (string) – [REQUIRED]

                    The actual value or identifier for this type value.

                  • description (string) –

                    A human-readable description explaining what this type value represents and when it should be used.

            • updateType (dict) –

              An operation to modify an existing custom type in the policy, such as changing its name, description, or allowed values.

              • name (string) – [REQUIRED]

                The current name of the custom type to update.

              • newName (string) –

                The new name for the custom type, if you want to rename it. If not provided, the name remains unchanged.

              • description (string) –

                The new description for the custom type, replacing the previous description.

              • values (list) – [REQUIRED]

                The updated list of values for the custom type, which can include additions, modifications, or removals.

                • (dict) –

                  An annotation for managing values within custom types, including adding, updating, or removing specific type values.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys can be set: addTypeValue, updateTypeValue, deleteTypeValue.

                  • addTypeValue (dict) –

                    An operation to add a new value to an existing custom type.

                    • value (string) – [REQUIRED]

                      The identifier or name of the new value to add to the type.

                    • description (string) –

                      A description of what this new type value represents and when it should be used.

                  • updateTypeValue (dict) –

                    An operation to modify an existing value within a custom type.

                    • value (string) – [REQUIRED]

                      The current identifier or name of the type value to update.

                    • newValue (string) –

                      The new identifier or name for the type value, if you want to rename it.

                    • description (string) –

                      The new description for the type value, replacing the previous description.

                  • deleteTypeValue (dict) –

                    An operation to remove a value from an existing custom type.

                    • value (string) – [REQUIRED]

                      The identifier or name of the value to remove from the type.

            • deleteType (dict) –

              An operation to remove a custom type from the policy. The type must not be referenced by any variables or rules.

              • name (string) – [REQUIRED]

                The name of the custom type to delete from the policy. The type must not be referenced by any variables or rules.

            • addVariable (dict) –

              An operation to add a new variable to the policy, which can be used in rule expressions to represent dynamic values.

              • name (string) – [REQUIRED]

                The name of the new variable. This name will be used to reference the variable in rule expressions.

              • type (string) – [REQUIRED]

                The type of the variable, which can be a built-in type (like string or number) or a custom type defined in the policy.

              • description (string) – [REQUIRED]

                A description of what the variable represents and how it should be used in rules.

            • updateVariable (dict) –

              An operation to modify an existing variable in the policy, such as changing its name, type, or description.

              • name (string) – [REQUIRED]

                The current name of the variable to update.

              • newName (string) –

                The new name for the variable, if you want to rename it. If not provided, the name remains unchanged.

              • description (string) –

                The new description for the variable, replacing the previous description.

            • deleteVariable (dict) –

              An operation to remove a variable from the policy. The variable must not be referenced by any rules.

              • name (string) – [REQUIRED]

                The name of the variable to delete from the policy. The variable must not be referenced by any rules.

            • addRule (dict) –

              An operation to add a new logical rule to the policy using formal mathematical expressions.

              • expression (string) – [REQUIRED]

                The formal logical expression that defines the rule, using mathematical notation and referencing policy variables and types.

            • updateRule (dict) –

              An operation to modify an existing rule in the policy, such as changing its logical expression or conditions.

              • ruleId (string) – [REQUIRED]

                The unique identifier of the rule to update.

              • expression (string) – [REQUIRED]

                The new formal logical expression for the rule, replacing the previous expression.

            • deleteRule (dict) –

              An operation to remove a rule from the policy.

              • ruleId (string) – [REQUIRED]

                The unique identifier of the rule to delete from the policy.

            • addRuleFromNaturalLanguage (dict) –

              An operation to add a new rule by converting natural language descriptions into formal logical expressions.

              • naturalLanguage (string) – [REQUIRED]

                The natural language description of the rule that should be converted into a formal logical expression.

            • updateFromRulesFeedback (dict) –

              An operation to update the policy based on feedback about how specific rules performed during testing or validation.

              • ruleIds (list) –

                The list of rule identifiers that the feedback applies to.

                • (string) –

              • feedback (string) – [REQUIRED]

                The feedback information about rule performance, including suggestions for improvements or corrections.

            • updateFromScenarioFeedback (dict) –

              An operation to update the policy based on feedback about how it performed on specific test scenarios.

              • ruleIds (list) –

                The list of rule identifiers that were involved in the scenario being evaluated.

                • (string) –

              • scenarioExpression (string) – [REQUIRED]

                The logical expression that defines the test scenario that generated this feedback.

              • feedback (string) –

                The feedback information about scenario performance, including any issues or improvements identified.

            • ingestContent (dict) –

              An operation to process and incorporate new content into the policy, extracting additional rules and concepts.

              • content (string) – [REQUIRED]

                The new content to be analyzed and incorporated into the policy, such as additional documents or rule descriptions.

Return type:

dict

Returns:

Response Syntax

{
    'policyArn': 'string',
    'buildWorkflowId': 'string'
}

Response Structure

  • (dict) –

    • policyArn (string) –

      The Amazon Resource Name (ARN) of the Automated Reasoning policy.

    • buildWorkflowId (string) –

      The unique identifier of the newly started build workflow. Use this ID to track the workflow’s progress and retrieve its results.

Exceptions

  • Bedrock.Client.exceptions.ResourceNotFoundException

  • Bedrock.Client.exceptions.AccessDeniedException

  • Bedrock.Client.exceptions.ValidationException

  • Bedrock.Client.exceptions.ConflictException

  • Bedrock.Client.exceptions.InternalServerException

  • Bedrock.Client.exceptions.ServiceQuotaExceededException

  • Bedrock.Client.exceptions.ResourceInUseException

  • Bedrock.Client.exceptions.ThrottlingException