> For the complete documentation index, see [llms.txt](https://docs.waterflai.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.waterflai.ai/studio/studio-builders/flow-components-nodes.md).

# 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.
