> For the complete documentation index, see [llms.txt](https://craft-agent.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://craft-agent.gitbook.io/home/tips-and-tricks/chaining-nodes.md).

# Chaining Nodes Effectively

The power of Craft Agent comes from chaining multiple nodes together. Here's how to do it well.

## Pattern 1: Sequential Processing

Pass data through multiple AI steps, each adding value.

```
[Input] → [AI: Extract] → [AI: Analyze] → [AI: Format] → [Output]
```

**Example:** Research Assistant

* **Step 1:** User enters a topic
* **Step 2:** AI extracts key questions about the topic
* **Step 3:** Web Search finds answers
* **Step 4:** AI synthesizes findings into a report

## Pattern 2: Fan-Out / Fan-In

Split data into multiple paths, process separately, then combine.

```
            → [AI: Translate to Spanish] →
[Input] →  → [AI: Translate to French]  → [AI: Compare] → [Output]
            → [AI: Translate to German]  →
```

## Pattern 3: Iterative Refinement

Use multiple AI nodes to improve quality through iteration.

```
[Input] → [AI: Draft] → [AI: Critique] → [AI: Revise] → [Output]
```

**Example:** Content Writer

* **Step 1:** AI writes a first draft
* **Step 2:** AI reviews the draft critically
* **Step 3:** AI revises based on the critique

## Pattern 4: Classification + Routing

Use an AI to classify, then route to specialized handlers.

```
[Input] → [AI: Classify] → [Conditional]
                               → Tech: [AI: Tech response]
                               → Sales: [AI: Sales response]
```

## Best Practices

1. **Each node should do ONE thing** — Don't overload a single prompt
2. **Use specific system prompts** — Each node gets its own specialized role
3. **Test each node independently** — Before connecting them
4. **Start simple** — Begin with 2-3 nodes, add more as needed
5. **Name your nodes** — So you can understand the flow at a glance

***

> **Pro tip:** The best workflows are like assembly lines — each station does one thing extremely well.
