Press "Enter" to skip to content

How to build flows in Microsoft’s Power Automate with AI to speed up app development

Image: Rafael Henrique/Adobe Stock

Low- and no-code development is an important piece of the modern IT landscape and provides a way for users to fill the app gap by building the tools they need using workflow automation and simple UI tooling. There’s no need to learn complex programming languages: All you need to do is add rules to connections between applications, data and users.

SEE: Feature comparison: Time tracking software and systems (TechRepublic Premium)

By treating applications as a set of customizable building blocks, you’re using a simple solution to solve a complex problem. But what if things were even easier — if all we needed to do is say what we wanted an application to do and it would build itself? Instead of constructing our software from available components, we could simply tell our development tools: “Take the latest sales figures and compare them with the current sales pipeline to show me the prospects I need to concentrate on.” It’s a grand vision, and one that’s surprisingly close at hand.

Adding AI to Microsoft’s Power Platform

Microsoft has started to bring some of these ideas into its Power Platform, using a mix of its own technology and OpenAI’s Codex machine learning. It’s been using Codex in Power Apps for a while now and is now bringing it to Power Automate, offering AI assistance in flow design.

Codex is an interesting tool, a version of OpenAI’s large language models that’s been trained on code rather than on prose. One version, using a model built from GitHub’s public repositories, powers its Copilot service. The result is a powerful way of helping you build both code and tests, using it as a way of giving you smart hints into using common libraries and design patterns. That approach should work well in the Power Platform, where the underlying problem space is more tightly constrained than Copilot’s more open programming model.

The intent for Codex in Power Automate is to use natural language as a seed for application development. Instead of jumping straight into building a Power Automate flow from scratch, you’ll be able to write a brief description of what you want it to do. Codex will then generate a set of possible flows that can be tested before either editing or putting them straight into production.

Using Codex in Microsoft’s Power Automate

Using the tooling is simple enough. If you’re opted into the preview, click on Create in the Power Automate sidebar and then choose the You Describe It, AI Builds It option. You’re presented with a text box in which you can write a description of a flow. For example, the suggestion — “When I get a new email from my supervisor, send me a message in Teams” — will generate a couple of possible flows that can then be customized as necessary.

As Microsoft notes, currently the tool works best with Microsoft 365 apps and services; even so, I was able to use it with common Power Automate connectors like Twitter or other social media. The Codex instance has been trained using public templates and flows, so expect it to work better with more common connectors. Microsoft has said it will be adding support for a wider range as the preview expands and heads towards general availability.

Once you’ve got a possible flow, click Next at the bottom of the screen. This next step asks you to check that the connectors your flow will use are connected to your accounts. If they’re not connected or you want to use a different account, click on the “…” to add a new connection. The next step is to add any settings for the connectors, triggers and actions the flow will use. These are all brought into a single screen, so you don’t have to customize them individually.

The result is a development workflow that’s not like any other. It’s much more like working in an Office application than in a coding tool, even a low-code environment like Power Automate. If it wasn’t delivered as a set of web pages in the Power Platform portal, you’d expect it to be an old-school wizard, hiding some distinctly new-school technology.

What’s nice about this way of working with Power Automate is that it extends the fusion teams concept Microsoft has been pioneering with its cross-disciplinary approach to low-code development. If you can say what you want in a sentence, there’s a very good chance that the service will create at the very least a skeleton of the app you want. You can then hand it over to more experienced developers to refine the flow and perhaps use the new AI-powered sketching-based UI designer to add a Power Apps front-end.

Programming by example

While building an application from a few words of English is a useful way of kickstarting an application, there’s another issue that automation is helping solve. Building the expressions needed to convert data from one format to another can be complex, often requiring several functions and an understanding of the syntax necessary at either end of the transform.

Power Automate now offers a way of simply showing what the output should look like, automatically building the necessary expression. All you need to do is edit the action you want to use the converted data, choosing the target text field and selecting Format Data By Examples. You’re presented with a list of data in your flow — simply pick the one you want to use, provide an example of the data from the source, and then provide a sample of the output format you want.

The service will provide an expression that you can test with various inputs. If the results aren’t right, all you need to do is add more examples of inputs and outputs. There’s no need to get into the weeds of editing the first expression the service generates, when all you need are more examples.

The underlying technology here is a Microsoft Research-developed technology called PROSE, program synthesis using examples. It’s an important tool, and one you can experiment with in your own applications using a non-commercial .NET SDK or using the Excel implementation. PROSE is ideal for low-code environments like Power Automate, as it’s designed to work with domain-specific languages. In Power Automate, it’s being used to support a specific subset of the environment: the tools it uses to format outputs. This allows it to work in an appropriately constrained environment where both the inputs and outputs are closely controlled.

This is a very different approach to that used by the more general purpose OpenAI Codex model used to create a flow. That’s actually a good thing, as we’re not trying to build workflows; instead, here we’re doing much the same as Excel, using PROSE to, for example, take a set of machine-readable content and convert it into something suitable for humans. We could start with an ISO-format date and convert it to a long date or take an address and convert the U.S. state to the standard USPS abbreviation, ensuring outputs are consistent and usable.

Microsoft’s work with AI in Power Platform, GitHub and Microsoft 365 shows that it needn’t be a tool to replace humans. Instead, it’s delivering a set of features that can help us be more productive, acting as an assistant working alongside us. The result is one that can speed up application development, filling the gap between the code we need and the code we have much more quickly.

To learn more about low-code development and automation, download these TechRepublic Premium resources: IT leader’s guide to low-code development and software automation policy guidelines. Get a 30% discount off an annual subscription to TechRepublic Premium by using the code bf22-30. This great deal ends on Dec. 7, 2022, so act now!

Source: TechRepublic