Introduction to flows
OpenCopilot Flows Definition
By default, OpenCopilot attempts to map the user’s request to an action (or actions) automatically, and this works well for most simple use cases. However, if your backend contains flows that are not straightforward or intuitive, you may need to define these flows using OpenCopilot’s flows.
Flows are optional
Implementing them will give the copilot the ability to execute complex flows/cases. if your app only serve simple CRUD operations, then you might not need to use the flows.
What is a Flow?
A flow consists of a series of steps, where each step represents an API call to your backend (action). Each flow has a name and description to guide the copilot in determining when to invoke it based on the user’s request.
For example, imagine that your system includes an “add to cart” functionality, which involves calling multiple endpoints. You may want your copilot to handle user requests that require this functionality. To achieve this, you need to define a flow flows editor
In this example:
-
The user requested the copilot to add 3 sunglasses to the cart.
-
OpenCopilot automatically mapped the user request to the pre-defined “create cart” flow, passing the necessary parameters based on the user request.
-
OpenCopilot will handle loops, conditions, and other complex steps by itself, so you don’t have to worry about them. (for example: creating a cart with 3 items, or 100 items)