Create an autonomous task-handling AI agent with OpenAI and Slack
This workflow creates a self-improving AI agent inside n8n that can understand natural language tasks, plan steps, use tools (HTTP, code, search, …), reflect on results, and continue until the goal is reached — then deliver the final answer.
How it works
Webhook or manual trigger receives a task description
LLM creates initial plan + first tool call (or finishes immediately)
Loop:
• Execute chosen tool
• Send observation back to LLM
• LLM reflects → decides next action or finish
When finished → format final answer, save result, send Slack notification
Setup steps
Connect OpenAI (or Anthropic/Groq/Gemini) credential
(Optional) Connect Slack credential for notifications
Replace the placeholder “Other Tools” Code node with real tool nodes (Switch + HTTP Request, Google Sheets, Code node, etc.)
Test with simple tasks first:
• “What is the current weather in Ahmedabad?”
• “Calculate 17×42 and explain the steps”
Adjust max iterations (via SplitInBatches or custom counter) to prevent infinite loops
Activate the workflow and send POST request to webhook with JSON:
{"task": "your task here"}
Requirements
LLM API access (gpt-4o-mini works well for testing) Optional: Slack workspace for alerts
Customization tips
Upgrade to stronger reasoning models (o1-preview, Claude 3.5/3.7 Sonnet, Gemini 2.0) Add real tools: browser automation, vector DB lookup, file read/write, calendar Improve memory: append full history or use external vector store Add cost/safety guardrails (max iterations, forbidden actions)
Contact Us If you need help setting up this workflow, want custom modifications, or have questions about integrating specific tools/services: 🌐 Website: https://www.oneclickitsolution.com/contact-us/
Related Templates
AI SEO Readability Audit: Check Website Friendliness for LLMs
Who is this for? This workflow is designed for SEO specialists, content creators, marketers, and website developers who ...
Use OpenRouter in n8n versions <1.78
What it is: In version 1.78, n8n introduced a dedicated node to use the OpenRouter service, which lets you to use a lot...
Task Deadline Reminders with Google Sheets, ChatGPT, and Gmail
Intro This template is for project managers, team leads, or anyone who wants to automatically remind teammates of tasks ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments