This is an example of a customer service agent built using crewAI. The agent leverages AI to handle customer inquiries and support requests in a natural and helpful way, demonstrating the power of reactive agents in customer service scenarios.
This example showcases how to:
- Create an intelligent customer service agent that understands and responds to customer queries
- Handle common customer service scenarios like product returns, complaints, and general inquiries
- Implement reactive agent behavior for real-time customer interactions
- Integrate with FastAPI for a production-ready REST API
- Natural language understanding and generation
- Context-aware responses based on customer history
- Configurable knowledge base for FAQs and policies
- Real-time streaming responses
- REST API endpoints for chat integration
- Python 3.8+
- crewAI library (>=0.11.0)
- FastAPI
- uvicorn
- Other dependencies listed in requirements.txt
-
Clone the repository:
git clone https://github.com/joaomdmoura/crewAI.git cd crewAI/examples/CustomerServiceAgent
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in the src directory with your API keys:OPENAI_API_KEY=your_openai_api_key
-
Start the API server:
uvicorn src.api:app --reload
-
Send requests to the API:
# Chat endpoint curl -X POST "http://localhost:8000/chat" \ -H "Content-Type: application/json" \ -d '{"message": "What is your return policy?"}' # Streaming chat endpoint curl -X POST "http://localhost:8000/chat/stream" \ -H "Content-Type: application/json" \ -d '{"message": "Tell me about shipping"}'
You can customize the agent's behavior by:
- Modifying the knowledge base in
src/api.py
- Adjusting agent configuration in
src/agent/agent_config.py
- Extending agent capabilities in
src/agent/customer_service.py
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.