0%

Noel Niño Olvis

Back to Projects
Next.jsFastAPILangChainDeepEvaln8nSSE

Autonomous Support Escalation Engine

An agentic support routing engine that evaluates customer tickets in real-time, leveraging RAG for context, and deterministically escalating edge cases via n8n.

A real-time simulation harness where users can test different customer scenarios.

01 / 03

Project Overview

The Autonomous Support Escalation Engine is a multi-layered customer service automation system. It intercepts customer support tickets, uses a LangChain agent to draft context-aware responses based on retrieved policies (RAG), and streams those responses back to the user in real-time. Immediately following the draft, an LLM-as-a-judge (DeepEval) scores the response for hallucinations. Based on strict deterministic routing logic, tickets that fail safety checks or exhibit angry sentiment are silently escalated to human agents via an n8n webhook and Slack integration.

Role

Full-Stack Engineer (AI Integration & Automation)

  • Backend Orchestration
  • Frontend Integration

Tech Stack

Next.js (App Router)FastAPI (Python)LangChainVercel AI SDKDeepEvalChromaDBn8nServer-Sent Events (SSE)

Backend & Architecture

  • Engineered an asynchronous generator in FastAPI to stream Server-Sent Events (SSE) representing intermediate agentic reasoning (CoT) and text chunks.
  • Decoupled DeepEval metrics (Hallucination/Relevancy) to run asynchronously at the end of the stream, preserving a near-zero latency feel.
  • Migrated primary orchestration from n8n into FastAPI to support live streaming, while configuring FastAPI to trigger a secondary n8n webhook exclusively for Slack escalations via httpx.

Frontend & UX

  • Built a custom useTicketStream React hook to decode raw SSE chunks in real-time and cleanly segregate network logic from presentation layers.
  • Designed an enterprise-grade monitoring dashboard to visually parse latency, confidence scores, and real-time execution logs.

Challenges & Technical Solutions

01—Challenge

DeepEval checks were blocking the HTTP response, ruining the streaming experience.

↳Solution

Refactored the FastApi endpoint to yield the draft text first, invoke DeepEval post-draft, and yield the evaluation result as the final SSE chunk.

02—Challenge

The original n8n webhook couldn't proxy SSE streams, and routing logic incorrectly relied solely on LLM evaluation scores.

↳Solution

Re-architected the system to let FastAPI handle the stream directly. Implemented a deterministic routing override where FastAPI evaluates both the DeepEval score and customer sentiment, firing an asynchronous payload to n8n only if an escalation is truly required.