# n8n integration

This guide walks you through the installation and running of custom Toolhouse nodes in n8n, enabling you to call Toolhouse agents within n8n workflows.

This guide assumes you have the latest versions of Docker and Node.js installed in your environment.

### Installation

First, set up a new folder to store your n8n instance.

Run these commands in the terminal:

```bash
git clone <https://github.com/toolhouseai/toolhouse-n8n.git>
```

Change the directory:

```bash
cd toolhouse-n8n
```

Then run:

```bash
npm install
```

**Note:** Make sure you have Node.js installed and updated to at least v16.

```bash
npm run build
```

After that, make sure you have Docker open on your desktop and run:

```bash
docker compose up
```

A successful run will look like this:

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2Fnuv7NtQMdqsNLjzwsPoo%2FScreenshot%202025-07-23%20at%206.02.25%20AM.png?alt=media&#x26;token=ce5063e0-1982-4300-b27d-c53829b199a7" alt=""><figcaption></figcaption></figure>

You will now be able to access n8n at <http://localhost:5678>.

If the run fails, ensure Docker is open and running the correct container.

Your Docker Desktop should look like this:

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FWrugWbk6VNjWCRpdcWHi%2FScreenshot%202025-07-21%20at%2011.23.33%20PM.png?alt=media&#x26;token=4f5ad9b3-f1f0-4101-b191-2ba7aeeda87e" alt=""><figcaption></figcaption></figure>

### Using n8n

Your landing page should look like this:

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FflCNpD3JHlgiAG4Kg6RZ%2FScreenshot%202025-07-21%20at%2011.25.09%20PM.png?alt=media&#x26;token=5a75ce27-10da-4837-a422-0c374c68daa7" alt=""><figcaption></figcaption></figure>

### Create Credentials

To use Toolhouse agents in your workflows, you'll need to connect your Toolhouse account.

From the sidebar, select **Credentials** > **Add Credential**.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FfvP4Uy1CnFKT1DU7bJFo%2FScreenshot%202025-07-21%20at%2011.51.32%20PM.png?alt=media&#x26;token=64b5b2fe-c78c-46e1-9767-9e2dbfc1f0f6" alt=""><figcaption></figcaption></figure>

You will need a Toolhouse API key. To get your API key, go to [Toolhouse API Keys](https://app.toolhouse.ai/settings/api-keys) and either:

* Copy an existing key, or
* Click **Generate New Key**

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FPN6daWL1RbCvwiXurqwu%2FScreenshot%202025-07-21%20at%2011.53.27%20PM.png?alt=media&#x26;token=8da49c0b-334d-43bc-8e10-36047c77abe0" alt=""><figcaption></figcaption></figure>

Paste your API key into the appropriate field in the n8n node configuration, and then click **Save** to apply the changes.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FnwcDZT43rfXmQd4aFw8m%2FScreenshot%202025-07-21%20at%2011.52.39%20PM.png?alt=media&#x26;token=4c699be1-1377-47ea-a15d-b2da9be102df" alt=""><figcaption></figcaption></figure>

You're now ready to use **Toolhouse Nodes** in your workflows!

#### Starting a Toolhouse Agent Conversation on Workflow Execution

Here is an example workflow using Custom Toolhouse Nodes.

### Add a Trigger Node

Start your workflow with a trigger node. In this example, use the **Manual Trigger** node, which enables you to launch the workflow by clicking **Execute Workflow**.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FeNDPMKmtRP0MOkNb607U%2FScreenshot%202025-07-21%20at%2011.30.32%20PM.png?alt=media&#x26;token=ac911996-9291-48b7-92fd-fae3b05ce596" alt=""><figcaption></figcaption></figure>

### Add the **Toolhouse Node**

Add the **Toolhouse Agent Node** to your flow.

You can use this node to:

* **Start a new conversation**, or
* **Continue an existing one** by providing the `agentId` and the previous `agentRunId`.

This allows your workflow to pick up where a previous interaction left off.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2F7lGUWrBsNMhLx8IAUtEE%2FScreenshot%202025-07-21%20at%2011.33.35%20PM.png?alt=media&#x26;token=cf20c185-c3d3-44ba-a7b8-7fbdd8e2e235" alt=""><figcaption></figcaption></figure>

After selecting **Start Conversation** in the Toolhouse Node, your flow should resemble the following structure:

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FJIhVMZmlBIJGiMXkpfY0%2FScreenshot%202025-07-21%20at%2011.59.27%20PM.png?alt=media&#x26;token=1657c671-1534-4459-9080-d83256f0615a" alt=""><figcaption></figcaption></figure>

To choose an agent, open the **Toolhouse Node** and use the dropdown menu to select the agent you want to use in this workflow.

If no agents are found:

1. Reopen your credentials
2. Confirm your Toolhouse API key is valid

This is where all of your **Toolhouse agents** will appear.

If you haven’t created any agents yet, please follow our [Quickstart Guide](https://docs.toolhouse.ai/toolhouse/quick-start-for-vibe-coders) to get started quickly and learn how to set up your first agent.

### Executing the Flow

When you click **“Execute Workflow”**, this flow will initiate a **conversation with your Toolhouse agent**.

### **Using Webhooks**

You can use webhooks to trigger your n8n workflows automatically from Toolhouse agents.

> Prerequisite: Make sure you have an active Ngrok account, as it will be used to expose your local n8n instance to the internet.

Once configured, your Toolhouse agent will be able to call this webhook and trigger your n8n automation in real time.

#### Step 1:

Open your n8n instance in the browser.

Create a new **Webhook** node in your workflow.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2F5EiIKgvwbS8y1lQxfuxs%2FScreenshot%202025-07-28%20at%209.18.20%20AM.png?alt=media&#x26;token=a2672c7e-acfb-4650-b3b7-d31e378c88fb" alt=""><figcaption></figcaption></figure>

Then, navigate to the **Production URL**.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FxpU0IW3Y5sh42ToE45jk%2FScreenshot%202025-07-28%20at%209.24.35%20AM.png?alt=media&#x26;token=57faa043-5b2a-4710-b3cc-63682fe3d382" alt=""><figcaption></figcaption></figure>

You’ll need the **Production URL** of your webhook — this is the URL that Toolhouse agents will call.

For example:

```bash
<http://localhost:5678/webhook/4859e428-d117-4fea-a0f8-8ee94efbf600/toolhouse-call>
```

> Make sure you're using the Production URL (not the Test URL) from the webhook node in n8n.

Next, expose your local n8n instance using Ngrok by running:

```bash
ngrok http 5678
```

This will create a public URL that forwards to your local `localhost:5678`, allowing Toolhouse agents to trigger your workflows remotely.

This is what your terminal should look like after running Ngrok:

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2F3FJcm1ZC3avqdMAnojPa%2FScreenshot%202025-07-28%20at%209.14.06%20AM.png?alt=media&#x26;token=91f367e2-e1d3-4b32-8b24-69599701368b" alt=""><figcaption></figcaption></figure>

Copy the first **Forwarding** link (the `https` one). In this example:

<https://4a9fcad2f765.ngrok-free.app>

### Scheduling your agents

Now you’ll create the **callback URL** that Toolhouse agents will use.

Take your **Production URL** from n8n (e.g.):

```bash
<http://localhost:5678/webhook/4859e428-d117-4fea-a0f8-8ee94efbf600/toolhouse-callback>
```

Replace the `localhost:5678` portion with your Ngrok forwarding domain.

**Example callback URL:**

```bash
<https://4a9fcad2f765.ngrok-free.app/webhook/4859e428-d117-4fea-a0f8-8ee94efbf600/toolhouse-callback>
```

Use this full URL when setting up your Toolhouse agent’s webhook.

### Using Toolhouse Schedules

Now, you’ll set up schedules that determine when your agents should run. These schedules will remotely call the webhook URL you configured, triggering your n8n workflow at the specified times.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2F8vc3ELsWYvbvN1xBZdoQ%2FScreenshot%202025-07-28%20at%209.28.01%20AM.png?alt=media&#x26;token=c0947af2-31ff-440b-9acb-ceeb8f34a20c" alt=""><figcaption></figcaption></figure>

To create a new schedule, follow these steps:

1. Navigate to <https://app.toolhouse.ai/schedules>.
2. Click **New Schedule** in the top right corner.

This will open schedule creation, where you can configure how often your agent should run and which webhook it should call.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2F3JBwaAf9OP6DvE9EG7cg%2FScreenshot%202025-07-28%20at%209.29.13%20AM.png?alt=media&#x26;token=7fd55570-3d44-4968-8b36-18c15fd799e6" alt=""><figcaption></figcaption></figure>

Next, choose the agent you want to schedule from the dropdown.

> Note: If you don’t have any agents yet, you can create one at <https://app.toolhouse.ai/agents>.

Once you've selected an agent, continue configuring the schedule details.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2F1Pp8g8pxmzylvmcC5uEX%2FScreenshot%202025-07-28%20at%209.30.28%20AM.png?alt=media&#x26;token=d06a99ac-b493-4ae5-8ae8-3075ea6549a8" alt=""><figcaption></figcaption></figure>

Then, choose a **cadence** — this defines how often the agent should run (e.g., every 5 minutes, hourly, daily).

After setting the cadence, enter the **Callback URL** you created earlier.

This is the public webhook URL exposed by Ngrok, which will trigger your n8n workflow.

<figure><img src="https://3896932452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fio16js3ONksvIYTf7YUl%2Fuploads%2FuEvJGtjhrXLIewFck0TE%2FScreenshot%202025-07-28%20at%209.31.04%20AM.png?alt=media&#x26;token=9fd81558-89b1-4f88-b7a9-3cf434a2cf65" alt=""><figcaption></figcaption></figure>

### Completed Example

Here’s a completed example using this callback URL we generated earlier:

```
<https://4a9fcad2f765.ngrok-free.app/webhook/4859e428-d117-4fea-a0f8-8ee94efbf600/toolhouse-callback>
```

Once you've filled out all the fields, click **Create Schedule**.

Your agent is now scheduled! When the schedule runs, it will call the webhook and trigger your n8n workflow automatically.

### Next steps

**You're All Set! Your n8n instance is now fully connected to Toolhouse agents.**

You can go ahead and build your own workflows with Toolhouse and n8n.

Happy Building!

Need help? Visit [Toolhouse Support](http://help.toolhouse.ai) or ask in our [Community Discord](https://discord.gg/2Pfsz6b6).


---

# 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.toolhouse.ai/toolhouse/integrations/n8n-integration.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.
