aiecs 1.0.5__tar.gz → 1.0.6__tar.gz

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 aiecs might be problematic. Click here for more details.

Files changed (105) hide show
  1. {aiecs-1.0.5/aiecs.egg-info → aiecs-1.0.6}/PKG-INFO +2 -2
  2. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/__init__.py +1 -1
  3. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/config/config.py +1 -0
  4. aiecs-1.0.6/aiecs/domain/community/collaborative_workflow.py +407 -0
  5. aiecs-1.0.6/aiecs/domain/community/community_integration.py +439 -0
  6. aiecs-1.0.6/aiecs/domain/community/community_manager.py +337 -0
  7. aiecs-1.0.6/aiecs/domain/community/decision_engine.py +354 -0
  8. aiecs-1.0.6/aiecs/domain/community/models/community_models.py +204 -0
  9. aiecs-1.0.6/aiecs/domain/community/resource_manager.py +438 -0
  10. aiecs-1.0.6/aiecs/infrastructure/persistence/__init__.py +24 -0
  11. aiecs-1.0.6/aiecs/infrastructure/persistence/context_engine_client.py +176 -0
  12. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/base_client.py +1 -0
  13. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/client_factory.py +4 -0
  14. aiecs-1.0.6/aiecs/llm/googleai_client.py +165 -0
  15. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/vertex_client.py +71 -33
  16. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/main.py +1 -1
  17. {aiecs-1.0.5 → aiecs-1.0.6/aiecs.egg-info}/PKG-INFO +2 -2
  18. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs.egg-info/SOURCES.txt +8 -0
  19. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs.egg-info/requires.txt +1 -1
  20. {aiecs-1.0.5 → aiecs-1.0.6}/pyproject.toml +213 -213
  21. aiecs-1.0.5/aiecs/infrastructure/persistence/__init__.py +0 -12
  22. {aiecs-1.0.5 → aiecs-1.0.6}/LICENSE +0 -0
  23. {aiecs-1.0.5 → aiecs-1.0.6}/MANIFEST.in +0 -0
  24. {aiecs-1.0.5 → aiecs-1.0.6}/README.md +0 -0
  25. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/__main__.py +0 -0
  26. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/aiecs_client.py +0 -0
  27. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/application/__init__.py +0 -0
  28. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/application/executors/__init__.py +0 -0
  29. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/application/executors/operation_executor.py +0 -0
  30. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/config/__init__.py +0 -0
  31. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/config/registry.py +0 -0
  32. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/core/__init__.py +0 -0
  33. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/core/interface/__init__.py +0 -0
  34. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/core/interface/execution_interface.py +0 -0
  35. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/core/interface/storage_interface.py +0 -0
  36. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/__init__.py +0 -0
  37. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/context/__init__.py +0 -0
  38. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/context/context_engine.py +0 -0
  39. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/context/conversation_models.py +0 -0
  40. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/execution/__init__.py +0 -0
  41. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/execution/model.py +0 -0
  42. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/task/__init__.py +0 -0
  43. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/task/dsl_processor.py +0 -0
  44. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/task/model.py +0 -0
  45. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/domain/task/task_context.py +0 -0
  46. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/__init__.py +0 -0
  47. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/messaging/__init__.py +0 -0
  48. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/messaging/celery_task_manager.py +0 -0
  49. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/messaging/websocket_manager.py +0 -0
  50. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/monitoring/__init__.py +0 -0
  51. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/monitoring/executor_metrics.py +0 -0
  52. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/monitoring/structured_logger.py +0 -0
  53. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/monitoring/tracing_manager.py +0 -0
  54. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/persistence/database_manager.py +0 -0
  55. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/persistence/file_storage.py +0 -0
  56. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/infrastructure/persistence/redis_client.py +0 -0
  57. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/__init__.py +0 -0
  58. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/custom_callbacks.py +0 -0
  59. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/openai_client.py +0 -0
  60. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/llm/xai_client.py +0 -0
  61. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/DEPENDENCY_SYSTEM_SUMMARY.md +0 -0
  62. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/README_DEPENDENCY_CHECKER.md +0 -0
  63. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/README_WEASEL_PATCH.md +0 -0
  64. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/__init__.py +0 -0
  65. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/dependency_checker.py +0 -0
  66. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/dependency_fixer.py +0 -0
  67. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/download_nlp_data.py +0 -0
  68. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/fix_weasel_validator.py +0 -0
  69. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/fix_weasel_validator.sh +0 -0
  70. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/patch_weasel_library.sh +0 -0
  71. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/quick_dependency_check.py +0 -0
  72. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/run_weasel_patch.sh +0 -0
  73. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/scripts/setup_nlp_data.sh +0 -0
  74. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tasks/__init__.py +0 -0
  75. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tasks/worker.py +0 -0
  76. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/__init__.py +0 -0
  77. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/base_tool.py +0 -0
  78. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/langchain_adapter.py +0 -0
  79. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/__init__.py +0 -0
  80. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/chart_tool.py +0 -0
  81. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/classfire_tool.py +0 -0
  82. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/image_tool.py +0 -0
  83. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/office_tool.py +0 -0
  84. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/pandas_tool.py +0 -0
  85. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/report_tool.py +0 -0
  86. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/research_tool.py +0 -0
  87. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/scraper_tool.py +0 -0
  88. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/search_api.py +0 -0
  89. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/task_tools/stats_tool.py +0 -0
  90. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/temp_file_manager.py +0 -0
  91. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/tool_executor/__init__.py +0 -0
  92. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/tools/tool_executor/tool_executor.py +0 -0
  93. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/LLM_output_structor.py +0 -0
  94. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/__init__.py +0 -0
  95. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/base_callback.py +0 -0
  96. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/execution_utils.py +0 -0
  97. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/logging.py +0 -0
  98. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/prompt_loader.py +0 -0
  99. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/utils/token_usage_repository.py +0 -0
  100. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/ws/__init__.py +0 -0
  101. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs/ws/socket_server.py +0 -0
  102. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs.egg-info/dependency_links.txt +0 -0
  103. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs.egg-info/entry_points.txt +0 -0
  104. {aiecs-1.0.5 → aiecs-1.0.6}/aiecs.egg-info/top_level.txt +0 -0
  105. {aiecs-1.0.5 → aiecs-1.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiecs
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: AI Execute Services - A middleware framework for AI-powered task execution and tool orchestration
5
5
  Author-email: AIECS Team <iretbl@gmail.com>
6
6
  License-Expression: MIT
@@ -37,7 +37,7 @@ Requires-Dist: python-engineio<5.0.0,>=4.12.1
37
37
  Requires-Dist: tenacity<10.0.0,>=9.1.2
38
38
  Requires-Dist: flower<3.0.0,>=2.0.1
39
39
  Requires-Dist: openai<1.76.0,>=1.68.2
40
- Requires-Dist: google-cloud-aiplatform<2.0.0,>=1.71.1
40
+ Requires-Dist: google-cloud-aiplatform<2.0.0,>=1.80.0
41
41
  Requires-Dist: langchain<0.4.0,>=0.3.26
42
42
  Requires-Dist: langgraph<0.6.0,>=0.5.3
43
43
  Requires-Dist: weasel==0.4.1
@@ -5,7 +5,7 @@ A powerful Python middleware framework for building AI-powered applications
5
5
  with tool orchestration, task execution, and multi-provider LLM support.
6
6
  """
7
7
 
8
- __version__ = "1.0.5"
8
+ __version__ = "1.0.6"
9
9
  __author__ = "AIECS Team"
10
10
  __email__ = "iretbl@gmail.com"
11
11
 
@@ -5,6 +5,7 @@ from functools import lru_cache
5
5
  class Settings(BaseSettings):
6
6
  # LLM Provider Configuration (optional until used)
7
7
  openai_api_key: str = Field(default="", alias="OPENAI_API_KEY")
8
+ googleai_api_key: str = Field(default="", alias="GOOGLEAI_API_KEY")
8
9
  vertex_project_id: str = Field(default="", alias="VERTEX_PROJECT_ID")
9
10
  vertex_location: str = Field(default="us-central1", alias="VERTEX_LOCATION")
10
11
  google_application_credentials: str = Field(default="", alias="GOOGLE_APPLICATION_CREDENTIALS")
@@ -0,0 +1,407 @@
1
+ """
2
+ Collaborative Workflow Engine
3
+
4
+ Orchestrates collaborative workflows within agent communities,
5
+ including brainstorming, problem-solving, and knowledge synthesis.
6
+ """
7
+
8
+ import logging
9
+ from datetime import datetime, timedelta
10
+ from typing import Dict, List, Any, Optional
11
+ import uuid
12
+ import asyncio
13
+
14
+ from .models.community_models import CollaborationSession
15
+ from ..core.exceptions.task_exceptions import TaskValidationError
16
+
17
+ logger = logging.getLogger(__name__)
18
+
19
+
20
+ class CollaborativeWorkflowEngine:
21
+ """
22
+ Engine for orchestrating collaborative workflows within agent communities.
23
+ """
24
+
25
+ def __init__(self, community_manager=None, resource_manager=None, decision_engine=None):
26
+ """
27
+ Initialize the collaborative workflow engine.
28
+
29
+ Args:
30
+ community_manager: Reference to the community manager
31
+ resource_manager: Reference to the resource manager
32
+ decision_engine: Reference to the decision engine
33
+ """
34
+ self.community_manager = community_manager
35
+ self.resource_manager = resource_manager
36
+ self.decision_engine = decision_engine
37
+
38
+ # Active collaborative sessions
39
+ self.active_sessions: Dict[str, CollaborationSession] = {}
40
+
41
+ # Workflow templates
42
+ self.workflow_templates = {
43
+ "brainstorming": self._brainstorming_workflow,
44
+ "problem_solving": self._problem_solving_workflow,
45
+ "knowledge_synthesis": self._knowledge_synthesis_workflow,
46
+ "decision_making": self._decision_making_workflow,
47
+ "resource_creation": self._resource_creation_workflow,
48
+ "peer_review": self._peer_review_workflow,
49
+ "consensus_building": self._consensus_building_workflow
50
+ }
51
+
52
+ logger.info("Collaborative workflow engine initialized")
53
+
54
+ async def start_collaborative_session(
55
+ self,
56
+ community_id: str,
57
+ session_leader_id: str,
58
+ session_type: str,
59
+ purpose: str,
60
+ participants: List[str],
61
+ agenda: Optional[List[str]] = None,
62
+ duration_minutes: int = 60,
63
+ session_config: Optional[Dict[str, Any]] = None
64
+ ) -> str:
65
+ """
66
+ Start a collaborative session.
67
+
68
+ Args:
69
+ community_id: ID of the community
70
+ session_leader_id: ID of the session leader
71
+ session_type: Type of collaborative session
72
+ purpose: Purpose of the session
73
+ participants: List of participant member IDs
74
+ agenda: Optional agenda items
75
+ duration_minutes: Expected duration in minutes
76
+ session_config: Optional session configuration
77
+
78
+ Returns:
79
+ Session ID
80
+ """
81
+ if not self.community_manager:
82
+ raise TaskValidationError("Community manager not available")
83
+
84
+ # Validate community and participants
85
+ community = self.community_manager.communities.get(community_id)
86
+ if not community:
87
+ raise TaskValidationError(f"Community not found: {community_id}")
88
+
89
+ # Create collaboration session
90
+ session = CollaborationSession(
91
+ community_id=community_id,
92
+ participants=participants,
93
+ session_leader=session_leader_id,
94
+ purpose=purpose,
95
+ session_type=session_type,
96
+ agenda=agenda or [],
97
+ metadata=session_config or {}
98
+ )
99
+
100
+ self.active_sessions[session.session_id] = session
101
+
102
+ # Execute workflow template if available
103
+ if session_type in self.workflow_templates:
104
+ workflow_func = self.workflow_templates[session_type]
105
+ await workflow_func(session)
106
+
107
+ logger.info(f"Started collaborative session: {session_type} ({session.session_id})")
108
+ return session.session_id
109
+
110
+ async def _brainstorming_workflow(self, session: CollaborationSession) -> None:
111
+ """
112
+ Execute brainstorming workflow.
113
+
114
+ Phases:
115
+ 1. Idea generation
116
+ 2. Idea collection and categorization
117
+ 3. Idea evaluation and ranking
118
+ 4. Action item creation
119
+ """
120
+ logger.info(f"Starting brainstorming workflow for session {session.session_id}")
121
+
122
+ # Phase 1: Idea Generation
123
+ await self._execute_phase(session, "idea_generation", {
124
+ "instructions": "Generate creative ideas related to the session purpose",
125
+ "time_limit_minutes": 15,
126
+ "parallel_thinking": True
127
+ })
128
+
129
+ # Phase 2: Idea Collection
130
+ await self._execute_phase(session, "idea_collection", {
131
+ "instructions": "Collect and categorize all generated ideas",
132
+ "time_limit_minutes": 10,
133
+ "collaborative": True
134
+ })
135
+
136
+ # Phase 3: Idea Evaluation
137
+ await self._execute_phase(session, "idea_evaluation", {
138
+ "instructions": "Evaluate and rank ideas based on feasibility and impact",
139
+ "time_limit_minutes": 15,
140
+ "voting_enabled": True
141
+ })
142
+
143
+ # Phase 4: Action Planning
144
+ await self._execute_phase(session, "action_planning", {
145
+ "instructions": "Create action items for top-ranked ideas",
146
+ "time_limit_minutes": 10,
147
+ "assign_responsibilities": True
148
+ })
149
+
150
+ async def _problem_solving_workflow(self, session: CollaborationSession) -> None:
151
+ """
152
+ Execute problem-solving workflow.
153
+
154
+ Phases:
155
+ 1. Problem definition and analysis
156
+ 2. Root cause analysis
157
+ 3. Solution brainstorming
158
+ 4. Solution evaluation and selection
159
+ 5. Implementation planning
160
+ """
161
+ logger.info(f"Starting problem-solving workflow for session {session.session_id}")
162
+
163
+ # Phase 1: Problem Definition
164
+ await self._execute_phase(session, "problem_definition", {
165
+ "instructions": "Define the problem clearly and analyze its scope",
166
+ "time_limit_minutes": 15,
167
+ "structured_analysis": True
168
+ })
169
+
170
+ # Phase 2: Root Cause Analysis
171
+ await self._execute_phase(session, "root_cause_analysis", {
172
+ "instructions": "Identify root causes using systematic analysis",
173
+ "time_limit_minutes": 20,
174
+ "analysis_methods": ["5_whys", "fishbone", "pareto"]
175
+ })
176
+
177
+ # Phase 3: Solution Brainstorming
178
+ await self._execute_phase(session, "solution_brainstorming", {
179
+ "instructions": "Generate potential solutions for identified root causes",
180
+ "time_limit_minutes": 20,
181
+ "creative_thinking": True
182
+ })
183
+
184
+ # Phase 4: Solution Evaluation
185
+ await self._execute_phase(session, "solution_evaluation", {
186
+ "instructions": "Evaluate solutions based on criteria matrix",
187
+ "time_limit_minutes": 15,
188
+ "evaluation_criteria": ["feasibility", "impact", "cost", "timeline"]
189
+ })
190
+
191
+ # Phase 5: Implementation Planning
192
+ await self._execute_phase(session, "implementation_planning", {
193
+ "instructions": "Create detailed implementation plan for selected solution",
194
+ "time_limit_minutes": 15,
195
+ "create_timeline": True
196
+ })
197
+
198
+ async def _knowledge_synthesis_workflow(self, session: CollaborationSession) -> None:
199
+ """
200
+ Execute knowledge synthesis workflow.
201
+
202
+ Phases:
203
+ 1. Knowledge gathering
204
+ 2. Information analysis
205
+ 3. Pattern identification
206
+ 4. Synthesis and integration
207
+ 5. Knowledge artifact creation
208
+ """
209
+ logger.info(f"Starting knowledge synthesis workflow for session {session.session_id}")
210
+
211
+ # Phase 1: Knowledge Gathering
212
+ await self._execute_phase(session, "knowledge_gathering", {
213
+ "instructions": "Gather relevant knowledge from community resources and expertise",
214
+ "time_limit_minutes": 20,
215
+ "resource_search": True
216
+ })
217
+
218
+ # Phase 2: Information Analysis
219
+ await self._execute_phase(session, "information_analysis", {
220
+ "instructions": "Analyze gathered information for relevance and quality",
221
+ "time_limit_minutes": 15,
222
+ "quality_assessment": True
223
+ })
224
+
225
+ # Phase 3: Pattern Identification
226
+ await self._execute_phase(session, "pattern_identification", {
227
+ "instructions": "Identify patterns, themes, and connections in the information",
228
+ "time_limit_minutes": 20,
229
+ "pattern_analysis": True
230
+ })
231
+
232
+ # Phase 4: Synthesis
233
+ await self._execute_phase(session, "synthesis", {
234
+ "instructions": "Synthesize information into coherent knowledge structure",
235
+ "time_limit_minutes": 25,
236
+ "collaborative_editing": True
237
+ })
238
+
239
+ # Phase 5: Artifact Creation
240
+ await self._execute_phase(session, "artifact_creation", {
241
+ "instructions": "Create knowledge artifacts for community sharing",
242
+ "time_limit_minutes": 15,
243
+ "create_resources": True
244
+ })
245
+
246
+ async def _decision_making_workflow(self, session: CollaborationSession) -> None:
247
+ """
248
+ Execute decision-making workflow.
249
+
250
+ Phases:
251
+ 1. Decision framing
252
+ 2. Option generation
253
+ 3. Criteria definition
254
+ 4. Option evaluation
255
+ 5. Decision and commitment
256
+ """
257
+ logger.info(f"Starting decision-making workflow for session {session.session_id}")
258
+
259
+ # Phase 1: Decision Framing
260
+ await self._execute_phase(session, "decision_framing", {
261
+ "instructions": "Frame the decision clearly with context and constraints",
262
+ "time_limit_minutes": 15,
263
+ "structured_framing": True
264
+ })
265
+
266
+ # Phase 2: Option Generation
267
+ await self._execute_phase(session, "option_generation", {
268
+ "instructions": "Generate multiple decision options",
269
+ "time_limit_minutes": 20,
270
+ "creative_options": True
271
+ })
272
+
273
+ # Phase 3: Criteria Definition
274
+ await self._execute_phase(session, "criteria_definition", {
275
+ "instructions": "Define evaluation criteria and their weights",
276
+ "time_limit_minutes": 10,
277
+ "criteria_weighting": True
278
+ })
279
+
280
+ # Phase 4: Option Evaluation
281
+ await self._execute_phase(session, "option_evaluation", {
282
+ "instructions": "Evaluate options against defined criteria",
283
+ "time_limit_minutes": 20,
284
+ "systematic_evaluation": True
285
+ })
286
+
287
+ # Phase 5: Decision Making
288
+ await self._execute_phase(session, "decision_making", {
289
+ "instructions": "Make final decision and create commitment plan",
290
+ "time_limit_minutes": 15,
291
+ "consensus_building": True,
292
+ "create_decision": True
293
+ })
294
+
295
+ async def _resource_creation_workflow(self, session: CollaborationSession) -> None:
296
+ """Execute resource creation workflow."""
297
+ logger.info(f"Starting resource creation workflow for session {session.session_id}")
298
+
299
+ # Phase 1: Resource Planning
300
+ await self._execute_phase(session, "resource_planning", {
301
+ "instructions": "Plan the resource to be created",
302
+ "time_limit_minutes": 15
303
+ })
304
+
305
+ # Phase 2: Collaborative Creation
306
+ await self._execute_phase(session, "collaborative_creation", {
307
+ "instructions": "Collaboratively create the resource",
308
+ "time_limit_minutes": 30,
309
+ "collaborative_editing": True
310
+ })
311
+
312
+ # Phase 3: Review and Refinement
313
+ await self._execute_phase(session, "review_refinement", {
314
+ "instructions": "Review and refine the created resource",
315
+ "time_limit_minutes": 15,
316
+ "peer_review": True
317
+ })
318
+
319
+ async def _peer_review_workflow(self, session: CollaborationSession) -> None:
320
+ """Execute peer review workflow."""
321
+ logger.info(f"Starting peer review workflow for session {session.session_id}")
322
+
323
+ # Implementation for peer review workflow
324
+ pass
325
+
326
+ async def _consensus_building_workflow(self, session: CollaborationSession) -> None:
327
+ """Execute consensus building workflow."""
328
+ logger.info(f"Starting consensus building workflow for session {session.session_id}")
329
+
330
+ # Implementation for consensus building workflow
331
+ pass
332
+
333
+ async def _execute_phase(
334
+ self,
335
+ session: CollaborationSession,
336
+ phase_name: str,
337
+ phase_config: Dict[str, Any]
338
+ ) -> None:
339
+ """
340
+ Execute a workflow phase.
341
+
342
+ Args:
343
+ session: Collaboration session
344
+ phase_name: Name of the phase
345
+ phase_config: Phase configuration
346
+ """
347
+ logger.info(f"Executing phase '{phase_name}' for session {session.session_id}")
348
+
349
+ # Record phase execution
350
+ phase_result = {
351
+ "phase_name": phase_name,
352
+ "started_at": datetime.utcnow().isoformat(),
353
+ "config": phase_config,
354
+ "participants": session.participants,
355
+ "outputs": []
356
+ }
357
+
358
+ # Simulate phase execution (in real implementation, this would coordinate agent activities)
359
+ time_limit = phase_config.get("time_limit_minutes", 10)
360
+ await asyncio.sleep(1) # Simulate processing time
361
+
362
+ phase_result["completed_at"] = datetime.utcnow().isoformat()
363
+ phase_result["status"] = "completed"
364
+
365
+ # Store phase result in session metadata
366
+ if "phases" not in session.metadata:
367
+ session.metadata["phases"] = []
368
+ session.metadata["phases"].append(phase_result)
369
+
370
+ logger.info(f"Completed phase '{phase_name}' for session {session.session_id}")
371
+
372
+ async def end_session(self, session_id: str) -> Dict[str, Any]:
373
+ """
374
+ End a collaborative session and generate summary.
375
+
376
+ Args:
377
+ session_id: ID of the session to end
378
+
379
+ Returns:
380
+ Session summary
381
+ """
382
+ if session_id not in self.active_sessions:
383
+ raise TaskValidationError(f"Session not found: {session_id}")
384
+
385
+ session = self.active_sessions[session_id]
386
+ session.status = "completed"
387
+ session.ended_at = datetime.utcnow()
388
+
389
+ # Generate session summary
390
+ summary = {
391
+ "session_id": session_id,
392
+ "session_type": session.session_type,
393
+ "purpose": session.purpose,
394
+ "participants": session.participants,
395
+ "duration_minutes": (session.ended_at - session.started_at).total_seconds() / 60,
396
+ "outcomes": session.action_items,
397
+ "resources_created": session.resources_created,
398
+ "decisions_made": session.decisions_made,
399
+ "phases_completed": len(session.metadata.get("phases", [])),
400
+ "status": session.status
401
+ }
402
+
403
+ # Remove from active sessions
404
+ del self.active_sessions[session_id]
405
+
406
+ logger.info(f"Ended collaborative session {session_id}")
407
+ return summary