Skip to content

hatimtoor/HatAssembly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

HatAssembly — AI-Powered n8n Workflow Generator

Describe what you want to automate in plain English. Get a deployable n8n workflow JSON back.

HatAssembly is a multi-agent AI system that generates production-ready n8n workflows from natural language instructions. Instead of manually building workflows node by node, you tell it what you want — it figures out the right nodes, parameters, and connections, then outputs a valid workflow JSON you can import directly into n8n.


How It Works

The system uses a 3-stage multi-agent pipeline backed by a RAG database of 794 n8n node schemas:

User Input (text)
      │
      ▼
┌─────────────────────────┐
│  Agent 1: NL Enhancer   │  Clarifies and structures the user's request
└─────────────────────────┘
      │
      ▼
┌─────────────────────────┐
│  Agent 2: RAG Retrieval │  Queries Supabase vector DB for relevant node schemas
│  (Supabase + OpenAI     │  → retrieves exact node IDs, parameters, input/output structure
│   Embeddings)           │
└─────────────────────────┘
      │
      ▼
┌─────────────────────────┐
│  Agent 3: Workflow      │  Assembles valid n8n workflow JSON using retrieved schemas
│  Builder (Claude +      │  → handles node connections, data mappings, error paths
│   Gemini)               │
└─────────────────────────┘
      │
      ▼
Valid n8n Workflow JSON  →  importable directly into n8n

The RAG Database

The core of what makes this work is a Supabase vector database containing 794 n8n node schemas, each embedding the full node definition:

  • Node name and ID
  • Description and use case
  • All input parameters with types and options
  • Output structure
  • Example usage patterns

Each document averages ~5,000 characters of structured node data. All 794 nodes are embedded using OpenAI text-embedding-3 and stored in Supabase with pgvector for semantic search.

When a user asks for a workflow, the RAG agent retrieves the most relevant nodes by semantic similarity — so the builder agent always has accurate, up-to-date node specifications to work from rather than hallucinating node names or parameters.


Architecture (31 nodes)

Stage Components
Input Chat trigger (n8n UI) + Webhook (HTTP)
NL Enhancement AI Agent + Google Gemini
RAG Retrieval Supabase Vector Store + OpenAI Embeddings
Workflow Building AI Agent + Claude Opus 4.6 + Gemini
Output Parsing 3x JavaScript code nodes (JSON cleanup, validation)
Storage Supabase (generated workflows) + Google Sheets (run log)
Docs Context Google Drive (n8n documentation)

Stack

  • n8n — workflow orchestration
  • Supabase — vector database (pgvector) for node schema RAG
  • OpenAI — embeddings (text-embedding-3)
  • Anthropic Claude Opus 4.6 — primary workflow builder LLM
  • Google Gemini — NL enhancement and secondary reasoning
  • Google Sheets — generation history logging
  • Google Drive — n8n documentation context

Example

Input:

When a new row is added to my Google Sheet, send a Slack message to #sales with the row data, 
then create a contact in HubSpot and add a tag based on the value in column C

Output: A complete n8n workflow JSON with:

  • Google Sheets Trigger node (configured for new row events)
  • Slack node (message template with row data expressions)
  • HubSpot node (create contact with field mappings)
  • Switch/IF node (conditional tag logic based on column C)
  • All connections and data mappings wired correctly

Setup

Prerequisites

  • n8n instance (self-hosted or cloud)
  • Supabase project with pgvector enabled
  • OpenAI API key (for embeddings)
  • Anthropic API key (Claude)
  • Google Cloud credentials (Gemini, Drive, Sheets)

1. Set up Supabase

Create a table called documents with the following schema:

create table documents (
  id bigserial primary key,
  content text,
  metadata jsonb,
  embedding vector(1536)
);

create index on documents using ivfflat (embedding vector_cosine_ops);

2. Load the node schemas

Import the node schema data into your Supabase table. Each row should contain:

  • content — the full node schema text (name, ID, description, parameters)
  • embedding — OpenAI embedding vector of the content

3. Import the workflow

  1. Download HatAssembly.json
  2. In n8n: Settings → Import from file
  3. Connect your credentials:
    • Supabase API
    • OpenAI API
    • Anthropic API
    • Google Gemini (Palm API)
    • Google Drive OAuth2
    • Google Sheets OAuth2

4. Run it

  • Via chat: Open the n8n chat interface and describe your workflow
  • Via webhook: Send a POST request to the webhook URL with { "body": "your workflow description" }

Project Structure

HatAssembly/
├── HatAssembly.json        # Main n8n workflow (import this)
├── node_schemas.csv        # 794 n8n node schemas for Supabase RAG
└── README.md

Why I Built This

Building n8n workflows manually for clients is time-consuming — especially when you need to look up node parameters, figure out the right node IDs, and wire everything together correctly. HatAssembly automates the scaffolding step so you can focus on the logic and edge cases.

The RAG approach was key — without grounding the LLM in actual node schemas, it would hallucinate node names and parameters. With 794 nodes indexed, it can handle almost any automation request using real n8n primitives.


Author

Hatim Toor — Automation Team Lead
Portfolio · LinkedIn

About

This is HatAssembly see Readme.md to get better understanding.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors