Build an AI Customer Support Agent with Smart Query Routing

This Dify workflow template creates an intelligent customer support agent that automates your inquiry process. It leverages Google's Gemini to classify user questions, retrieves precise information from your knowledge bases using Cohere's reranking for accuracy, and then generates tailored, context-aware responses. The result is a fully automated system that provides fast, relevant support for product specs, usage guides, and troubleshooting.

    image for Build an AI Customer Support Agent with Smart Query Routing

    Workflow Overview

    What is this?

    What is this?

    This is a sophisticated workflow designed to function as an automated customer support agent. It intelligently processes incoming user questions by first classifying them into predefined categories like 'Product Specs' or 'Troubleshooting', then fetches relevant documents from your knowledge base, and finally constructs a precise, helpful answer using a Large Language Model.
    What problem does it solve?

    What problem does it solve?

    Are your support teams spending too much time answering repetitive questions or struggling to find the right information quickly? This workflow eliminates manual query handling by creating an automated first line of defense that provides instant, accurate answers, freeing up your human agents to focus on more complex issues.
    What will you get?

    What will you get?

    You will get a fully automated support system that provides 24/7 instant responses to common user inquiries. It significantly reduces manual support workload and ensures consistent, high-quality answers. This enhances customer satisfaction by delivering fast, accurate information directly from your verified knowledge sources.

    Apps Included

    • Google Gemini
    • Reranker Cohere
    • Start

    How to Use

    Prerequisites

    Setup Steps

    1

    Import the Workflow

    Download the YML file for this workflow and import it into your Dify workspace. This will create a new application with all nodes and connections pre-configured.

    2

    Configure the Question Classifier

    Navigate to the 'Question Classifier' node. Review the predefined classes ('製品仕様', '使い方', 'トラブルシューティング') and customize them to match your specific support categories. Ensure your chosen LLM (e.g., Gemini Pro) is selected.

    3

    Connect Your Knowledge Base

    Select the 'Knowledge Retrieval' node. In the settings, choose the Dify knowledge bases that contain the relevant information for your support topics. Verify that the reranking model (e.g., Cohere) is correctly configured for optimal accuracy.

    4

    Customize Response Models

    Review the various 'LLM' nodes. Adjust the system prompts within each to refine how the AI generates responses for different query types. You can modify the tone, language, and structure of the final answer.

    5

    Test and Deploy

    Run several test queries covering all your defined categories to ensure the workflow routes and responds correctly. Once satisfied, publish the application to make it available for use.

    Pro Tips

    1
    To handle queries that don't fit any category, add a 'default' branch from the 'Question Classifier' node that provides a generic response or escalates the ticket to a human agent.
    2
    For multi-language support, you can add a language detection node at the beginning and route the query to different sets of prompts and knowledge bases based on the detected language.
    3
    Regularly review unclassified or poorly answered questions to identify gaps in your knowledge base or areas where the classification model needs more specific instructions.

    Information

    • Published date8/15/2025
    • Last updated8/15/2025

    Platform