> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/blocks/index.md).

# index

Blocks are the building components you connect together to create AI workflows. Think of them as specialized modules that each handle a specific task—from chatting with AI models to making API calls or processing data.

## Core Block Types

Agent Forge provides seven core block types that handle the essential functions of AI workflows:

### Processing Blocks

* [Agent](file:///blocks/agent) — Chat with AI models (OpenAI, Anthropic, Google, local models)
* [Function](file:///blocks/function) — Run custom JavaScript/TypeScript code
* [API](file:///blocks/api) — Connect to external services via HTTP requests

### Logic Blocks

* [Condition](file:///blocks/condition) — Branch workflow paths based on boolean expressions
* [Router](file:///blocks/router) — Use AI to intelligently route requests to different paths
* [Evaluator](file:///blocks/evaluator) — Score and assess content quality using AI

### Output Blocks

* [Response](file:///blocks/response) — Format and return final results from your workflow

### How Blocks Work

Each block has three main components:

* **Inputs**: Data coming into the block from other blocks or user input
* **Configuration**: Settings that control how the block behaves
* **Outputs**: Data the block produces for other blocks to use

{% stepper %}
{% step %}

#### Receive Input

Block receives data from connected blocks or user input
{% endstep %}

{% step %}

#### Process

Block processes the input according to its configuration
{% endstep %}

{% step %}

#### Output Results

Block produces output data for the next blocks in the workflow
{% endstep %}
{% endstepper %}

### Connecting Blocks

You create workflows by connecting blocks together. The output of one block becomes the input of another:

* **Drag to connect**: Drag from an output port to an input port
* **Multiple connections**: One output can connect to multiple inputs
* **Branching paths**: Some blocks can route to different paths based on conditions

### Common Patterns

#### Sequential Processing

Connect blocks in a chain where each block processes the output of the previous one:

```
User Input → Agent → Function → Response
```

#### Conditional Branching

Use Condition or Router blocks to create different paths:

```
User Input → Router → Agent A (for questions)
                   → Agent B (for commands)
```

#### Quality Control

Use Evaluator blocks to assess and filter outputs:

```
Agent → Evaluator → Condition → Response (if good)
                              → Agent (retry if bad)
```

### Block Configuration

Each block type has specific configuration options:

**All Blocks**:

* Input/output connections
* Error handling behavior
* Execution timeout settings

**AI Blocks** (Agent, Router, Evaluator):

* Model selection (OpenAI, Anthropic, Google, local)
* API keys and authentication
* Temperature and other model parameters
* System prompts and instructions

**Logic Blocks** (Condition, Function):

* Custom expressions or code
* Variable references
* Execution environment settings

**Integration Blocks** (API, Response):

* Endpoint configuration
* Headers and authentication
* Request/response formatting

<table data-view="cards"><thead><tr><th>Title</th><th data-card-target data-type="content-ref">Target</th></tr></thead><tbody><tr><td>Agent Block<br>Connect to AI models and create intelligent responses</td><td><a href="file:///blocks/agent">file:///blocks/agent</a></td></tr><tr><td>Function Block<br>Run custom code to process and transform data</td><td><a href="file:///blocks/function">file:///blocks/function</a></td></tr><tr><td>API Block<br>Integrate with external services and APIs</td><td><a href="file:///blocks/api">file:///blocks/api</a></td></tr><tr><td>Condition Block<br>Create branching logic based on data evaluation</td><td><a href="file:///blocks/condition">file:///blocks/condition</a></td></tr></tbody></table>
