Skip to main content

Human in the Loop

Human-in-the-loop is a case where the continuation of the “flow” of the business logic depends on input from a human.

Human in the loop sequence diagram

The main problem introduced by this use case is that the application needs to be able to suspend the flow for an indefinite amount of time because there is no way to know or control how long it will take for the human to respond.

This capability is stands out in the context of Resonate’s sequential programming model - the ability to define your workflow inside a single function.

Typically, human-in-the-loop is solved by using a database and polling or message queues, and breaking up the business logic across various services. The problem with this is that there is no single place where the end-to-end business logic is defined and one must create a mental model by understanding the logic and behaviour of individual services and their relationships to one another. This is a hard system to learn, understand, and maintain.

With Resonate, because you can define your entire business logic in a single function, as a workflow, solving for human-in-the-loop becomes a prominently simple thing to achieve as you can just block and await on the resolution of a promise where ever is needed in the flow of the business logic. Then there is an API that can be called to resolve the promise, unblocking the flow enabling it to resume either on the node that it started on or a different node completely.

Get started solving for human-in-the-loop with Resonate by following the Python SDK quickstart tutorial.