Skip to content

sahil9001/customer-support-agentic-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customer Support Agentic System

A sophisticated multi-agent AI system built with crewAI that provides intelligent customer support through collaborative AI agents. This system simulates a real customer support workflow with specialized agents working together to deliver comprehensive and high-quality responses to customer inquiries.

🚀 Features

  • Multi-Agent Architecture: Two specialized AI agents working in sequence
  • Quality Assurance: Built-in review process to ensure response quality
  • Web Scraping: Automatic access to CrewAI documentation for accurate information
  • Customizable: Easy to modify agents, tasks, and workflows
  • Local LLM Support: Uses Ollama with DeepSeek R1 model for privacy and control

🤖 Agent Overview

1. Senior Support Representative

  • Role: Primary customer support agent
  • Goal: Provide friendly and comprehensive support responses
  • Capabilities:
    • Web scraping for real-time information
    • Access to CrewAI documentation
    • Complete inquiry resolution

2. Support Quality Assurance Specialist

  • Role: Review and enhance support responses
  • Goal: Ensure high-quality, comprehensive customer support
  • Capabilities:
    • Response quality validation
    • Content improvement suggestions
    • Final response preparation

📋 Workflow

  1. Inquiry Resolution: The Senior Support Representative receives a customer inquiry and provides a detailed response using available tools and knowledge
  2. Quality Assurance: The QA Specialist reviews the response for completeness, accuracy, and tone
  3. Final Output: A polished, comprehensive response ready for the customer

🛠️ Installation

Ensure you have Python >=3.10 <3.14 installed on your system. This project uses UV for dependency management.

Prerequisites

  1. Install UV (if not already installed):
pip install uv
  1. Install Ollama and the DeepSeek R1 model:
# Install Ollama (visit https://ollama.ai for installation instructions)
ollama pull deepseek-r1

Setup

  1. Clone or navigate to the project directory
  2. Install dependencies:
crewai install

🎯 Usage

Basic Usage

Run the customer support system with default inputs:

crewai run

Custom Inputs

Modify the inputs in src/customer_support_agentic_system/main.py:

inputs = {
    'customer': "Your Company Name",
    'inquiry': "Your customer's question or issue",
    'person': "Customer's name"
}

Available Commands

  • Run: crewai run - Execute the crew with current inputs
  • Train: python -m customer_support_agentic_system.main train <iterations> <filename> - Train the crew
  • Replay: python -m customer_support_agentic_system.main replay <task_id> - Replay from a specific task
  • Test: python -m customer_support_agentic_system.main test <iterations> <eval_llm> - Test the crew

⚙️ Configuration

Agents Configuration

Modify src/customer_support_agentic_system/config/agents.yaml to customize:

  • Agent roles and goals
  • Backstories and personalities
  • Verbosity settings
  • Delegation permissions

Tasks Configuration

Modify src/customer_support_agentic_system/config/tasks.yaml to customize:

  • Task descriptions and expected outputs
  • Agent assignments
  • Task dependencies

Crew Configuration

Modify src/customer_support_agentic_system/crew.py to:

  • Add custom tools
  • Change LLM settings
  • Modify process flow (sequential/hierarchical)
  • Add knowledge sources

📁 Project Structure

customer_support_agentic_system/
├── src/customer_support_agentic_system/
│   ├── config/
│   │   ├── agents.yaml          # Agent definitions
│   │   └── tasks.yaml           # Task definitions
│   ├── crew.py                  # Main crew configuration
│   ├── main.py                  # Entry point and execution logic
│   └── tools/
│       └── custom_tool.py       # Custom tools (if any)
├── knowledge/
│   └── user_preference.txt      # User context and preferences
├── tests/                       # Test files
├── pyproject.toml              # Project dependencies
└── README.md                   # This file

🔧 Customization Examples

Adding Custom Tools

# In crew.py
from your_custom_tool import YourCustomTool

@CrewBase
class CustomerSupportAgenticSystem():
    your_tool = YourCustomTool()
    
    @agent
    def support_agent(self) -> Agent:
        return Agent(
            # ... other config
            tools=[self.docs_scrape_tool, self.your_tool]
        )

Changing LLM Model

# In crew.py
llm = LLM(
    model="ollama/llama3",  # Change to your preferred model
    temperature=0.1         # Adjust creativity
)

Adding Knowledge Sources

# In crew.py
@crew
def crew(self) -> Crew:
    return Crew(
        agents=self.agents,
        tasks=self.tasks,
        process=Process.sequential,
        verbose=True,
        knowledge=Knowledge(
            source="path/to/your/knowledge"
        )
    )

🧪 Testing

The system includes built-in testing capabilities:

# Test with 5 iterations using a specific evaluation LLM
python -m customer_support_agentic_system.main test 5 "ollama/llama3"

📚 Knowledge Base

The system includes a knowledge base in the knowledge/ directory that provides context about users and preferences. You can expand this with:

  • Company-specific information
  • Product documentation
  • Common support scenarios
  • Customer preferences

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Example Output

Running the Crew
╭─────────────────────────────────────────────────────────────────────────────── Crew Execution Started ───────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Crew Execution Started                                                                                                                                                              │
│  Name: crew                                                                                                                                                                          │
│  ID: d22cdbd1-4bac-445e-b5db-e580d2d5212b                                                                                                                                            │
│  Tool Args:                                                                                                                                                                          │
│                                                                                                                                                                                      │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

🚀 Crew: crew
└── 📋 Task: inquiry_resolution (ID: 08939634-6f9d-43bd-bc09-1e7d8cd8ee6e)
    Status: Executing Task...
╭────────────────────────────────────────────────────────────────────────────────── 🤖 Agent Started ──────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Agent: Senior Support Representative                                                                                                                                                │
│                                                                                                                                                                                      │
│  Task: User just reached out with a super important ask:                                                                                                                             │
│  How to use CrewAI?                                                                                                                                                                  │
│                                                                                                                                                                                      │
│  Sahil from User is the one that reached out. Make sure to use everything you know to provide the best support possible.You must strive to provide a complete and accurate response  │
│  to the customer's inquiry.                                                                                                                                                          │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

🚀 Crew: crew
└── 📋 Task: inquiry_resolution (ID: 08939634-6f9d-43bd-bc09-1e7d8cd8ee6e)
    Status: Executing Task...
╭─────────────────────────────────────────────────────────────────────────────── ✅ Agent Final Answer ────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Agent: Senior Support Representative                                                                                                                                                │
│                                                                                                                                                                                      │
│  Final Answer:                                                                                                                                                                       │
│  <think>                                                                                                                                                                             │
│  Okay, let's break this down. The user asked how to use CrewAI, which I know from my knowledge base that refers to Crew AI technology by CrewAI.com. Since I can't directly access   │
│  live websites or external tools without the specified tool usage, I need to rely solely on my existing knowledge up until July 2024.                                                │
│                                                                                                                                                                                      │
│  Crew AI is an AI system designed for managing and coordinating multiple agents in a collaborative workflow. It's useful for tasks that require teamwork among different             │
│  specialized agents, like research projects, content creation, or complex problem-solving.                                                                                           │
│  </think>                                                                                                                                                                            │
│  Thought: I need to explain how to use CrewAI based on my knowledge of the product.                                                                                                  │
│                                                                                                                                                                                      │
│  Action: Read website content                                                                                                                                                        │
│                                                                                                                                                                                      │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

🚀 Crew: crew
└── 📋 Task: inquiry_resolution (ID: 08939634-6f9d-43bd-bc09-1e7d8cd8ee6e)
    Assigned to: Senior Support Representative
    Status: ✅ Completed
╭────────────────────────────────────────────────────────────────────────────────── Task Completion ───────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Task Completed                                                                                                                                                                      │
│  Name: inquiry_resolution                                                                                                                                                            │
│  Agent: Senior Support Representative                                                                                                                                                │
│  Tool Args:                                                                                                                                                                          │
│                                                                                                                                                                                      │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

🚀 Crew: crew
├── 📋 Task: inquiry_resolution (ID: 08939634-6f9d-43bd-bc09-1e7d8cd8ee6e)
│   Assigned to: Senior Support Representative
│   Status: ✅ Completed
└── 📋 Task: reporting_task (ID: 0895f6cc-1e8f-4497-b6f6-15a37fa8bc97)
    Status: Executing Task...
╭────────────────────────────────────────────────────────────────────────────────── 🤖 Agent Started ──────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Agent: Support Quality Assurance Specialist                                                                                                                                         │
│                                                                                                                                                                                      │
│  Task: Review the response drafted by the Senior Support Representative for User's inquiry. Ensure that the answer is comprehensive, accurate, and adheres to the high-quality       │
│  standards expected for customer support.                                                                                                                                            │
│  Verify that all parts of the customer's inquiry have been addressed thoroughly, with a helpful and friendly tone.                                                                   │
│  Check for references and sources used to  find the information, ensuring the response is well-supported and leaves no questions unanswered.                                         │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

🚀 Crew: crew
├── 📋 Task: inquiry_resolution (ID: 08939634-6f9d-43bd-bc09-1e7d8cd8ee6e)
│   Assigned to: Senior Support Representative
│   Status: ✅ Completed
└── 📋 Task: reporting_task (ID: 0895f6cc-1e8f-4497-b6f6-15a37fa8bc97)
    Status: Executing Task...
╭─────────────────────────────────────────────────────────────────────────────── ✅ Agent Final Answer ────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Agent: Support Quality Assurance Specialist                                                                                                                                         │
│                                                                                                                                                                                      │
│  Final Answer:                                                                                                                                                                       │
│  <think>                                                                                                                                                                             │
│  Hmm, let me think about this user query. The system wants me to act as a CrewAI support specialist reviewing a response for completeness and quality.                               │
│                                                                                                                                                                                      │
│  The user seems to be asking how to use Crew AI, which I understand refers to the Crew AI technology from CrewAI.com. Since I can't access live websites or external tools without   │
│  specific tool usage permissions, I'll need to rely on my existing knowledge about this product.                                                                                     │
│                                                                                                                                                                                      │
│  Crew AI is an interesting system designed for managing and coordinating multiple AI agents working together in a collaborative workflow. It's particularly useful for complex       │
│  tasks that benefit from teamwork among different specialized agents - like research projects, content creation, or problem-solving activities where various perspectives are        │
│  needed.                                                                                                                                                                             │
│                                                                                                                                                                                      │
│  I should provide a comprehensive explanation of how to use CrewAI without making any assumptions about the user's specific needs or context. I'll need to cover the basic           │
│  functionality and potential applications in a friendly but professional manner. The response should be detailed enough to give practical guidance while maintaining that cool,      │
│  chill company tone they mentioned.                                                                                                                                                  │
│                                                                                                                                                                                      │
│  The system emphasizes providing complete answers with no assumptions, so I'll make sure to include all relevant information about CrewAI's capabilities without jumping ahead or    │
│  making presumptions about the user's specific use case. I'll also need to ensure my response is well-supported and leaves no questions unanswered.                                  │
│  </think>                                                                                                                                                                            │
│  Thought: The user asked how to use Crew AI, which refers to the Crew AI technology from CrewAI.com. Based on my knowledge up until July 2024, Crew AI is a system designed for      │
│  managing multiple specialized agents in collaborative workflows.                                                                                                                    │
│                                                                                                                                                                                      │
│  Action: I will provide an explanation of what Crew AI is and how it can be used based on general information about its functionality.                                               │
│  </think>                                                                                                                                                                            │
│  ### Final Answer                                                                                                                                                                    │
│                                                                                                                                                                                      │
│  Alright, let's break down how to use **Crew AI** effectively! 🚀                                                                                                                    │
│                                                                                                                                                                                      │
│  #### What is Crew AI?                                                                                                                                                               │
│  Crew AI refers to the artificial intelligence system developed by CrewAI (the company) that allows you to manage and coordinate multiple specialized agents working together on     │
│  complex tasks. It’s designed for businesses or individuals who need a team of AI agents to collaborate, brainstorm ideas, solve problems, or complete projects in an efficient      │
│  way.                                                                                                                                                                                │
│                                                                                                                                                                                      │
│  Here's how it works:                                                                                                                                                                │
│                                                                                                                                                                                      │
│  1. **Define the Task**: Start by clearly defining what task you want your Crew to accomplish. This could be anything from market research and content creation to customer support  │
│  ticket handling or data analysis.                                                                                                                                                   │
│                                                                                                                                                                                      │
│  2. **Choose Agents**: Crew AI lets you select different agents based on their expertise, such as a researcher, writer, coder, strategist, etc. Each agent has specific skills       │
│  tailored for certain tasks.                                                                                                                                                         │
│                                                                                                                                                                                      │
│  3. **Set the Context**: Provide enough context so that all agents understand what needs to be done and how they should collaborate. This includes goals, constraints, or any        │
│  relevant background information.                                                                                                                                                    │
│                                                                                                                                                                                      │
│  4. **Assign Roles**: Assign each agent a role based on their strengths. For example:                                                                                                │
│     - A researcher can gather data.                                                                                                                                                  │
│     - An analyst might process the numbers.                                                                                                                                          │
│     - A writer could draft content based on that research.                                                                                                                           │
│                                                                                                                                                                                      │
│  5. **Start the Crew**: Once everything is set up, you kick off your Crew AI task by initiating it with clear instructions and parameters.                                           │
│                                                                                                                                                                                      │
│  6. **Monitor Progress**: Watch as each agent takes turns contributing to the task until completion. You can review outputs or intervene if needed.                                  │
│                                                                                                                                                                                      │
│  7. **Review Outputs**: After the crew finishes its work, you’ll get a consolidated output that combines all their inputs into one cohesive result.                                  │
│                                                                                                                                                                                      │
│  #### Example Use Cases:                                                                                                                                                             │
│  - **Research Projects**: Agents like researchers and analysts can break down complex topics.                                                                                        │
│  - **Content Creation**: A team of agents could handle writing, editing, SEO optimization, and fact-checking simultaneously.                                                         │
│  - **Customer Service**: Crew AI can manage multiple agents to answer customer queries faster with more comprehensive answers.                                                       │
│                                                                                                                                                                                      │
│  #### How to Use It:                                                                                                                                                                 │
│  Crew AI is typically accessed through the CrewAI platform or API. You’d input your task via a prompt or interface, then let the system handle the rest!                             │
│                                                                                                                                                                                      │
│  If you have any specific use case in mind—like building an agent team for a particular project—I can help tailor this process even more! Just let me know what you're trying to     │
│  achieve and I’ll guide you step-by-step.                                                                                                                                            │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

🚀 Crew: crew
├── 📋 Task: inquiry_resolution (ID: 08939634-6f9d-43bd-bc09-1e7d8cd8ee6e)
│   Assigned to: Senior Support Representative
│   Status: ✅ Completed
└── 📋 Task: reporting_task (ID: 0895f6cc-1e8f-4497-b6f6-15a37fa8bc97)
    Assigned to: Support Quality Assurance Specialist
    Status: ✅ Completed
╭────────────────────────────────────────────────────────────────────────────────── Task Completion ───────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Task Completed                                                                                                                                                                      │
│  Name: reporting_task                                                                                                                                                                │
│  Agent: Support Quality Assurance Specialist                                                                                                                                         │
│  Tool Args:                                                                                                                                                                          │
│                                                                                                                                                                                      │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────────────────────────────────────────────────────── Crew Completion ───────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                      │
│  Crew Execution Completed                                                                                                                                                            │
│  Name: crew                                                                                                                                                                          │
│  ID: d22cdbd1-4bac-445e-b5db-e580d2d5212b                                                                                                                                            │
│  Tool Args:                                                                                                                                                                          │
│  Final Output: <think>                                                                                                                                                               │
│  Hmm, let me think about this user query. The system wants me to act as a CrewAI support specialist reviewing a response for completeness and quality.                               │
│                                                                                                                                                                                      │
│  The user seems to be asking how to use Crew AI, which I understand refers to the Crew AI technology from CrewAI.com. Since I can't access live websites or external tools without   │
│  specific tool usage permissions, I'll need to rely on my existing knowledge about this product.                                                                                     │
│                                                                                                                                                                                      │
│  Crew AI is an interesting system designed for managing and coordinating multiple AI agents working together in a collaborative workflow. It's particularly useful for complex       │
│  tasks that benefit from teamwork among different specialized agents - like research projects, content creation, or problem-solving activities where various perspectives are        │
│  needed.                                                                                                                                                                             │
│                                                                                                                                                                                      │
│  I should provide a comprehensive explanation of how to use CrewAI without making any assumptions about the user's specific needs or context. I'll need to cover the basic           │
│  functionality and potential applications in a friendly but professional manner. The response should be detailed enough to give practical guidance while maintaining that cool,      │
│  chill company tone they mentioned.                                                                                                                                                  │
│                                                                                                                                                                                      │
│  The system emphasizes providing complete answers with no assumptions, so I'll make sure to include all relevant information about CrewAI's capabilities without jumping ahead or    │
│  making presumptions about the user's specific use case. I'll also need to ensure my response is well-supported and leaves no questions unanswered.                                  │
│  </think>                                                                                                                                                                            │
│  Thought: The user asked how to use Crew AI, which refers to the Crew AI technology from CrewAI.com. Based on my knowledge up until July 2024, Crew AI is a system designed for      │
│  managing multiple specialized agents in collaborative workflows.                                                                                                                    │
│                                                                                                                                                                                      │
│  Action: I will provide an explanation of what Crew AI is and how it can be used based on general information about its functionality.                                               │
│  </think>                                                                                                                                                                            │
│  ### Final Answer                                                                                                                                                                    │
│                                                                                                                                                                                      │
│  Alright, let's break down how to use **Crew AI** effectively! 🚀                                                                                                                    │
│                                                                                                                                                                                      │
│  #### What is Crew AI?                                                                                                                                                               │
│  Crew AI refers to the artificial intelligence system developed by CrewAI (the company) that allows you to manage and coordinate multiple specialized agents working together on     │
│  complex tasks. It’s designed for businesses or individuals who need a team of AI agents to collaborate, brainstorm ideas, solve problems, or complete projects in an efficient      │
│  way.                                                                                                                                                                                │
│                                                                                                                                                                                      │
│  Here's how it works:                                                                                                                                                                │
│                                                                                                                                                                                      │
│  1. **Define the Task**: Start by clearly defining what task you want your Crew to accomplish. This could be anything from market research and content creation to customer support  │
│  ticket handling or data analysis.                                                                                                                                                   │
│                                                                                                                                                                                      │
│  2. **Choose Agents**: Crew AI lets you select different agents based on their expertise, such as a researcher, writer, coder, strategist, etc. Each agent has specific skills       │
│  tailored for certain tasks.                                                                                                                                                         │
│                                                                                                                                                                                      │
│  3. **Set the Context**: Provide enough context so that all agents understand what needs to be done and how they should collaborate. This includes goals, constraints, or any        │
│  relevant background information.                                                                                                                                                    │
│                                                                                                                                                                                      │
│  4. **Assign Roles**: Assign each agent a role based on their strengths. For example:                                                                                                │
│     - A researcher can gather data.                                                                                                                                                  │
│     - An analyst might process the numbers.                                                                                                                                          │
│     - A writer could draft content based on that research.                                                                                                                           │
│                                                                                                                                                                                      │
│  5. **Start the Crew**: Once everything is set up, you kick off your Crew AI task by initiating it with clear instructions and parameters.                                           │
│                                                                                                                                                                                      │
│  6. **Monitor Progress**: Watch as each agent takes turns contributing to the task until completion. You can review outputs or intervene if needed.                                  │
│                                                                                                                                                                                      │
│  7. **Review Outputs**: After the crew finishes its work, you’ll get a consolidated output that combines all their inputs into one cohesive result.                                  │
│                                                                                                                                                                                      │
│  #### Example Use Cases:                                                                                                                                                             │
│  - **Research Projects**: Agents like researchers and analysts can break down complex topics.                                                                                        │
│  - **Content Creation**: A team of agents could handle writing, editing, SEO optimization, and fact-checking simultaneously.                                                         │
│  - **Customer Service**: Crew AI can manage multiple agents to answer customer queries faster with more comprehensive answers.                                                       │
│                                                                                                                                                                                      │
│  #### How to Use It:                                                                                                                                                                 │
│  Crew AI is typically accessed through the CrewAI platform or API. You’d input your task via a prompt or interface, then let the system handle the rest!                             │
│                                                                                                                                                                                      │
│  If you have any specific use case in mind—like building an agent team for a particular project—I can help tailor this process even more! Just let me know what you're trying to     │
│  achieve and I’ll guide you step-by-step.                                                                                                                                            │
│                                                                                                                                                                                      │
│                                                                                                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

📖 Documentation

For more information about crewAI:

📄 License

This project is open source and available under the MIT License.


Built with ❤️ using crewAI

About

An attempt on CrewAI for building multi-agent workflow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages