cs-agent / README.md
karenwky's picture
Update README.md
0a5658d verified

A newer version of the Gradio SDK is available: 5.42.0

Upgrade
metadata
title: Smart Customer Support Agent
emoji: ๐Ÿ’ฌ
colorFrom: yellow
colorTo: purple
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
pinned: false
license: mit
short_description: Agentic retrieval & smart routing for customer support
tags:
  - agent-demo-track
  - llamaindex
  - llamacloud
  - rag
  - agentic-retrieval
  - smart-routing
  - customer-service
  - chatbot
  - claude
  - anthropic
  - cohere-embed

๐Ÿ’ฌ Smart Customer Support Triage Agent

An intelligent customer support system powered by LlamaIndex, Anthropic Claude and Gradio, featuring agentic routing and smart document retrieval across multiple knowledge bases.

This project earned Agent Track Honorable Mention in โ€œGradio Agents & MCP Hackathon 2025โ€. Thank you so much! ๐Ÿฅน๐Ÿ™โค๏ธ

๐Ÿ”ฎ Live Demo

Try the chatbot: https://huggingface.co/spaces/karenwky/cs-agent

* Llama-3.1-405B-Instruct supported by Nebius AI Studio is used as the LLM in live demo.

๐Ÿ“น Preview

๐Ÿš€ Technologies Used

  • LLM: Anthropic Claude Sonnet 4.0 for natural language understanding and generation
  • RAG Framework: LlamaIndex for agent framework and intelligent query routing
  • Cloud Platform: LlamaCloud for document parsing & indexng, managed vector database
  • UI Framework: Gradio for interactive web interface
  • Observability: LlamaTrace (Arize Phoenix) for LLM tracing and monitoring
  • Language: Python 3.12
  • Document Types: PDF, PPTX, CSV support
  • Coding Assistance: Gemini 2.5 Flash
  • Synthetic Data: Grok Chat, Slidesgo for sample knowledge base generation

๐Ÿ“ Project Structure

cs-agent/
โ”œโ”€โ”€ app.py                           # Main application logic
โ”œโ”€โ”€ requirements.txt                 # Python dependencies
โ”œโ”€โ”€ logo.png                         # Chatbot avatar image
โ””โ”€โ”€ data/                            # Sample knowledge base
    โ”œโ”€โ”€ ProductManuals/              # Product documentation
    โ”œโ”€โ”€ FAQGeneralInfo/              # FAQ and general information
    โ”œโ”€โ”€ BillingPolicy/               # Billing and payment policies
    โ””โ”€โ”€ CompanyIntroductionSlides/   # Company overview

๐Ÿ”„ Architecture & Workflow

Architecture & Workflow Diagram

โœจ Key Features

๐ŸŽฏ Agentic Routing

  • Intelligent query classification and routing to appropriate knowledge bases
  • Composite retrieval with automatic reranking
  • Context-aware document selection based on query intent

๐Ÿง  Metadata Awareness

  • Extracts and utilizes document metadata (e.g., author, creation date, modification date)
  • File-specific information retrieval from document properties
  • Enhanced context understanding through metadata integration

๐Ÿ”„ Automatic Version Control

  • Tracks document versions automatically (e.g., late_payment_policy_v2.pdf)
  • Maintains historical document access
  • Version-aware responses for policy and procedure queries

๐Ÿ’พ Memory Management

  • Persistent chat memory with token limit
  • Context preservation across conversation turns
  • Condensed question generation for better retrieval

๐Ÿ“Š Observability

  • Real-time LLM tracing with Arize Phoenix
  • Retrieval performance monitoring
  • Source attribution and scoring visibility

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • LlamaCloud API key
  • Anthropic API key
  • (Optional) Arize Phoenix API key

Installation

  1. Clone the repository
git clone https://github.com/karenwky/cs-agent
cd cs-agent
  1. Install dependencies
pip install -r requirements.txt
  1. Set environment variables
export ANTHROPIC_API_KEY="your-anthropic-api-key"
export LLAMA_CLOUD_API_KEY="your-llamacloud-api-key"

# Optional: For Phoenix tracing
export PHOENIX_PROJECT_NAME="your-phoenix-project"
export PHOENIX_API_KEY="your-phoenix-api-key"
  1. Set up LlamaCloud indices

    • Create a project named CustomerSupportProject in LlamaCloud
    • Upload documents to create these indices:
      • ProductManuals
      • FAQGeneralInfo
      • BillingPolicy
      • CompanyIntroductionSlides
  2. Launch the application

python app.py

๐Ÿ—ฃ๏ธ Sample Questions

๐Ÿ“š Product Manual Queries

  • "Help! No response from the app, I can't do anything. What should I do?"
  • "What are the procedures to set up task automation?"
  • "How can your software help team collaboration?"
  • "Who is the author of the product manual and when is the last modified date?"

โ“ General FAQ & Company Info

  • "Who are the founders of this company? What are their backgrounds?"
  • "Is your company environmentally friendly?"
  • "What kind of technical detail can I expect for sustainability questions?"

๐Ÿ’ฐ Billing & Policy Questions

  • "I got a $200 invoice outstanding for 45 days. How much is the late charge?"
  • "What is your latest late payment policy?"
  • "If I enable auto-pay but my payment method expires, will I get notified?"
  • "Does the 14-day refund policy refer to calendar days or business days?"

๐Ÿ”ง Complex Multi-Domain Queries

  • "If I sign up for annual 'Pro' subscription with 10% discount but cancel after 20 days, what exact refund amount considering the 14-day policy?"
  • "For multi-user discounts, if I add a 5th user mid-cycle, when does the 10% discount apply and how is prorating calculated?"

๐Ÿ”ฎ Potential Enhancements

๐ŸŽฏ Advanced AI Capabilities

  • Multi-modal Support: Add image and video processing for visual troubleshooting guides
  • Voice Integration: Implement speech-to-text and text-to-speech for accessibility
  • Sentiment Analysis: Detect customer frustration levels and escalate appropriately
  • Predictive Analytics: Anticipate customer needs based on interaction patterns

๐Ÿ”ง Technical Improvements

  • Streaming Responses: Implement real-time response streaming for better UX
  • Caching Layer: Add Redis/Memcached for frequently accessed information
  • API Gateway: Create RESTful APIs for integration with existing support systems
  • Containerization: Docker support for easy deployment and scaling

๐Ÿ“Š Analytics & Monitoring

  • Custom Dashboards: Build comprehensive analytics for support metrics
  • A/B Testing: Framework for testing different response strategies
  • Performance Metrics: Track response accuracy, user satisfaction, and resolution rates
  • Automated Quality Assurance: Implement response quality scoring and feedback loops

๐Ÿ” Security & Compliance

  • Authentication System: User management and role-based access control
  • Data Encryption: End-to-end encryption for sensitive customer data
  • Audit Logging: Comprehensive logging for compliance and security monitoring
  • GDPR Compliance: Data privacy controls and user data management

๐ŸŒ Integration & Scalability

  • CRM Integration: Connect with Salesforce, HubSpot, or other CRM systems
  • Ticketing System: Integration with Zendesk, Jira Service Management
  • Multi-language Support: Internationalization for global customer base
  • Load Balancing: Horizontal scaling for high-traffic scenarios

๐Ÿค– Advanced Agent Capabilities

  • Tool Integration: Connect with external APIs and services
  • Workflow Automation: Automated ticket creation and routing
  • Escalation Logic: Smart human handoff based on complexity scoring
  • Learning System: Continuous improvement from customer interactions

๐Ÿ™ Acknowledgments

๐Ÿ“ License

This project is licensed under the MIT License.