This guide explains how to use the enhanced Resource Allocator Agent to automatically assign tasks to available developers and create GitHub issues using MongoDB as the data source.
-
Smart Task Assignment: Automatically assigns tasks to the best available developers based on:
- Skill matching with task requirements
- Developer availability (from MongoDB)
- Performance metrics (success rate, completion time)
- Current workload
-
GitHub Integration: Automatically creates GitHub issues for assigned tasks with:
- Detailed task descriptions
- Acceptance criteria
- Developer assignment
- Proper labels and formatting
-
MongoDB Integration: All data is stored and retrieved from MongoDB:
- Project analyses
- Tasks and assignments
- Developer information and workload
- Real-time updates
-
Complete Workflow: End-to-end automation from project description to task assignment
Make sure you have the required environment variables in your .env file:
GITHUB_TOKEN=your_github_personal_access_token
MONGO_URI=your_mongodb_connection_string
GEMINI_API_KEY=your_gemini_api_keyFirst, add developers to your MongoDB database:
POST /developers/batchWith developer data in the request body.
Use the complete workflow endpoint for end-to-end automation:
POST /complete_workflowThis will:
- Analyze your project description using Gemini AI
- Generate tasks automatically
- Store everything in MongoDB
- Assign tasks to available developers
- Optionally create GitHub issues
POST /complete_workflowRequest Body:
{
"project_description": "Build a web application for task management with user authentication, real-time notifications, and analytics dashboard. Users should be able to create projects, assign tasks, track progress, and generate reports.",
"repo_name": "your-username/your-repo",
"create_github_issues": true
}Response:
{
"status": "success",
"workflow_summary": {
"analysis_id": "507f1f77bcf86cd799439011",
"project_id": "PROJECT-12345",
"total_tasks_created": 8,
"tasks_assigned": 7,
"github_issues_created": 7
},
"project_analysis": { ... },
"tasks": [ ... ],
"assignment_results": [ ... ]
}POST /analyze_project_geminiRequest Body:
{
"description": "Build a web application for task management..."
}POST /create_tasks_from_analysis_idRequest Body:
"507f1f77bcf86cd799439011"POST /allocate_tasks_by_projectQuery Parameters:
project_id: The project ID from the analysisrepo_name: GitHub repository (optional)create_github_issues: Boolean flag
Response:
{
"assignment_results": [
{
"task_id": "TASK-001",
"task_title": "Implement user authentication",
"assigned_to": "Alice Thompson",
"developer_id": "A193014",
"github_username": "jayypatel18",
"assignment_score": 0.85,
"github_issue": {
"status": "created",
"issue_number": 42,
"issue_url": "https://github.com/your-username/your-repo/issues/42"
}
}
]
}GET /developers/availableResponse:
{
"available_developers": [
{
"id": "A193014",
"name": "Alice Thompson",
"skills": ["Python", "Django", "PostgreSQL"],
"github_username": "jayypatel18",
"current_tasks_count": 0,
"performance_metrics": {
"success_rate": 0.95,
"avg_completion_time": 7.5
}
}
],
"total_available": 15
}POST /developers/by_skillsRequest Body:
{
"required_skills": ["Python", "React", "PostgreSQL"]
}GET /developers/workloadReturns detailed workload information for all developers.
The resource allocator uses a scoring system to find the best developer for each task:
- Skill Match (40%): How well the developer's skills match the task requirements
- Availability (20%): Whether the developer is currently available
- Performance (30%): Developer's historical success rate
- Workload (10%): Current number of assigned tasks
- Load Developers: Queries MongoDB for available developers (
availability: true) - Calculate Scores: Computes assignment score for each developer-task pair
- Best Match: Assigns task to developer with highest score
- Update Database: Updates task assignment and developer workload in MongoDB
- Create GitHub Issue: If enabled, creates issue and assigns to developer
- Real-time Updates: All changes are immediately reflected in the database
When creating GitHub issues, the system generates:
## Task Description
[Task description from the task object]
## Assigned Developer
- **Name**: Alice Thompson
- **GitHub**: @jayypatel18
- **Skills**: Python, Django, PostgreSQL
## Acceptance Criteria
- JWT token implementation
- Login/register endpoints
- Unit tests with 90% coverage
## Estimated Time
16.0 hours
## Dependencies
- TASK-000: Setup project structure
---
*This issue was automatically created by the Resource Allocator Agent*Developers are stored in MongoDB with the following structure:
{
"id": "A193014",
"name": "Alice Thompson",
"skills": ["Python", "Django", "PostgreSQL"],
"github_username": "jayypatel18",
"current_tasks": [],
"availability": true,
"performance_metrics": {
"success_rate": 0.95,
"avg_completion_time": 7.5
}
}POST /developers/batchRequest Body:
[
{
"id": "A193014",
"name": "Alice Thompson",
"skills": ["Python", "Django", "PostgreSQL"],
"github_username": "alice_dev",
"current_tasks": [],
"availability": true,
"performance_metrics": {
"success_rate": 0.95,
"avg_completion_time": 7.5
}
}
]- Include clear acceptance criteria
- Use descriptive titles and descriptions
- Mention specific technologies in requirements
- Set realistic time estimates
- Keep developer skills updated
- Use consistent skill naming (e.g., "JavaScript" not "JS")
- Include both technologies and methodologies
- Ensure developers have GitHub accounts
- Use consistent GitHub usernames
- Set up proper repository permissions
- Consider using labels for better organization
-
No developers assigned
- Check if developers are available (
availability: true) in MongoDB - Verify skill matching between tasks and developers
- Ensure developers exist in the MongoDB database
- Check if developers are available (
-
GitHub issue creation fails
- Verify GITHUB_TOKEN is valid and has repo permissions
- Check repository name format (owner/repo)
- Ensure developer GitHub usernames are correct
-
Low assignment scores
- Review task descriptions for skill keywords
- Update developer skill lists
- Check performance metrics are realistic
Enable logging to see detailed assignment information:
import logging
logging.basicConfig(level=logging.INFO)Override the calculate_assignment_score method:
class CustomResourceAllocator(ResourceAllocatorAgent):
def calculate_assignment_score(self, task: Task, developer: Developer) -> float:
# Your custom scoring logic here
return custom_scoreThe system is designed to be extensible. You can add:
- Slack notifications
- Jira integration
- Time tracking systems
- Custom analytics
- Developer data is cached after first load
- GitHub API has rate limits (5000 requests/hour)
- Consider batching operations for large task sets
- Monitor memory usage with large developer pools
- Store GitHub tokens securely
- Use environment variables for sensitive data
- Implement proper access controls
- Audit assignment decisions regularly