Prompting for loops
- Updated: 2024/11/19
Prompting for loops
Co-Pilot for Automators supports loop logic in natural language prompts and can recognize the type of iterator based on the action.
Developers can capitalize on Co-Pilot for Automators to accelerate the development process using a natural language prompt. When building an automation scenario that needs loop logic, developers can simply describe the scenario to quickly generate and sequence the necessary actions and iterator type. With the required actions and iterator established in the canvas, developers can focus on specializing the automation with values of variables and configurations.
Instructions of your prompt
When sending a prompt through Co-Pilot for Automators, you directly engage the orchestrator where instructions are recognized by actions available in the Bot editor. Co-Pilot then populates and sequences those actions into a structure on the canvas for further development. When writing instruction for prompts to build loops, the generated structure includes the sequenced actions you describe and automatically sets the iterator type and items for the automation to loop through, relative to the actions. The remaining work becomes much easier with the structure visibly available to review and edit where remaining details are needed.
Loop logic is recognized by the instructions and parameters described in a prompt when an
iterator exists for an action. The type of loop is generated respective to the
properties of the items (ex. for each file in a folder
,
while a program is open
).
Verify results
After the loop is generated via prompt, verify the configurations in the action settings to ensure accuracy of the resulting automation. For example, if the iterator type is files in a folder, the folder path is a property you enter in your prompt and should verify in the action settings.
Best practices
- Add variables before sending prompt.
- Any variables required in the instructions should be added to the
automation file before sending the prompt. Variables existing in the
file are recognized in the prompt by proper naming convention
(
$var1$
), and mapped accordingly in the automation. Variables that do not exist in the file and are required for the automation described by your prompt are generated by default. These default variables need verification and configuration to set the values, after the prompt has been entered. - Include complete automation scenario in prompt, where possible.
- When you are ready to enter your prompt, describe your whole automation scenario in a single prompt. If the scenario is too long or complex, divide the scenario into sections of operations. Then enter a prompt for each operation to your automation flow by section.
Get started
Use the following example to build your automation using prompts. See, Example of prompt to loop logic