Power Automate, The Power of Human in the Loop
Tags: powerautomate, powerplatform, rpa, lowcode
Published: 2023-07-12 08:06:35

> “Human-in-the-Loop” is a term which is well-known in different fields of engineering and computer science and has been widely used in interactive simulation models in aviation, driving, and robotics. In such simulations, humans play an important role because they influence the simulated environment with their own actions.


We have all most likely used Human in the loop while making Power Automate flows, but I suspect most would have only used it with Approvals connector.

Yet there are multiple other actions for Human in the loop, and multiple different ways to use them. Additionally I think there are 3 different fundamental types of Human in the Loop:

1. Validate
2. Lead
3. Necessity

---

## 1. Validate
Validate is when automation needs a human to confirm a decision. Automations are great for repeat patterns but can't make judgment calls (yet).

This could be to check an important decision (e.g. approve expensive refund) or an AI interpretation (AI builder OCR). 

The former was the most used, but I suspect the latter's use will grow exponentially.


![chat gpt approval warning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/doia6yrd1hd9avbljym2.png)

Power Automate out of the box is well equipped for validation interactions, with the `Approval` action the most used Human in the Loop action, but it's not the only validation action:

- Approvals
- Send Email with Options
- Post a choice of options as the Flow bot to a user
- Post adaptive card and wait for a response

They all have their strengths, but I default to `Approval` (best audit trail, most flexible and sequential approvals, when it finally comes). But if I want to go external to my tenant then I use `Send Email with Options`. Finally I like `Post adaptive card and wait for a response` when there maybe deliberation between approvers first.

## 2. Lead
Lead is kind of the opposite to validation. Where validation uses humans to improve automation, Lead uses automation to improve humans in a process.

It's more a Robot in the Loop.

Think of a performance report that needs information from the Sales, Shrink, Logisitics and HR departments. Gathering the information to deadlines, in the right format, with the one version of the truth numbers can be challenging. This is where a Human in the Loop Lead automation is really useful.
We build a schedule, reminders and a template, then request information from the departments.

![human in loop process](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x97uzd4i05mrbzace4o3.png)

Although things like the `Approval` and `Post adaptive card and wait for a response` action can kind of do this, they are not built for it.

The way I approach it is with a SharePoint `When an item or a file is modified trigger`. I Have a reference list with each contributor in order. When someone modifies the file, it triggers the automation, which un-shares it with them, then shares with next on the list, and then sends them a link to add their information.

![robot in the middle flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ltpagu2c525w34t7e65o.png)

## 3. Necessity

Necessity is when a bot can't, or it isn't efficient for it to do it. And this is the one I think we under used.

We use this when we can't automate it, but how often do we use it when we shouldn't automate it.

Automation should always be a balance, of development time to benefits. There is always a backlog of tasks to automate, so investing time in automating tasks with minimum benefits is not cost efficient.

![chart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4wnuwc7t9xsd2m9m6a6.png)

An example I came across was using address as a look up field. Now this sounds very simple except when the address is a human input field, as an example

- 10 Downing St, London SW1A 2AA
- 10 Downing Street, Westminster
- Prime Minister's Residents, London, SW1A2AA, UK
- 10, Downing Street, Westminster, Lambeth, London, Greater London, England, SW1A 2AA

Trying to find a pattern to match any is definitely possible, but just imagine how difficult, how much testing, and the fail rate (humans will always find a unique way to do everything and then add in typos!).

Another example on the other end would be classifying a request and approval. As we are using a Human in the Loop for the approval its very little effort to get them to categorise it too.

Now with AI this may become more and more niche in the future, but that doesn't stop the rational, just makes the difficulty to benefit ratio more favourable to automation.

With everything its swings and roundabouts, but for me the 2 key metrics for if I should Automate an action vs a Human in the Loop are:

- Delayed deployment time - every week delayed costs X dollars
- Success level - only works X out of 100 runs

In a nut shell, if it's too complicated or of too poor quality.

---

Often as a developer we get to look at challenges through our skills glasses, and want to automate everything, Human in the Loop is an incredibly powerful tool that should be used more than we do. 

I often think of Tesla production lines, although heavily focused on robot automation, there are still workers on the line. Humans can simply do more things and often better than a robot.


![musk quote](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8133ei37oumq39v4b52e.png)

Even the current richest man in the world agrees.