Building a Self-Hosted Agentic AI Workflow with n8n & Ollama 🛠️🤖

I recently built an end-to-end AI-powered triage pipeline designed to turn unstructured inbound requests—like messy support emails and web forms—into structured, actionable data for downstream teams.
Instead of just a simple “prompt and response,” I engineered a multi-step agentic workflow focused on reliability and system design.
The Tech Stack:
Orchestration: n8n (self-hosted via Docker) for the workflow logic and state management.
Inference: Ollama for running local LLMs, ensuring data privacy and zero API latency.
Storage: Integrated with [Google Sheets/Airtable] for structured output and escalation queues.
The Engineering Workflow:
Ingestion: Automated triggers for raw, unstructured B2B messages.
Deterministic Classification: Using Ollama to assign categories (Bug, Billing, Incident) and priority levels with a confidence score.
Entity Extraction: Structuring key identifiers like Account IDs, Invoice numbers, and error codes into clean JSON.
Agentic Routing & Fail-safes: I built logic to map classifications to specific department queues.
Human-in-the-loop (HITL): Implemented an automated escalation flag. If the model’s confidence drops below 70% or detects high-stakes keywords (like “outage” or “billing error > $500”), the system bypasses standard routing and alerts a human reviewer.
The Takeaway:
The real challenge wasn’t just getting the AI to “understand” the text—it was building the routing logic and error handling to ensure the system remains reliable at scale. Moving from a “black box” prompt to a transparent, structured pipeline is where the real value lies for any high-volume business process.
hashtag#AIEngineering hashtag#n8n hashtag#Ollama hashtag#Docker hashtag#SelfHosted hashtag#AgenticAI hashtag#WorkflowAutomation **hashtag#SystemDesign

You can check out the project and a screenshot of it on my linkedin** Building Self-Hosted AI Workflow with n8n & Ollama | kevork lepedjian posted on the topic | LinkedIn

إعجابَين (2)

Solid Automation!

Did you have any error handling aspects for this workflow? As this is one long chain. If any HTTP Request fails, the whole workflow dies silently.

إعجاب واحد (1)

Thank you and it was a long one, i had some error initially i was going to use ai agent node but then i noticed the ai doesn’t need to orchestrate this workflow and it will get to many token as for the other part i got some error after http so i pased it true a set node

Thanks alot Benjamin i will take into consideration about error handeling, as this was my first real project i didn’t know about the error boundary node, this is why i love this community we help eachother out