# Flow components (nodes)

Flow Components are the building blocks used within Waterflai's flow builder to create AI-powered applications. Each component (node) serves a specific purpose and can be connected to form complex data processing and AI interaction flows.

### Data Types

Before diving into specific components, it's important to understand the core data types used throughout the flows:

#### Basic Types

* `string`: Text values
* `number`: Numeric values
* `boolean`: True/false values
* `object`: JavaScript/JSON objects
* `any`: Any type of value

#### Array Types

* `string[]`: Array of text values
* `number[]`: Array of numeric values
* `boolean[]`: Array of boolean values
* `object[]`: Array of objects
* `any[]`: Array of any values

#### Special Types

* `Document`: Represents a text document with metadata

  ```typescript
  {
    page_content: string;  // The main content of the document
    metadata: {           // Associated metadata
      [key: string]: any  // Custom key-value pairs
    }
  }
  ```
* `Document[]`: Array of documents
* `ChatMessage[]`: Array of chat messages

  ```typescript
  {
    role: "user" | "assistant" | "system";
    content: string | ChatMessageContent[]; // Either text-only or multimodal content
  }
  ```

Where ChatMessageContent (used mainly in multimodal cases) correspond to:

```
{
  type: "text" | "image_url"; // Type of content
  text?: string; // Text content if type is "text"
  image_url?: { // Image data if type is "image_url"
    [key: string]: any
  }
}
```

* `Tool`: Represents a tool that can be used by an agent

###

### Component Structure

Each component in a flow has:

* Input ports: Accept incoming connections
* Output ports: Provide data to other nodes
* Configuration panel: Settings and parameters
* Documentation: Usage guidelines and examples

### Best Practices

1. **Flow Design**
   * Keep flows modular and focused
   * Use meaningful node names (they should be unique when linked to a given other node, to allow variable reference)
   * Document complex configurations
   * Test flows incrementally
2. **Data Management**
   * Validate input data
   * Consider data volume
3. **Performance**
   * Optimize node configurations
   * Use appropriate batch sizes
   * Monitor execution times

### Common Issues

* Type mismatches between nodes
* Memory limitations
* Configuration errors
* Connection issues
* Resource constraints

Each component's detailed documentation provides specific configuration options, examples, and best practices for that particular node type.


---

# 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.waterflai.ai/studio/studio-builders/flow-components-nodes.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.
