An intelligent multi-agent system built with Google Agent Development Kit (ADK) that provides automated IT support with intelligent routing and escalation.
The AI Ticket Agent system uses LLM-powered agents to:
- Analyze IT problems using natural language understanding
- Route issues to appropriate human teams via Slack
- Provide self-service solutions for common problems
- Collect user emails for notifications and tracking
- Escalate complex issues to human teams with proper context
| Agent | Role | Capabilities |
|---|---|---|
| π― Root Agent | Orchestrates the system | Analyzes problems, routes to sub-agents, collects emails |
| π οΈ Self-Service Agent | Handles common issues | Provides solutions, searches knowledge base, sends notifications |
| Manages complex issues | Routes to human teams via Slack, sets priorities |
- Python 3.11+
- Google Cloud Project (for Gemini API)
- Slack workspace (for team notifications)
-
Clone the repository:
git clone <repository-url> cd AI-Ticket-Agent
-
Install dependencies:
poetry install
-
Set up environment variables:
cp env.example .env
Configure the following in
.env:# Google Cloud Configuration GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service-account.json GOOGLE_CLOUD_PROJECT=your-project-id GOOGLE_CLOUD_LOCATION=us-central1 # Slack Configuration SLACK_BOT_TOKEN=xoxb-your-slack-bot-token SLACK_CHANNEL_ID=C1234567890 # Email Configuration (Optional) SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USERNAME=your-email@gmail.com SMTP_PASSWORD=your-app-password
-
Set up Slack (see
SLACK_SETUP.mdfor detailed instructions):- Create Slack app with
chat:writescope - Create team channels
- Invite bot to channels
- Create Slack app with
-
Initialize database:
python run.py init-db
# Check system status
python run.py status
# Start ADK web interface
python run.py web
# Start ADK CLI interface
python run.py cli
# Run tests
python run.py test
# Initialize database
python run.py init-db
# Start dashboard
python run.py dashboardSelf-Service Scenario:
User: "I forgot my password and need to reset it. My email is john@company.com"
System: Routes to Self-Service Agent β Provides password reset steps β Sends email notification
Escalation Scenario:
User: "Our CRM system is completely broken. Users can't log in and we're getting database errors."
System: Routes to Escalation Agent β Analyzes as Software Team issue β Sends to #it-software-support Slack channel
# Run basic agent tests
python test_agents.py
# Test Slack notifications
python test_slack_notifications.py
# Run all tests
python run.py testThe system routes issues to these teams:
| Team | Channel | Issues |
|---|---|---|
| Software Team | #it-software-support |
Application bugs, CRM/ERP issues, software conflicts |
| Security Team | #it-security-support |
Security incidents, malware, data breaches |
| Hardware Team | #it-hardware-support |
Hardware failures, device issues, physical damage |
| Network Team | #it-network-support |
VPN issues, connectivity problems, firewall issues |
| Infrastructure Team | #it-infrastructure-support |
Server issues, core infrastructure, system outages |
| Access Management | #it-access-support |
Account creation, permissions, user provisioning |
| General IT Support | #it-general-support |
Multiple issues, general troubleshooting |
The system sends rich Slack messages with:
- Priority indicators (π¨ Critical,
β οΈ High, π Medium, βΉοΈ Low) - User information and problem description
- Team assignment and next steps
- AI agent attribution
Users receive email notifications for:
- Solution steps (self-service scenarios)
- Escalation confirmations (human team assignment)
- Status updates (when available)
The system now includes comprehensive ticket tracking with database persistence:
- Complete ticket lifecycle from creation to resolution
- Status tracking with audit trail of all changes
- Resolution attempts with user feedback analysis
- Team assignments and routing history
- Search and filtering capabilities
- Open β In Progress β Resolved β Closed
- Escalated (when human team intervention needed)
- Self-service attempts with success/failure tracking
- User feedback analysis using LLM-like logic
- Escalation reasons and team assignments
- Complete audit trail of all interactions
# Initialize database
python run.py init-db
# Test ticket lifecycle
python test_ticket_lifecycle.py
# Start Streamlit dashboard
python run.py dashboardThe system includes a comprehensive Streamlit dashboard for real-time ticket monitoring and analytics:
- π Real-time Metrics - Total, open, resolved, and escalated tickets
- π Interactive Charts - Status, priority, category, and team distributions
- π« Ticket Management - Filter, search, and view detailed ticket information
- π Analytics - Time-based analysis, resolution times, team performance
- βοΈ Settings - Database status and system configuration
- Key performance metrics
- Status distribution pie chart
- Priority distribution bar chart
- Category and team analysis
- Resolution success rates
- Filter tickets by status, priority, team
- View detailed ticket information
- Track resolution attempts and user feedback
- Complete audit trail
- Daily ticket volume trends
- Resolution time analysis
- Team performance metrics
- Success rate comparisons
# Using run.py
python run.py dashboard
# Direct Streamlit command
streamlit run dashboard.pyThe dashboard will open in your browser at http://localhost:8501
Edit ai_ticket_agent/tools/slack_handlers.py:
team_channel_map = {
"Software Team": "#your-software-channel",
"Security Team": "#your-security-channel",
# ... customize as needed
}Edit ai_ticket_agent/tools/knowledge_base.py to add common solutions.
"channel_not_found" error:
- Create the required Slack channels
- Invite the bot to each channel
- Check channel names in configuration
"missing_scope" error:
- Add
chat:writescope to your Slack app - Reinstall the app after adding scopes
Google Cloud authentication:
- Set up service account credentials
- Ensure
GOOGLE_APPLICATION_CREDENTIALSpoints to valid JSON file
ai_ticket_agent/
βββ agent.py # Root agent orchestrator
βββ models.py # Database models and schemas
βββ database.py # Database connection and management
βββ prompt.py # LLM prompts and instructions
βββ tools/ # Agent tools and utilities
β βββ problem_analyzer.py
β βββ team_router.py
β βββ knowledge_base.py
β βββ resolution_tracker.py
β βββ ticket_manager.py
β βββ slack_handlers.py
β βββ email_collector.py
β βββ notification_sender.py
βββ sub_agents/ # Specialized agent implementations
βββ __init__.py
# Dashboard and utilities
dashboard.py # Streamlit dashboard application
init_database.py # Database initialization script
run.py # Main runner script
test_ticket_lifecycle.py # Ticket lifecycle testing
test_dashboard.py # Dashboard functionality testing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Apache License 2.0
