# Flow Builder

Cosmocloud's Flow Builder is one of the most interesting and exciting parts of using Cosmocloud. This is the **main engine** that powers custom logics in APIs, SubFlows and every other place where you need some logic based processing to be done.

<figure><img src="https://392607133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZCdm9aJ8vkvDIIbg04AL%2Fuploads%2F4mcTXcylXD8mgcL8yTnn%2FScreenshot%202024-05-14%20at%2011.25.16%E2%80%AFAM.png?alt=media&#x26;token=778113d2-927c-4335-8dc8-7835be5de3f1" alt=""><figcaption></figcaption></figure>

## Flow Types in Cosmocloud

### APIs

REST APIs are the essence of Backend Development, the most used way for your frontend (client) to talk to your backend layer. Every API has it's own flow which you can customise using the Flow Builder.

{% hint style="info" %}
Checkout more on building APIs [here](https://docs.cosmocloud.io/resources/apis).
{% endhint %}

### SubFlows

SubFlow in Cosmocloud provides modular approach to build reusable piece of flow. It helps you to build a piece of code once and plug it in existing flow.

{% hint style="info" %}
Checkout more on SubFlows [here](https://docs.cosmocloud.io/resources/subflows).
{% endhint %}

## Flow Builder Basic Concepts

### Nodes

Nodes are the individual boxes that represent one single functional component of your flow. Your flow would have multiple boxes linked together in a **flowchart** mode to define your APIs flow logic.

### Edges

An edge is the **connection path** between 2 nodes. This edge informs the flow of processing order of your APIs nodes.

Sometimes, you will also find more helpful actions on your Edges, to either add more nodes or more information about the edge / flow in that particular context.

## Adding new Nodes

There are 2 ways to add new Nodes in your Flow -

1. You can add new nodes into the flow by clicking the **Add Node** box at the end of every branch of the flowchart, excluding when your flow is finished with a `Response` node.
2. You can also add a node **between any 2 nodes** by clicked in **+** icon over the edge connecting the 2 nodes.

## Deleting any Node

You can click on the **X** delete icon on any node to delete that particular node from the flow.

{% hint style="warning" %}
There are some nodes which cannot be deleted, such as Trigger Nodes, Executor Node, Placeholder Nodes, etc.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cosmocloud.io/flow-builder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
