agent_profiles.pyโข10.1 kB
"""Agent capability profiles and routing presets.
This module defines factual capability profiles for known agents and
routing presets for different delegation strategies.
"""
from typing import TypedDict, Literal, Any
class AgentAttributes(TypedDict):
"""Factual attributes for an agent."""
cost_tier: Literal["free", "subscription", "pay-per-token"]
deployment: Literal["local", "cloud"]
context_window: int # approximate tokens
has_git_integration: bool
has_browser_tools: bool
response_speed: Literal["fast", "medium", "slow"]
primary_strength: str
description: str
capabilities: dict[str, float]
# Default profile for unknown agents
DEFAULT_ATTRIBUTES: AgentAttributes = {
"cost_tier": "pay-per-token",
"deployment": "cloud",
"context_window": 8192,
"has_git_integration": False,
"has_browser_tools": False,
"response_speed": "medium",
"primary_strength": "general",
"description": "General purpose agent",
"capabilities": {
"security_audit": 0.5,
"vulnerability_scan": 0.5,
"code_review": 0.5,
"architecture": 0.5,
"refactoring": 0.5,
"quick_fix": 0.5,
"documentation": 0.5,
"testing": 0.5,
"performance": 0.5,
"git_workflow": 0.5,
"github_operations": 0.5,
"general": 0.5,
},
}
# Factual profiles for known agents
AGENT_PROFILES: dict[str, AgentAttributes] = {
"claude": {
"cost_tier": "pay-per-token",
"deployment": "cloud",
"context_window": 200000,
"has_git_integration": False,
"has_browser_tools": False,
"response_speed": "medium",
"primary_strength": "complex reasoning",
"description": "Best for complex reasoning, architecture, and code review",
"capabilities": {
"security_audit": 0.8,
"vulnerability_scan": 0.7,
"code_review": 0.9,
"architecture": 0.9,
"refactoring": 0.8,
"quick_fix": 0.7,
"documentation": 0.9,
"testing": 0.8,
"performance": 0.7,
"git_workflow": 0.1,
"github_operations": 0.1,
"general": 0.9,
},
},
"gemini": {
"cost_tier": "pay-per-token",
"deployment": "cloud",
"context_window": 1000000,
"has_git_integration": False,
"has_browser_tools": True,
"response_speed": "medium",
"primary_strength": "security & performance",
"description": "Strong security analysis, performance optimization, and browser tools",
"capabilities": {
"security_audit": 0.9,
"vulnerability_scan": 0.9,
"code_review": 0.8,
"architecture": 0.8,
"refactoring": 0.7,
"quick_fix": 0.7,
"documentation": 0.8,
"testing": 0.8,
"performance": 0.9,
"git_workflow": 0.1,
"github_operations": 0.1,
"general": 0.8,
},
},
"aider": {
"cost_tier": "free", # The tool itself is free, uses BYO keys or local models
"deployment": "local",
"context_window": 32000, # Depends on model, but tool manages context
"has_git_integration": True,
"has_browser_tools": False,
"response_speed": "fast",
"primary_strength": "git & refactoring",
"description": "Excellent for rapid code editing, refactoring, and git operations",
"capabilities": {
"security_audit": 0.4,
"vulnerability_scan": 0.4,
"code_review": 0.7,
"architecture": 0.6,
"refactoring": 0.9,
"quick_fix": 0.9,
"documentation": 0.6,
"testing": 0.7,
"performance": 0.5,
"git_workflow": 0.9,
"github_operations": 0.8,
"general": 0.7,
},
},
"copilot": {
"cost_tier": "subscription",
"deployment": "cloud",
"context_window": 32000,
"has_git_integration": False,
"has_browser_tools": False,
"response_speed": "fast",
"primary_strength": "quick fixes",
"description": "Balanced capabilities with strong quick fixes and testing",
"capabilities": {
"security_audit": 0.5,
"vulnerability_scan": 0.5,
"code_review": 0.7,
"architecture": 0.6,
"refactoring": 0.8,
"quick_fix": 0.9,
"documentation": 0.7,
"testing": 0.9,
"performance": 0.6,
"git_workflow": 0.3,
"github_operations": 0.3,
"general": 0.7,
},
},
"qwen": {
"cost_tier": "free", # Usually run locally
"deployment": "local",
"context_window": 32000,
"has_git_integration": False,
"has_browser_tools": False,
"response_speed": "medium",
"primary_strength": "code review",
"description": "Code-focused with strong review and architecture capabilities",
"capabilities": {
"security_audit": 0.6,
"vulnerability_scan": 0.6,
"code_review": 0.8,
"architecture": 0.7,
"refactoring": 0.7,
"quick_fix": 0.7,
"documentation": 0.6,
"testing": 0.7,
"performance": 0.6,
"git_workflow": 0.2,
"github_operations": 0.2,
"general": 0.7,
},
},
}
class RoutingPreset(TypedDict):
"""Configuration for a routing strategy."""
name: str
description: str
strategy_description: str
cost_priority: Literal["low", "medium", "high"]
quality_priority: Literal["low", "medium", "high"]
ROUTING_PRESETS: dict[str, RoutingPreset] = {
"best_in_class": {
"name": "Best in Class",
"description": "Highest quality, cost is secondary",
"strategy_description": "Prefer Claude for architecture/review, Gemini for security, Aider for git",
"cost_priority": "low",
"quality_priority": "high",
},
"cost_optimized": {
"name": "Cost Optimized",
"description": "Minimize API costs, prefer local",
"strategy_description": "Prefer local models and Aider, use cloud agents only when necessary",
"cost_priority": "high",
"quality_priority": "medium",
},
"token_saver": {
"name": "Token Saver",
"description": "Minimize token usage",
"strategy_description": "Use agents with large context windows, prefer concise responders",
"cost_priority": "high",
"quality_priority": "medium",
},
"speed_first": {
"name": "Speed First",
"description": "Fastest iteration, good for dev",
"strategy_description": "Prefer faster models like Aider and quick cloud APIs",
"cost_priority": "low",
"quality_priority": "medium",
},
"specialized": {
"name": "Specialized Routing",
"description": "Match tasks to native capabilities",
"strategy_description": "Match tasks to agents with native tool support (e.g. Browser -> Gemini)",
"cost_priority": "medium",
"quality_priority": "high",
},
"balanced": {
"name": "Balanced (Recommended)",
"description": "Good mix of quality, speed, cost",
"strategy_description": "Distribute work sensibly across all available agents",
"cost_priority": "medium",
"quality_priority": "medium",
},
}
class RoutingRule(TypedDict):
"""Rule for routing a specific task category."""
preferred: list[str]
reason: str
# Default routing rules for "Best in Class" / "Balanced" baseline
# These are modified by the strategy logic in task_mapper.py
DEFAULT_ROUTING_RULES: dict[str, RoutingRule] = {
"architecture": {
"preferred": ["claude"],
"reason": "Marketed for complex reasoning",
},
"code_review": {
"preferred": ["claude", "qwen"],
"reason": "Strong reasoning capabilities",
},
"security_audit": {
"preferred": ["gemini"],
"reason": "Strong security analysis capabilities",
},
"refactoring": {
"preferred": ["aider"],
"reason": "Optimized for code editing",
},
"quick_fix": {
"preferred": ["aider", "copilot"],
"reason": "Optimized for speed and small edits",
},
"documentation": {
"preferred": ["claude"],
"reason": "Strong long-form writing capabilities",
},
"testing": {
"preferred": ["copilot", "claude"],
"reason": "Balanced testing capabilities",
},
"performance": {
"preferred": ["gemini"],
"reason": "Strong analytical capabilities",
},
"browser_interaction": {
"preferred": ["gemini"],
"reason": "Has browser automation tools",
},
"git_operations": {
"preferred": ["aider"],
"reason": "Native git integration",
},
"shell_tasks": {
"preferred": ["aider"],
"reason": "Strong command line capabilities",
},
"exploration": {
"preferred": ["claude"],
"reason": "Large context window for codebase understanding",
},
"debugging": {
"preferred": ["claude"],
"reason": "Complex reasoning for root cause analysis",
},
"impact_analysis": {
"preferred": ["claude"],
"reason": "Complex reasoning for dependency analysis",
},
"general": {
"preferred": ["claude"],
"reason": "General purpose reasoning",
},
}
def get_agent_profile(agent_name: str) -> AgentAttributes:
"""
Get factual profile for an agent.
Args:
agent_name: Name of the agent (case-insensitive)
Returns:
AgentAttributes with factual metadata
"""
agent_key = agent_name.lower().strip()
return AGENT_PROFILES.get(agent_key, DEFAULT_ATTRIBUTES)