AutomationFlowsAI & RAG › Trigger CrewAI Agent via Webhook

Trigger CrewAI Agent via Webhook

Original n8n title: 🤖 Trigger Crewai Agent

🤖 Trigger CrewAI Agent. Uses httpRequest, respondToWebhook, splitInBatches. Webhook trigger; 15 nodes.

Webhook trigger★★★★☆ complexity15 nodesHTTP Request
AI & RAG Trigger: Webhook Nodes: 15 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "\ud83e\udd16 Trigger CrewAI Agent",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "trigger-agent",
        "responseMode": "responseNode",
        "options": {}
      },
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        300,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "http://host.docker.internal:8010/crews/research",
        "jsonParameters": true,
        "options": {
          "timeout": 30000
        },
        "bodyParametersJson": "={{ JSON.stringify({ \"topic\": $json.body.topic || \"AI trends in 2024\", \"output_type\": $json.body.output_type || \"report\", \"llm_provider\": $json.body.llm_provider || null, \"llm_model\": $json.body.llm_model || null }) }}"
      },
      "name": "Start Research Crew",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        550,
        300
      ]
    },
    {
      "parameters": {
        "amount": 5,
        "unit": "seconds"
      },
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        800,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "GET",
        "url": "=http://host.docker.internal:8010/jobs/{{ $node['Start Research Crew'].json.job_id }}",
        "options": {
          "timeout": 10000
        }
      },
      "name": "Check Job Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.status }}",
              "operation": "equals",
              "value2": "completed"
            }
          ]
        }
      },
      "name": "Is Completed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1300,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.status }}",
              "operation": "equals",
              "value2": "failed"
            }
          ]
        }
      },
      "name": "Is Failed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1300,
        500
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ \"success\": true, \"job_id\": $node['Start Research Crew'].json.job_id, \"result\": $json.result }) }}"
      },
      "name": "Return Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1550,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ \"success\": false, \"job_id\": $node['Start Research Crew'].json.job_id, \"error\": $json.error }) }}",
        "options": {
          "responseCode": 500
        }
      },
      "name": "Return Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1550,
        500
      ]
    },
    {
      "parameters": {
        "loopCount": 60,
        "options": {}
      },
      "name": "Loop",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1550,
        700
      ]
    },
    {
      "parameters": {
        "amount": 10,
        "unit": "seconds"
      },
      "name": "Wait More",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1800,
        700
      ]
    },
    {
      "parameters": {
        "requestMethod": "GET",
        "url": "=http://host.docker.internal:8010/jobs/{{ $node['Start Research Crew'].json.job_id }}",
        "options": {
          "timeout": 10000
        }
      },
      "name": "Poll Job Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        2050,
        700
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.status }}",
              "operation": "equals",
              "value2": "completed"
            }
          ]
        }
      },
      "name": "Poll Completed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        2300,
        700
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ \"success\": true, \"job_id\": $node['Start Research Crew'].json.job_id, \"result\": $json.result }) }}"
      },
      "name": "Return Poll Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        2550,
        600
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.status }}",
              "operation": "equals",
              "value2": "failed"
            }
          ]
        }
      },
      "name": "Poll Failed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        2550,
        800
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ \"success\": false, \"job_id\": $node['Start Research Crew'].json.job_id, \"error\": $json.error }) }}",
        "options": {
          "responseCode": 500
        }
      },
      "name": "Return Poll Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        2800,
        750
      ]
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Start Research Crew"
          }
        ]
      ]
    },
    "Start Research Crew": {
      "main": [
        [
          {
            "node": "Wait"
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check Job Status"
          }
        ]
      ]
    },
    "Check Job Status": {
      "main": [
        [
          {
            "node": "Is Completed?"
          }
        ]
      ]
    },
    "Is Completed?": {
      "main": [
        [
          {
            "node": "Return Success"
          }
        ],
        [
          {
            "node": "Is Failed?"
          }
        ]
      ]
    },
    "Is Failed?": {
      "main": [
        [
          {
            "node": "Return Error"
          }
        ],
        [
          {
            "node": "Loop"
          }
        ]
      ]
    },
    "Loop": {
      "main": [
        [
          {
            "node": "Wait More"
          }
        ]
      ]
    },
    "Wait More": {
      "main": [
        [
          {
            "node": "Poll Job Status"
          }
        ]
      ]
    },
    "Poll Job Status": {
      "main": [
        [
          {
            "node": "Poll Completed?"
          }
        ]
      ]
    },
    "Poll Completed?": {
      "main": [
        [
          {
            "node": "Return Poll Success"
          }
        ],
        [
          {
            "node": "Poll Failed?"
          }
        ]
      ]
    },
    "Poll Failed?": {
      "main": [
        [
          {
            "node": "Return Poll Error"
          }
        ],
        [
          {
            "node": "Loop"
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionTimeout": 600
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

How this works

Automate complex AI-driven tasks effortlessly by triggering a CrewAI agent through a simple webhook, allowing you to offload research, analysis, or decision-making processes without managing the underlying AI infrastructure. This workflow suits developers, product managers, or business analysts who need reliable, scalable automation for repetitive cognitive workloads, such as market research or content generation. The key step involves sending an HTTP request to initiate the CrewAI agent, followed by polling its status until completion, ensuring you receive a seamless response via the webhook integration.

Use this workflow when integrating CrewAI into chatbots, APIs, or real-time applications requiring asynchronous AI processing, particularly for tasks that take minutes to hours. Avoid it for simple, synchronous operations or when direct API calls suffice without status monitoring, as the polling adds unnecessary overhead. Common variations include adding error retries for flaky agents or chaining multiple CrewAI tasks for sequential workflows.

About this workflow

🤖 Trigger CrewAI Agent. Uses httpRequest, respondToWebhook, splitInBatches. Webhook trigger; 15 nodes.

Source: https://github.com/vagulans/ai-platform/blob/965d60c2bd5d7380ee7c94d3f39799d877e0641d/n8n-workflows/03-trigger-agent.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes. LINK to their website https://jigsawstack.com/ SECOND A postgress DATABASE (I use Supabase) LlamaCloud for the pars

HTTP Request, Postgres, Stop And Error +2
AI & RAG

W1 - IN WhatsApp Adapter (Secure + Fast ACK). Uses postgres, redis, httpRequest. Webhook trigger; 48 nodes.

Postgres, Redis, HTTP Request
AI & RAG

Whatsapp Multi Agent System optimized copy 2.0. Uses airtable, httpRequest, errorTrigger. Webhook trigger; 44 nodes.

Airtable, HTTP Request, Error Trigger
AI & RAG

Invoice Agent. Uses httpRequest, emailSend. Webhook trigger; 29 nodes.

HTTP Request, Email Send
AI & RAG

Reputation Engine — SEO QA Agent. Uses httpRequest. Webhook trigger; 28 nodes.

HTTP Request