Skip to content
All projects

04Workflow · Human-in-the-loop

Run Fast

AI Customer Service Risk Workflow

04Run Fast
Role
Workflow design, node schemas and gate logic in Dify.
Stack
Dify · Workflow · RAG · Human-in-the-loop

01

Problem

01.1Overview

A Dify workflow for customer service that routes risky or unsupported questions to a human instead of letting the model guess.

01.2Context

Customer service is where a confident wrong answer costs the most.

Run Fast is a workflow that decides, step by step, whether the AI should answer at all.

01.3Problem

A chatbot that always answers will sometimes answer without evidence.

Some questions are out of scope, some need a human, some are risky. A single prompt cannot reliably handle all of these.

01.4My Role

Workflow design, node schemas and gate logic in Dify.

02

Build

02.1Solution

A sequence of explicit checks before any answer is generated. Each step produces structured output validated with JSON Schema.

The final Evidence Gate decides between an AI answer and handing over to a human.

Evidence Gate states

no_evidence
Nothing relevant was retrieved. Hand over to a human.
evidence_insufficient
Something was found, but not enough to answer safely. Hand over to a human.
answerable
Retrieved evidence supports an answer. The AI responds.

02.2Architecture

  1. Scope Check
  2. Human Escalation Check
  3. Risk Classification
  4. Knowledge Retrieval
  5. Evidence Gate
  6. AI Answer / Human
fig. 04a — workflow
04A question the knowledge base covers
  1. Scope

    Scope check: in scope

  2. Escalation

    No human escalation needed

  3. Risk

    Risk classification

  4. Retrieval

    Knowledge retrieval

  5. Evidence Gate

    Evidence Gate: answerable

  6. AI Answer

    The AI answers from the evidence

One run of the pipeline, step by step.

02.3Key Decisions

  1. 01

    Workflow before agent

    The path is known in advance, so a deterministic workflow is easier to audit than an autonomous agent.

  2. 02

    No evidence, no answer

    The AI should not answer when retrieval does not support it. Saying "I'll get a human" is a valid output.

  3. 03

    Structured outputs between nodes

    JSON Schema keeps every step's output machine-checkable, so routing never depends on parsing free text.

03

Engineering

03.1Engineering

  • Built in Dify as a multi-node workflow.
  • JSON Schema for structured output at each decision node.

04

Notes

04.1What I Learned

The most valuable node in the workflow is the one that says no.

04.2Tech Stack

  • Dify
  • Workflow
  • RAG
  • Human-in-the-loop
  • JSON Schema