claude-mpm 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of claude-mpm might be problematic. Click here for more details.
- claude_mpm/__init__.py +17 -0
- claude_mpm/__main__.py +14 -0
- claude_mpm/_version.py +32 -0
- claude_mpm/agents/BASE_AGENT_TEMPLATE.md +88 -0
- claude_mpm/agents/INSTRUCTIONS.md +375 -0
- claude_mpm/agents/__init__.py +118 -0
- claude_mpm/agents/agent_loader.py +621 -0
- claude_mpm/agents/agent_loader_integration.py +229 -0
- claude_mpm/agents/agents_metadata.py +204 -0
- claude_mpm/agents/base_agent.json +27 -0
- claude_mpm/agents/base_agent_loader.py +519 -0
- claude_mpm/agents/schema/agent_schema.json +160 -0
- claude_mpm/agents/system_agent_config.py +587 -0
- claude_mpm/agents/templates/__init__.py +101 -0
- claude_mpm/agents/templates/data_engineer_agent.json +46 -0
- claude_mpm/agents/templates/documentation_agent.json +45 -0
- claude_mpm/agents/templates/engineer_agent.json +49 -0
- claude_mpm/agents/templates/ops_agent.json +46 -0
- claude_mpm/agents/templates/qa_agent.json +45 -0
- claude_mpm/agents/templates/research_agent.json +49 -0
- claude_mpm/agents/templates/security_agent.json +46 -0
- claude_mpm/agents/templates/update-optimized-specialized-agents.json +374 -0
- claude_mpm/agents/templates/version_control_agent.json +46 -0
- claude_mpm/agents/test_fix_deployment/.claude-pm/config/project.json +6 -0
- claude_mpm/cli.py +655 -0
- claude_mpm/cli_main.py +13 -0
- claude_mpm/cli_module/__init__.py +15 -0
- claude_mpm/cli_module/args.py +222 -0
- claude_mpm/cli_module/commands.py +203 -0
- claude_mpm/cli_module/migration_example.py +183 -0
- claude_mpm/cli_module/refactoring_guide.md +253 -0
- claude_mpm/cli_old/__init__.py +1 -0
- claude_mpm/cli_old/ticket_cli.py +102 -0
- claude_mpm/config/__init__.py +5 -0
- claude_mpm/config/hook_config.py +42 -0
- claude_mpm/constants.py +150 -0
- claude_mpm/core/__init__.py +45 -0
- claude_mpm/core/agent_name_normalizer.py +248 -0
- claude_mpm/core/agent_registry.py +627 -0
- claude_mpm/core/agent_registry.py.bak +312 -0
- claude_mpm/core/agent_session_manager.py +273 -0
- claude_mpm/core/base_service.py +747 -0
- claude_mpm/core/base_service.py.bak +406 -0
- claude_mpm/core/config.py +334 -0
- claude_mpm/core/config_aliases.py +292 -0
- claude_mpm/core/container.py +347 -0
- claude_mpm/core/factories.py +281 -0
- claude_mpm/core/framework_loader.py +472 -0
- claude_mpm/core/injectable_service.py +206 -0
- claude_mpm/core/interfaces.py +539 -0
- claude_mpm/core/logger.py +468 -0
- claude_mpm/core/minimal_framework_loader.py +107 -0
- claude_mpm/core/mixins.py +150 -0
- claude_mpm/core/service_registry.py +299 -0
- claude_mpm/core/session_manager.py +190 -0
- claude_mpm/core/simple_runner.py +511 -0
- claude_mpm/core/tool_access_control.py +173 -0
- claude_mpm/hooks/README.md +243 -0
- claude_mpm/hooks/__init__.py +5 -0
- claude_mpm/hooks/base_hook.py +154 -0
- claude_mpm/hooks/builtin/__init__.py +1 -0
- claude_mpm/hooks/builtin/logging_hook_example.py +165 -0
- claude_mpm/hooks/builtin/post_delegation_hook_example.py +124 -0
- claude_mpm/hooks/builtin/pre_delegation_hook_example.py +125 -0
- claude_mpm/hooks/builtin/submit_hook_example.py +100 -0
- claude_mpm/hooks/builtin/ticket_extraction_hook_example.py +237 -0
- claude_mpm/hooks/builtin/todo_agent_prefix_hook.py +239 -0
- claude_mpm/hooks/builtin/workflow_start_hook.py +181 -0
- claude_mpm/hooks/hook_client.py +264 -0
- claude_mpm/hooks/hook_runner.py +370 -0
- claude_mpm/hooks/json_rpc_executor.py +259 -0
- claude_mpm/hooks/json_rpc_hook_client.py +319 -0
- claude_mpm/hooks/tool_call_interceptor.py +204 -0
- claude_mpm/init.py +246 -0
- claude_mpm/orchestration/SUBPROCESS_DESIGN.md +66 -0
- claude_mpm/orchestration/__init__.py +6 -0
- claude_mpm/orchestration/archive/direct_orchestrator.py +195 -0
- claude_mpm/orchestration/archive/factory.py +215 -0
- claude_mpm/orchestration/archive/hook_enabled_orchestrator.py +188 -0
- claude_mpm/orchestration/archive/hook_integration_example.py +178 -0
- claude_mpm/orchestration/archive/interactive_subprocess_orchestrator.py +826 -0
- claude_mpm/orchestration/archive/orchestrator.py +501 -0
- claude_mpm/orchestration/archive/pexpect_orchestrator.py +252 -0
- claude_mpm/orchestration/archive/pty_orchestrator.py +270 -0
- claude_mpm/orchestration/archive/simple_orchestrator.py +82 -0
- claude_mpm/orchestration/archive/subprocess_orchestrator.py +801 -0
- claude_mpm/orchestration/archive/system_prompt_orchestrator.py +278 -0
- claude_mpm/orchestration/archive/wrapper_orchestrator.py +187 -0
- claude_mpm/scripts/__init__.py +1 -0
- claude_mpm/scripts/ticket.py +269 -0
- claude_mpm/services/__init__.py +10 -0
- claude_mpm/services/agent_deployment.py +955 -0
- claude_mpm/services/agent_lifecycle_manager.py +948 -0
- claude_mpm/services/agent_management_service.py +596 -0
- claude_mpm/services/agent_modification_tracker.py +841 -0
- claude_mpm/services/agent_profile_loader.py +606 -0
- claude_mpm/services/agent_registry.py +677 -0
- claude_mpm/services/base_agent_manager.py +380 -0
- claude_mpm/services/framework_agent_loader.py +337 -0
- claude_mpm/services/framework_claude_md_generator/README.md +92 -0
- claude_mpm/services/framework_claude_md_generator/__init__.py +206 -0
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +151 -0
- claude_mpm/services/framework_claude_md_generator/content_validator.py +126 -0
- claude_mpm/services/framework_claude_md_generator/deployment_manager.py +137 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +106 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +582 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/claude_pm_init.py +97 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/core_responsibilities.py +27 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/delegation_constraints.py +23 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/environment_config.py +23 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/footer.py +20 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/header.py +26 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/orchestration_principles.py +30 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/role_designation.py +37 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/subprocess_validation.py +111 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/todo_task_tools.py +89 -0
- claude_mpm/services/framework_claude_md_generator/section_generators/troubleshooting.py +39 -0
- claude_mpm/services/framework_claude_md_generator/section_manager.py +106 -0
- claude_mpm/services/framework_claude_md_generator/version_manager.py +121 -0
- claude_mpm/services/framework_claude_md_generator.py +621 -0
- claude_mpm/services/hook_service.py +388 -0
- claude_mpm/services/hook_service_manager.py +223 -0
- claude_mpm/services/json_rpc_hook_manager.py +92 -0
- claude_mpm/services/parent_directory_manager/README.md +83 -0
- claude_mpm/services/parent_directory_manager/__init__.py +577 -0
- claude_mpm/services/parent_directory_manager/backup_manager.py +258 -0
- claude_mpm/services/parent_directory_manager/config_manager.py +210 -0
- claude_mpm/services/parent_directory_manager/deduplication_manager.py +279 -0
- claude_mpm/services/parent_directory_manager/framework_protector.py +143 -0
- claude_mpm/services/parent_directory_manager/operations.py +186 -0
- claude_mpm/services/parent_directory_manager/state_manager.py +624 -0
- claude_mpm/services/parent_directory_manager/template_deployer.py +579 -0
- claude_mpm/services/parent_directory_manager/validation_manager.py +378 -0
- claude_mpm/services/parent_directory_manager/version_control_helper.py +339 -0
- claude_mpm/services/parent_directory_manager/version_manager.py +222 -0
- claude_mpm/services/shared_prompt_cache.py +819 -0
- claude_mpm/services/ticket_manager.py +213 -0
- claude_mpm/services/ticket_manager_di.py +318 -0
- claude_mpm/services/ticketing_service_original.py +508 -0
- claude_mpm/services/version_control/VERSION +1 -0
- claude_mpm/services/version_control/__init__.py +70 -0
- claude_mpm/services/version_control/branch_strategy.py +670 -0
- claude_mpm/services/version_control/conflict_resolution.py +744 -0
- claude_mpm/services/version_control/git_operations.py +784 -0
- claude_mpm/services/version_control/semantic_versioning.py +703 -0
- claude_mpm/ui/__init__.py +1 -0
- claude_mpm/ui/rich_terminal_ui.py +295 -0
- claude_mpm/ui/terminal_ui.py +328 -0
- claude_mpm/utils/__init__.py +16 -0
- claude_mpm/utils/config_manager.py +468 -0
- claude_mpm/utils/import_migration_example.py +80 -0
- claude_mpm/utils/imports.py +182 -0
- claude_mpm/utils/path_operations.py +357 -0
- claude_mpm/utils/paths.py +289 -0
- claude_mpm-0.3.0.dist-info/METADATA +290 -0
- claude_mpm-0.3.0.dist-info/RECORD +159 -0
- claude_mpm-0.3.0.dist-info/WHEEL +5 -0
- claude_mpm-0.3.0.dist-info/entry_points.txt +4 -0
- claude_mpm-0.3.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
"""
|
|
2
|
+
System Agent Configuration with Model Assignments
|
|
3
|
+
================================================
|
|
4
|
+
|
|
5
|
+
Configures system agents with default model assignments and settings.
|
|
6
|
+
Integrates with the ModelSelector and default model configuration system.
|
|
7
|
+
|
|
8
|
+
Key Features:
|
|
9
|
+
- System agent metadata with model preferences
|
|
10
|
+
- Model capability validation
|
|
11
|
+
- Configuration inheritance
|
|
12
|
+
- Performance optimization settings
|
|
13
|
+
- Agent-specific customization
|
|
14
|
+
|
|
15
|
+
Created: 2025-07-16
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import logging
|
|
19
|
+
from typing import Dict, List, Optional, Any, Type
|
|
20
|
+
from dataclasses import dataclass, field
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from ..config.default_model_config import DefaultModelConfigManager, get_default_model_for_agent_type
|
|
24
|
+
from ..config.model_env_defaults import ModelEnvironmentLoader, get_model_for_agent_from_env
|
|
25
|
+
from ..services.model_selector import ModelSelector, ModelType, ModelSelectionCriteria
|
|
26
|
+
|
|
27
|
+
logger = logging.getLogger(__name__)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass
|
|
31
|
+
class SystemAgentConfig:
|
|
32
|
+
"""Configuration for a system agent"""
|
|
33
|
+
agent_type: str
|
|
34
|
+
agent_name: str
|
|
35
|
+
description: str
|
|
36
|
+
default_model: str
|
|
37
|
+
capabilities: List[str] = field(default_factory=list)
|
|
38
|
+
specializations: List[str] = field(default_factory=list)
|
|
39
|
+
performance_requirements: Dict[str, Any] = field(default_factory=dict)
|
|
40
|
+
model_preferences: Dict[str, Any] = field(default_factory=dict)
|
|
41
|
+
enabled: bool = True
|
|
42
|
+
priority: int = 100 # Lower number = higher priority
|
|
43
|
+
|
|
44
|
+
def get_effective_model(self) -> str:
|
|
45
|
+
"""Get the effective model considering environment overrides."""
|
|
46
|
+
# Check environment override
|
|
47
|
+
env_model = get_model_for_agent_from_env(self.agent_type)
|
|
48
|
+
if env_model:
|
|
49
|
+
return env_model
|
|
50
|
+
|
|
51
|
+
# Use default model
|
|
52
|
+
return self.default_model
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class SystemAgentConfigManager:
|
|
56
|
+
"""
|
|
57
|
+
Manager for system agent configurations with model integration.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
def __init__(self):
|
|
61
|
+
"""Initialize system agent configuration manager."""
|
|
62
|
+
self.model_config_manager = DefaultModelConfigManager()
|
|
63
|
+
self.model_selector = ModelSelector()
|
|
64
|
+
self.env_loader = ModelEnvironmentLoader()
|
|
65
|
+
self._agents: Dict[str, SystemAgentConfig] = {}
|
|
66
|
+
self._initialize_system_agents()
|
|
67
|
+
|
|
68
|
+
logger.info("SystemAgentConfigManager initialized with model integration")
|
|
69
|
+
|
|
70
|
+
def _initialize_system_agents(self) -> None:
|
|
71
|
+
"""Initialize all system agent configurations."""
|
|
72
|
+
|
|
73
|
+
# Core Orchestrator/Engineering Agents (Opus models)
|
|
74
|
+
self._agents["orchestrator"] = SystemAgentConfig(
|
|
75
|
+
agent_type="orchestrator",
|
|
76
|
+
agent_name="Project Orchestrator",
|
|
77
|
+
description="Multi-agent project orchestration and coordination",
|
|
78
|
+
default_model=ModelType.OPUS.value,
|
|
79
|
+
capabilities=[
|
|
80
|
+
"project_management", "task_delegation", "workflow_coordination",
|
|
81
|
+
"strategic_planning", "multi_agent_communication", "decision_making"
|
|
82
|
+
],
|
|
83
|
+
specializations=["orchestration", "coordination", "planning"],
|
|
84
|
+
performance_requirements={
|
|
85
|
+
"reasoning_depth": "expert",
|
|
86
|
+
"task_complexity": "expert",
|
|
87
|
+
"creativity_required": True,
|
|
88
|
+
"speed_priority": False
|
|
89
|
+
},
|
|
90
|
+
model_preferences={
|
|
91
|
+
"preferred_models": [ModelType.OPUS.value, ModelType.SONNET_4.value],
|
|
92
|
+
"minimum_reasoning_tier": "expert",
|
|
93
|
+
"context_requirements": "high"
|
|
94
|
+
},
|
|
95
|
+
priority=1
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
self._agents["engineer"] = SystemAgentConfig(
|
|
99
|
+
agent_type="engineer",
|
|
100
|
+
agent_name="Software Engineer",
|
|
101
|
+
description="Code implementation, development, and inline documentation",
|
|
102
|
+
default_model=ModelType.OPUS.value,
|
|
103
|
+
capabilities=[
|
|
104
|
+
"code_generation", "system_design", "architecture_planning",
|
|
105
|
+
"debugging", "refactoring", "technical_implementation"
|
|
106
|
+
],
|
|
107
|
+
specializations=["engineering", "development", "implementation"],
|
|
108
|
+
performance_requirements={
|
|
109
|
+
"reasoning_depth": "expert",
|
|
110
|
+
"task_complexity": "high",
|
|
111
|
+
"creativity_required": True,
|
|
112
|
+
"speed_priority": False
|
|
113
|
+
},
|
|
114
|
+
model_preferences={
|
|
115
|
+
"preferred_models": [ModelType.OPUS.value, ModelType.SONNET_4.value],
|
|
116
|
+
"minimum_reasoning_tier": "expert",
|
|
117
|
+
"context_requirements": "high"
|
|
118
|
+
},
|
|
119
|
+
priority=10
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
self._agents["architecture"] = SystemAgentConfig(
|
|
123
|
+
agent_type="architecture",
|
|
124
|
+
agent_name="Software Architect",
|
|
125
|
+
description="System architecture design and technical planning",
|
|
126
|
+
default_model=ModelType.OPUS.value,
|
|
127
|
+
capabilities=[
|
|
128
|
+
"system_architecture", "design_patterns", "scalability_planning",
|
|
129
|
+
"technology_selection", "architectural_decision_making"
|
|
130
|
+
],
|
|
131
|
+
specializations=["architecture", "design", "planning"],
|
|
132
|
+
performance_requirements={
|
|
133
|
+
"reasoning_depth": "expert",
|
|
134
|
+
"task_complexity": "expert",
|
|
135
|
+
"creativity_required": True,
|
|
136
|
+
"speed_priority": False
|
|
137
|
+
},
|
|
138
|
+
model_preferences={
|
|
139
|
+
"preferred_models": [ModelType.OPUS.value],
|
|
140
|
+
"minimum_reasoning_tier": "expert",
|
|
141
|
+
"context_requirements": "high"
|
|
142
|
+
},
|
|
143
|
+
priority=5
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
# Core Support Agents (Sonnet models)
|
|
147
|
+
self._agents["documentation"] = SystemAgentConfig(
|
|
148
|
+
agent_type="documentation",
|
|
149
|
+
agent_name="Documentation Agent",
|
|
150
|
+
description="Project documentation pattern analysis and operational understanding",
|
|
151
|
+
default_model=ModelType.SONNET.value,
|
|
152
|
+
capabilities=[
|
|
153
|
+
"documentation_analysis", "technical_writing", "changelog_generation",
|
|
154
|
+
"version_documentation", "pattern_recognition"
|
|
155
|
+
],
|
|
156
|
+
specializations=["documentation", "analysis", "writing"],
|
|
157
|
+
performance_requirements={
|
|
158
|
+
"reasoning_depth": "advanced",
|
|
159
|
+
"task_complexity": "medium",
|
|
160
|
+
"creativity_required": False,
|
|
161
|
+
"speed_priority": True
|
|
162
|
+
},
|
|
163
|
+
model_preferences={
|
|
164
|
+
"preferred_models": [ModelType.SONNET.value, ModelType.SONNET_4.value],
|
|
165
|
+
"minimum_reasoning_tier": "advanced",
|
|
166
|
+
"context_requirements": "medium"
|
|
167
|
+
},
|
|
168
|
+
priority=20
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
self._agents["qa"] = SystemAgentConfig(
|
|
172
|
+
agent_type="qa",
|
|
173
|
+
agent_name="Quality Assurance Agent",
|
|
174
|
+
description="Quality assurance, testing, and validation",
|
|
175
|
+
default_model=ModelType.SONNET.value,
|
|
176
|
+
capabilities=[
|
|
177
|
+
"test_planning", "quality_validation", "testing_automation",
|
|
178
|
+
"bug_detection", "performance_testing"
|
|
179
|
+
],
|
|
180
|
+
specializations=["qa", "testing", "validation"],
|
|
181
|
+
performance_requirements={
|
|
182
|
+
"reasoning_depth": "advanced",
|
|
183
|
+
"task_complexity": "medium",
|
|
184
|
+
"creativity_required": False,
|
|
185
|
+
"speed_priority": True
|
|
186
|
+
},
|
|
187
|
+
model_preferences={
|
|
188
|
+
"preferred_models": [ModelType.SONNET.value, ModelType.SONNET_4.value],
|
|
189
|
+
"minimum_reasoning_tier": "advanced",
|
|
190
|
+
"context_requirements": "medium"
|
|
191
|
+
},
|
|
192
|
+
priority=30
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
self._agents["research"] = SystemAgentConfig(
|
|
196
|
+
agent_type="research",
|
|
197
|
+
agent_name="Research Agent",
|
|
198
|
+
description="Investigation, analysis, and information gathering",
|
|
199
|
+
default_model=ModelType.SONNET.value,
|
|
200
|
+
capabilities=[
|
|
201
|
+
"research_methodology", "data_analysis", "information_synthesis",
|
|
202
|
+
"market_research", "technical_investigation"
|
|
203
|
+
],
|
|
204
|
+
specializations=["research", "analysis", "investigation"],
|
|
205
|
+
performance_requirements={
|
|
206
|
+
"reasoning_depth": "advanced",
|
|
207
|
+
"task_complexity": "medium",
|
|
208
|
+
"creativity_required": False,
|
|
209
|
+
"speed_priority": False
|
|
210
|
+
},
|
|
211
|
+
model_preferences={
|
|
212
|
+
"preferred_models": [ModelType.SONNET.value, ModelType.SONNET_4.value],
|
|
213
|
+
"minimum_reasoning_tier": "advanced",
|
|
214
|
+
"context_requirements": "high"
|
|
215
|
+
},
|
|
216
|
+
priority=40
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
self._agents["ops"] = SystemAgentConfig(
|
|
220
|
+
agent_type="ops",
|
|
221
|
+
agent_name="Operations Agent",
|
|
222
|
+
description="Deployment, operations, and infrastructure management",
|
|
223
|
+
default_model=ModelType.SONNET.value,
|
|
224
|
+
capabilities=[
|
|
225
|
+
"deployment_automation", "infrastructure_management", "monitoring_setup",
|
|
226
|
+
"devops_workflows", "system_administration"
|
|
227
|
+
],
|
|
228
|
+
specializations=["ops", "deployment", "infrastructure"],
|
|
229
|
+
performance_requirements={
|
|
230
|
+
"reasoning_depth": "advanced",
|
|
231
|
+
"task_complexity": "medium",
|
|
232
|
+
"creativity_required": False,
|
|
233
|
+
"speed_priority": True
|
|
234
|
+
},
|
|
235
|
+
model_preferences={
|
|
236
|
+
"preferred_models": [ModelType.SONNET.value, ModelType.SONNET_4.value],
|
|
237
|
+
"minimum_reasoning_tier": "advanced",
|
|
238
|
+
"context_requirements": "medium"
|
|
239
|
+
},
|
|
240
|
+
priority=50
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
self._agents["security"] = SystemAgentConfig(
|
|
244
|
+
agent_type="security",
|
|
245
|
+
agent_name="Security Agent",
|
|
246
|
+
description="Security analysis, vulnerability assessment, and protection",
|
|
247
|
+
default_model=ModelType.SONNET.value,
|
|
248
|
+
capabilities=[
|
|
249
|
+
"security_analysis", "vulnerability_assessment", "threat_modeling",
|
|
250
|
+
"security_auditing", "compliance_checking"
|
|
251
|
+
],
|
|
252
|
+
specializations=["security", "compliance", "auditing"],
|
|
253
|
+
performance_requirements={
|
|
254
|
+
"reasoning_depth": "advanced",
|
|
255
|
+
"task_complexity": "high",
|
|
256
|
+
"creativity_required": False,
|
|
257
|
+
"speed_priority": False
|
|
258
|
+
},
|
|
259
|
+
model_preferences={
|
|
260
|
+
"preferred_models": [ModelType.SONNET.value, ModelType.SONNET_4.value],
|
|
261
|
+
"minimum_reasoning_tier": "advanced",
|
|
262
|
+
"context_requirements": "high"
|
|
263
|
+
},
|
|
264
|
+
priority=35
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
self._agents["data_engineer"] = SystemAgentConfig(
|
|
268
|
+
agent_type="data_engineer",
|
|
269
|
+
agent_name="Data Engineer Agent",
|
|
270
|
+
description="Data store management and AI API integrations",
|
|
271
|
+
default_model=ModelType.SONNET.value,
|
|
272
|
+
capabilities=[
|
|
273
|
+
"database_management", "data_pipeline_design", "api_integration",
|
|
274
|
+
"data_modeling", "performance_optimization"
|
|
275
|
+
],
|
|
276
|
+
specializations=["data_engineering", "database", "api"],
|
|
277
|
+
performance_requirements={
|
|
278
|
+
"reasoning_depth": "advanced",
|
|
279
|
+
"task_complexity": "medium",
|
|
280
|
+
"creativity_required": False,
|
|
281
|
+
"speed_priority": True
|
|
282
|
+
},
|
|
283
|
+
model_preferences={
|
|
284
|
+
"preferred_models": [ModelType.SONNET.value, ModelType.SONNET_4.value],
|
|
285
|
+
"minimum_reasoning_tier": "advanced",
|
|
286
|
+
"context_requirements": "medium"
|
|
287
|
+
},
|
|
288
|
+
priority=45
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
self._agents["version_control"] = SystemAgentConfig(
|
|
292
|
+
agent_type="version_control",
|
|
293
|
+
agent_name="Version Control Agent",
|
|
294
|
+
description="Git operations, branch management, and version control",
|
|
295
|
+
default_model=ModelType.SONNET.value,
|
|
296
|
+
capabilities=[
|
|
297
|
+
"git_operations", "branch_management", "version_tagging",
|
|
298
|
+
"merge_management", "repository_administration"
|
|
299
|
+
],
|
|
300
|
+
specializations=["version_control", "git", "branching"],
|
|
301
|
+
performance_requirements={
|
|
302
|
+
"reasoning_depth": "standard",
|
|
303
|
+
"task_complexity": "medium",
|
|
304
|
+
"creativity_required": False,
|
|
305
|
+
"speed_priority": True
|
|
306
|
+
},
|
|
307
|
+
model_preferences={
|
|
308
|
+
"preferred_models": [ModelType.SONNET.value],
|
|
309
|
+
"minimum_reasoning_tier": "advanced",
|
|
310
|
+
"context_requirements": "medium"
|
|
311
|
+
},
|
|
312
|
+
priority=55
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
# Apply environment-based model defaults
|
|
316
|
+
self._apply_environment_defaults()
|
|
317
|
+
|
|
318
|
+
logger.info(f"Initialized {len(self._agents)} system agents with model assignments")
|
|
319
|
+
|
|
320
|
+
def _apply_environment_defaults(self) -> None:
|
|
321
|
+
"""Apply environment-based default model assignments."""
|
|
322
|
+
for agent_type, agent_config in self._agents.items():
|
|
323
|
+
default_model = get_default_model_for_agent_type(agent_type)
|
|
324
|
+
if default_model != agent_config.default_model:
|
|
325
|
+
logger.debug(f"Updated {agent_type} default model: {agent_config.default_model} -> {default_model}")
|
|
326
|
+
agent_config.default_model = default_model
|
|
327
|
+
|
|
328
|
+
def get_agent_config(self, agent_type: str) -> Optional[SystemAgentConfig]:
|
|
329
|
+
"""Get configuration for a specific agent type."""
|
|
330
|
+
return self._agents.get(agent_type)
|
|
331
|
+
|
|
332
|
+
def get_all_agents(self) -> Dict[str, SystemAgentConfig]:
|
|
333
|
+
"""Get all agent configurations."""
|
|
334
|
+
return self._agents.copy()
|
|
335
|
+
|
|
336
|
+
def get_agents_by_model(self, model_id: str) -> List[SystemAgentConfig]:
|
|
337
|
+
"""Get all agents configured to use a specific model."""
|
|
338
|
+
return [
|
|
339
|
+
agent for agent in self._agents.values()
|
|
340
|
+
if agent.get_effective_model() == model_id
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
def get_agents_by_specialization(self, specialization: str) -> List[SystemAgentConfig]:
|
|
344
|
+
"""Get agents with a specific specialization."""
|
|
345
|
+
return [
|
|
346
|
+
agent for agent in self._agents.values()
|
|
347
|
+
if specialization in agent.specializations
|
|
348
|
+
]
|
|
349
|
+
|
|
350
|
+
def get_model_distribution(self) -> Dict[str, int]:
|
|
351
|
+
"""Get distribution of models across agents."""
|
|
352
|
+
distribution = {}
|
|
353
|
+
for agent in self._agents.values():
|
|
354
|
+
if agent.enabled:
|
|
355
|
+
model = agent.get_effective_model()
|
|
356
|
+
distribution[model] = distribution.get(model, 0) + 1
|
|
357
|
+
return distribution
|
|
358
|
+
|
|
359
|
+
def validate_agent_model_assignments(self) -> Dict[str, Any]:
|
|
360
|
+
"""
|
|
361
|
+
Validate all agent model assignments.
|
|
362
|
+
|
|
363
|
+
Returns:
|
|
364
|
+
Validation results with issues and recommendations
|
|
365
|
+
"""
|
|
366
|
+
validation = {
|
|
367
|
+
"valid": True,
|
|
368
|
+
"issues": [],
|
|
369
|
+
"warnings": [],
|
|
370
|
+
"recommendations": [],
|
|
371
|
+
"agent_validations": {}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
for agent_type, agent_config in self._agents.items():
|
|
375
|
+
if not agent_config.enabled:
|
|
376
|
+
continue
|
|
377
|
+
|
|
378
|
+
effective_model = agent_config.get_effective_model()
|
|
379
|
+
|
|
380
|
+
# Validate with ModelSelector
|
|
381
|
+
model_validation = self.model_selector.validate_model_selection(
|
|
382
|
+
agent_type, effective_model
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
validation["agent_validations"][agent_type] = model_validation
|
|
386
|
+
|
|
387
|
+
if not model_validation["valid"]:
|
|
388
|
+
validation["valid"] = False
|
|
389
|
+
validation["issues"].append({
|
|
390
|
+
"agent_type": agent_type,
|
|
391
|
+
"model": effective_model,
|
|
392
|
+
"error": model_validation.get("error", "Invalid model assignment")
|
|
393
|
+
})
|
|
394
|
+
|
|
395
|
+
# Check warnings
|
|
396
|
+
if model_validation.get("warnings"):
|
|
397
|
+
validation["warnings"].extend([
|
|
398
|
+
{
|
|
399
|
+
"agent_type": agent_type,
|
|
400
|
+
"model": effective_model,
|
|
401
|
+
"warning": warning
|
|
402
|
+
}
|
|
403
|
+
for warning in model_validation["warnings"]
|
|
404
|
+
])
|
|
405
|
+
|
|
406
|
+
# Check suggestions
|
|
407
|
+
if model_validation.get("suggestions"):
|
|
408
|
+
validation["recommendations"].extend([
|
|
409
|
+
{
|
|
410
|
+
"agent_type": agent_type,
|
|
411
|
+
"model": effective_model,
|
|
412
|
+
"suggestion": suggestion
|
|
413
|
+
}
|
|
414
|
+
for suggestion in model_validation["suggestions"]
|
|
415
|
+
])
|
|
416
|
+
|
|
417
|
+
return validation
|
|
418
|
+
|
|
419
|
+
def get_configuration_summary(self) -> Dict[str, Any]:
|
|
420
|
+
"""
|
|
421
|
+
Get comprehensive configuration summary.
|
|
422
|
+
|
|
423
|
+
Returns:
|
|
424
|
+
Summary of agent configurations and model assignments
|
|
425
|
+
"""
|
|
426
|
+
enabled_agents = [agent for agent in self._agents.values() if agent.enabled]
|
|
427
|
+
|
|
428
|
+
# Model distribution
|
|
429
|
+
model_distribution = self.get_model_distribution()
|
|
430
|
+
|
|
431
|
+
# Environment overrides
|
|
432
|
+
env_overrides = {}
|
|
433
|
+
for agent_type, agent_config in self._agents.items():
|
|
434
|
+
env_model = get_model_for_agent_from_env(agent_type)
|
|
435
|
+
if env_model and env_model != agent_config.default_model:
|
|
436
|
+
env_overrides[agent_type] = {
|
|
437
|
+
"default": agent_config.default_model,
|
|
438
|
+
"override": env_model
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
# Agent priorities
|
|
442
|
+
agents_by_priority = sorted(enabled_agents, key=lambda a: a.priority)
|
|
443
|
+
|
|
444
|
+
# Capability analysis
|
|
445
|
+
all_capabilities = set()
|
|
446
|
+
all_specializations = set()
|
|
447
|
+
for agent in enabled_agents:
|
|
448
|
+
all_capabilities.update(agent.capabilities)
|
|
449
|
+
all_specializations.update(agent.specializations)
|
|
450
|
+
|
|
451
|
+
return {
|
|
452
|
+
"total_agents": len(self._agents),
|
|
453
|
+
"enabled_agents": len(enabled_agents),
|
|
454
|
+
"model_distribution": model_distribution,
|
|
455
|
+
"environment_overrides": env_overrides,
|
|
456
|
+
"agent_priorities": [
|
|
457
|
+
{"type": agent.agent_type, "name": agent.agent_name, "priority": agent.priority}
|
|
458
|
+
for agent in agents_by_priority
|
|
459
|
+
],
|
|
460
|
+
"capabilities_coverage": {
|
|
461
|
+
"total_capabilities": len(all_capabilities),
|
|
462
|
+
"total_specializations": len(all_specializations),
|
|
463
|
+
"unique_capabilities": sorted(list(all_capabilities)),
|
|
464
|
+
"unique_specializations": sorted(list(all_specializations))
|
|
465
|
+
},
|
|
466
|
+
"configuration_health": self.validate_agent_model_assignments()
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
def update_agent_model(self, agent_type: str, model_id: str) -> bool:
|
|
470
|
+
"""
|
|
471
|
+
Update model assignment for an agent.
|
|
472
|
+
|
|
473
|
+
Args:
|
|
474
|
+
agent_type: Type of agent
|
|
475
|
+
model_id: New model ID
|
|
476
|
+
|
|
477
|
+
Returns:
|
|
478
|
+
True if update successful, False otherwise
|
|
479
|
+
"""
|
|
480
|
+
if agent_type not in self._agents:
|
|
481
|
+
logger.error(f"Agent type not found: {agent_type}")
|
|
482
|
+
return False
|
|
483
|
+
|
|
484
|
+
# Validate model
|
|
485
|
+
validation = self.model_selector.validate_model_selection(agent_type, model_id)
|
|
486
|
+
if not validation["valid"]:
|
|
487
|
+
logger.error(f"Invalid model assignment for {agent_type}: {validation.get('error')}")
|
|
488
|
+
return False
|
|
489
|
+
|
|
490
|
+
# Update configuration
|
|
491
|
+
self._agents[agent_type].default_model = model_id
|
|
492
|
+
logger.info(f"Updated {agent_type} model assignment to {model_id}")
|
|
493
|
+
|
|
494
|
+
return True
|
|
495
|
+
|
|
496
|
+
def get_agent_model_recommendation(self, agent_type: str, task_description: str = "") -> Dict[str, Any]:
|
|
497
|
+
"""
|
|
498
|
+
Get model recommendation for an agent and task.
|
|
499
|
+
|
|
500
|
+
Args:
|
|
501
|
+
agent_type: Type of agent
|
|
502
|
+
task_description: Description of the task
|
|
503
|
+
|
|
504
|
+
Returns:
|
|
505
|
+
Model recommendation with analysis
|
|
506
|
+
"""
|
|
507
|
+
agent_config = self.get_agent_config(agent_type)
|
|
508
|
+
if not agent_config:
|
|
509
|
+
return {"error": f"Agent type not found: {agent_type}"}
|
|
510
|
+
|
|
511
|
+
# Use ModelSelector for recommendation
|
|
512
|
+
recommendation = self.model_selector.get_model_recommendation(
|
|
513
|
+
agent_type, task_description, agent_config.performance_requirements
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
# Add agent-specific context
|
|
517
|
+
recommendation["agent_config"] = {
|
|
518
|
+
"current_model": agent_config.get_effective_model(),
|
|
519
|
+
"default_model": agent_config.default_model,
|
|
520
|
+
"capabilities": agent_config.capabilities,
|
|
521
|
+
"specializations": agent_config.specializations,
|
|
522
|
+
"performance_requirements": agent_config.performance_requirements,
|
|
523
|
+
"model_preferences": agent_config.model_preferences
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
return recommendation
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
# Helper functions for easy integration
|
|
530
|
+
def get_system_agent_config() -> SystemAgentConfigManager:
|
|
531
|
+
"""Get system agent configuration manager instance."""
|
|
532
|
+
return SystemAgentConfigManager()
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
def get_agent_model_assignment(agent_type: str) -> Optional[str]:
|
|
536
|
+
"""Get model assignment for a system agent."""
|
|
537
|
+
manager = get_system_agent_config()
|
|
538
|
+
agent_config = manager.get_agent_config(agent_type)
|
|
539
|
+
return agent_config.get_effective_model() if agent_config else None
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
def validate_system_agent_models() -> Dict[str, Any]:
|
|
543
|
+
"""Validate all system agent model assignments."""
|
|
544
|
+
manager = get_system_agent_config()
|
|
545
|
+
return manager.validate_agent_model_assignments()
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
if __name__ == "__main__":
|
|
549
|
+
# Test the system agent configuration
|
|
550
|
+
print("System Agent Configuration Test")
|
|
551
|
+
print("=" * 50)
|
|
552
|
+
|
|
553
|
+
manager = SystemAgentConfigManager()
|
|
554
|
+
|
|
555
|
+
# Show all agents
|
|
556
|
+
agents = manager.get_all_agents()
|
|
557
|
+
print(f"Total System Agents: {len(agents)}")
|
|
558
|
+
|
|
559
|
+
# Show model distribution
|
|
560
|
+
distribution = manager.get_model_distribution()
|
|
561
|
+
print(f"\nModel Distribution:")
|
|
562
|
+
for model_id, count in distribution.items():
|
|
563
|
+
print(f" {model_id}: {count} agents")
|
|
564
|
+
|
|
565
|
+
# Show agents by model
|
|
566
|
+
print(f"\nAgents by Model:")
|
|
567
|
+
for model_id in distribution.keys():
|
|
568
|
+
agents_with_model = manager.get_agents_by_model(model_id)
|
|
569
|
+
print(f" {model_id}:")
|
|
570
|
+
for agent in agents_with_model:
|
|
571
|
+
print(f" - {agent.agent_name} ({agent.agent_type})")
|
|
572
|
+
|
|
573
|
+
# Validation
|
|
574
|
+
validation = manager.validate_agent_model_assignments()
|
|
575
|
+
print(f"\nValidation Results:")
|
|
576
|
+
print(f" Valid: {validation['valid']}")
|
|
577
|
+
print(f" Issues: {len(validation['issues'])}")
|
|
578
|
+
print(f" Warnings: {len(validation['warnings'])}")
|
|
579
|
+
print(f" Recommendations: {len(validation['recommendations'])}")
|
|
580
|
+
|
|
581
|
+
# Configuration summary
|
|
582
|
+
summary = manager.get_configuration_summary()
|
|
583
|
+
print(f"\nConfiguration Summary:")
|
|
584
|
+
print(f" Enabled Agents: {summary['enabled_agents']}")
|
|
585
|
+
print(f" Environment Overrides: {len(summary['environment_overrides'])}")
|
|
586
|
+
print(f" Total Capabilities: {summary['capabilities_coverage']['total_capabilities']}")
|
|
587
|
+
print(f" Total Specializations: {summary['capabilities_coverage']['total_specializations']}")
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent Delegation Templates Module
|
|
3
|
+
================================
|
|
4
|
+
|
|
5
|
+
Provides access to standardized delegation templates for all core agents.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Dict, Optional
|
|
11
|
+
|
|
12
|
+
# Template directory path
|
|
13
|
+
TEMPLATE_DIR = Path(__file__).parent
|
|
14
|
+
|
|
15
|
+
# Core agent template mappings
|
|
16
|
+
AGENT_TEMPLATES = {
|
|
17
|
+
"documentation": "documentation_agent.md",
|
|
18
|
+
"engineer": "engineer_agent.md",
|
|
19
|
+
"qa": "qa_agent.md",
|
|
20
|
+
"version_control": "version_control_agent.md",
|
|
21
|
+
"research": "research_agent.md",
|
|
22
|
+
"ops": "ops_agent.md",
|
|
23
|
+
"security": "security_agent.md",
|
|
24
|
+
"data_engineer": "data_engineer_agent.md"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Agent nicknames for reference
|
|
28
|
+
AGENT_NICKNAMES = {
|
|
29
|
+
"documentation": "Documenter",
|
|
30
|
+
"engineer": "Engineer",
|
|
31
|
+
"qa": "QA",
|
|
32
|
+
"version_control": "Versioner",
|
|
33
|
+
"research": "Researcher",
|
|
34
|
+
"ops": "Ops",
|
|
35
|
+
"security": "Security",
|
|
36
|
+
"data_engineer": "Data Engineer"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_template_path(agent_type: str) -> Optional[Path]:
|
|
41
|
+
"""
|
|
42
|
+
Get the path to a specific agent's delegation template.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
agent_type: The type of agent (e.g., 'documentation', 'engineer')
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Path to the template file or None if not found
|
|
49
|
+
"""
|
|
50
|
+
template_file = AGENT_TEMPLATES.get(agent_type)
|
|
51
|
+
if template_file:
|
|
52
|
+
template_path = TEMPLATE_DIR / template_file
|
|
53
|
+
if template_path.exists():
|
|
54
|
+
return template_path
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def load_template(agent_type: str) -> Optional[str]:
|
|
59
|
+
"""
|
|
60
|
+
Load the delegation template content for a specific agent.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
agent_type: The type of agent (e.g., 'documentation', 'engineer')
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Template content as string or None if not found
|
|
67
|
+
"""
|
|
68
|
+
template_path = get_template_path(agent_type)
|
|
69
|
+
if template_path:
|
|
70
|
+
try:
|
|
71
|
+
return template_path.read_text()
|
|
72
|
+
except Exception as e:
|
|
73
|
+
print(f"Error loading template for {agent_type}: {e}")
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def get_available_templates() -> Dict[str, str]:
|
|
78
|
+
"""
|
|
79
|
+
Get a dictionary of all available agent templates.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Dictionary mapping agent types to their template filenames
|
|
83
|
+
"""
|
|
84
|
+
available = {}
|
|
85
|
+
for agent_type, filename in AGENT_TEMPLATES.items():
|
|
86
|
+
if (TEMPLATE_DIR / filename).exists():
|
|
87
|
+
available[agent_type] = filename
|
|
88
|
+
return available
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def get_agent_nickname(agent_type: str) -> Optional[str]:
|
|
92
|
+
"""
|
|
93
|
+
Get the nickname for a specific agent type.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
agent_type: The type of agent
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Agent nickname or None if not found
|
|
100
|
+
"""
|
|
101
|
+
return AGENT_NICKNAMES.get(agent_type)
|