cc-codeconductor 0.4.3 → 1.0.0

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.
Files changed (262) hide show
  1. package/README.md +95 -95
  2. package/dist/cli/errors.d.ts +65 -0
  3. package/dist/core/compilation/compile-checker.d.ts +51 -0
  4. package/dist/core/config/codeconductor-config.d.ts +42 -0
  5. package/dist/core/config/config-loader.d.ts +11 -0
  6. package/dist/core/filesystem/credential-guard.d.ts +18 -0
  7. package/dist/core/goal/goal-planner.d.ts +8 -0
  8. package/dist/core/goal/goal-state.d.ts +15 -0
  9. package/dist/core/loop/git-stats.d.ts +13 -0
  10. package/dist/core/loop/loop-engine.d.ts +79 -0
  11. package/dist/core/memory/episodic-store.d.ts +6 -0
  12. package/dist/core/memory/operational-state.d.ts +6 -0
  13. package/dist/core/orchestrator/runtime-orchestrator.d.ts +25 -0
  14. package/dist/core/planner/product-planner.d.ts +18 -0
  15. package/dist/core/presets/package-paths.d.ts +4 -0
  16. package/dist/core/product-graph/graph-store.d.ts +11 -0
  17. package/dist/core/product-graph/paths.d.ts +18 -0
  18. package/dist/core/verification/verification-runner.d.ts +57 -0
  19. package/dist/domain/loop/loop-state.d.ts +74 -0
  20. package/dist/domain/product/entities.d.ts +11 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.js +23721 -15064
  23. package/dist/library.js +2595 -0
  24. package/dist/utils/result.d.ts +36 -0
  25. package/dist/validation/schemas.d.ts +3660 -0
  26. package/package.json +15 -2
  27. package/policy.yml +12 -11
  28. package/presets/agy/AGENTS.md +11 -5
  29. package/presets/agy/gates/pre-commit/GATE.md +136 -0
  30. package/presets/agy/skills/cc-fix/SKILL.md +2 -2
  31. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +11 -0
  32. package/presets/agy/skills/evaluation/SKILL.md +6 -0
  33. package/presets/agy/skills/openspec/SKILL.md +32 -0
  34. package/presets/agy/workflows/cc-api-contract.md +12 -0
  35. package/presets/agy/workflows/cc-ask.md +55 -0
  36. package/presets/agy/workflows/cc-clarify.md +33 -0
  37. package/presets/agy/workflows/cc-council.md +31 -7
  38. package/presets/agy/workflows/cc-db-migration.md +22 -9
  39. package/presets/agy/workflows/cc-explore.md +37 -0
  40. package/presets/agy/workflows/cc-feature.md +41 -19
  41. package/presets/agy/workflows/cc-fix.md +50 -23
  42. package/presets/agy/workflows/cc-handoff.md +42 -0
  43. package/presets/agy/workflows/cc-iterative.md +128 -0
  44. package/presets/agy/workflows/cc-openspec.md +75 -0
  45. package/presets/agy/workflows/cc-pagespeed.md +12 -0
  46. package/presets/agy/workflows/cc-prototype.md +39 -0
  47. package/presets/agy/workflows/cc-refactor.md +12 -0
  48. package/presets/agy/workflows/cc-review.md +12 -0
  49. package/presets/agy/workflows/cc-scorecard.md +29 -0
  50. package/presets/agy/workflows/cc-tdd-cycle.md +24 -0
  51. package/presets/agy/workflows/cc-test-plan.md +12 -0
  52. package/presets/agy/workflows/cc-triage.md +35 -0
  53. package/presets/claude/CLAUDE.md +64 -0
  54. package/presets/claude/commands/cc/api-contract.md +12 -0
  55. package/presets/claude/commands/cc/ask.md +55 -0
  56. package/presets/claude/commands/cc/clarify.md +32 -0
  57. package/presets/claude/commands/cc/council.md +87 -0
  58. package/presets/claude/commands/cc/db-migration.md +22 -9
  59. package/presets/claude/commands/cc/explore.md +36 -0
  60. package/presets/claude/commands/cc/feature.md +49 -22
  61. package/presets/claude/commands/cc/fix.md +74 -20
  62. package/presets/claude/commands/cc/handoff.md +44 -0
  63. package/presets/claude/commands/cc/iterative.md +132 -0
  64. package/presets/claude/commands/cc/openspec.md +169 -0
  65. package/presets/claude/commands/cc/pagespeed.md +12 -0
  66. package/presets/claude/commands/cc/prototype.md +38 -0
  67. package/presets/claude/commands/cc/refactor.md +152 -1
  68. package/presets/claude/commands/cc/review.md +90 -17
  69. package/presets/claude/commands/cc/scorecard.md +77 -0
  70. package/presets/claude/commands/cc/tdd-cycle.md +53 -3
  71. package/presets/claude/commands/cc/test-plan.md +12 -0
  72. package/presets/claude/commands/cc/triage.md +34 -0
  73. package/presets/claude/gates/pre-commit/GATE.md +136 -0
  74. package/presets/claude/settings.json +8 -46
  75. package/presets/claude/skills/evaluation/SKILL.md +42 -0
  76. package/presets/claude/skills/openspec/SKILL.md +54 -0
  77. package/presets/codex/AGENTS.md +62 -5
  78. package/presets/codex/commands/cc-ask.md +55 -0
  79. package/presets/codex/gates/pre-commit/GATE.md +136 -0
  80. package/presets/cursor/.cursorignore +15 -0
  81. package/presets/cursor/AGENTS.md +504 -0
  82. package/presets/cursor/agents/architect.md +211 -0
  83. package/presets/cursor/agents/business-agent.md +44 -0
  84. package/presets/cursor/agents/complexity-auditor.md +76 -0
  85. package/presets/cursor/agents/continuous-architect.md +37 -0
  86. package/presets/cursor/agents/contract-builder.md +75 -0
  87. package/presets/cursor/agents/docs.md +181 -0
  88. package/presets/cursor/agents/goal-planner.md +71 -0
  89. package/presets/cursor/agents/impact-analyst.md +43 -0
  90. package/presets/cursor/agents/implementer.md +161 -0
  91. package/presets/cursor/agents/orchestrator.md +377 -0
  92. package/presets/cursor/agents/repo-explorer.md +100 -0
  93. package/presets/cursor/agents/reviewer.md +237 -0
  94. package/presets/cursor/agents/security-reviewer.md +113 -0
  95. package/presets/cursor/agents/task-coach.md +145 -0
  96. package/presets/cursor/agents/tester.md +241 -0
  97. package/presets/cursor/commands/cc/api-contract.md +70 -0
  98. package/presets/cursor/commands/cc/ask.md +55 -0
  99. package/presets/cursor/commands/cc/clarify.md +32 -0
  100. package/presets/cursor/commands/cc/council.md +87 -0
  101. package/presets/cursor/commands/cc/db-migration.md +71 -0
  102. package/presets/cursor/commands/cc/explore.md +36 -0
  103. package/presets/cursor/commands/cc/feature.md +137 -0
  104. package/presets/cursor/commands/cc/fix.md +148 -0
  105. package/presets/cursor/commands/cc/handoff.md +41 -0
  106. package/presets/cursor/commands/cc/iterative.md +133 -0
  107. package/presets/cursor/commands/cc/openspec.md +159 -0
  108. package/presets/cursor/commands/cc/pagespeed.md +115 -0
  109. package/presets/cursor/commands/cc/prototype.md +38 -0
  110. package/presets/cursor/commands/cc/refactor.md +160 -0
  111. package/presets/cursor/commands/cc/review.md +149 -0
  112. package/presets/cursor/commands/cc/scorecard.md +77 -0
  113. package/presets/cursor/commands/cc/tdd-cycle.md +250 -0
  114. package/presets/cursor/commands/cc/test-plan.md +150 -0
  115. package/presets/cursor/commands/cc/triage.md +34 -0
  116. package/presets/cursor/gates/pre-commit/GATE.md +136 -0
  117. package/presets/cursor/rules/behavioral-discipline.mdc +14 -0
  118. package/presets/cursor/rules/context-budget.mdc +12 -0
  119. package/presets/cursor/rules/orchestration.mdc +12 -0
  120. package/presets/cursor/rules/yagni-stdlib.mdc +11 -0
  121. package/presets/cursor/skills/android/SKILL.md +122 -0
  122. package/presets/cursor/skills/api-versioning/SKILL.md +394 -0
  123. package/presets/cursor/skills/astro/SKILL.md +322 -0
  124. package/presets/cursor/skills/auth-token-inspector/SKILL.md +33 -0
  125. package/presets/cursor/skills/code-review/SKILL.md +208 -0
  126. package/presets/cursor/skills/conductor-setup/SKILL.md +127 -0
  127. package/presets/cursor/skills/django-orm/SKILL.md +463 -0
  128. package/presets/cursor/skills/django-testing/SKILL.md +417 -0
  129. package/presets/cursor/skills/django-uv/SKILL.md +409 -0
  130. package/presets/cursor/skills/drizzle-schema-architect/SKILL.md +54 -0
  131. package/presets/cursor/skills/evaluation/SKILL.md +8 -0
  132. package/presets/cursor/skills/fastapi-pydantic-strict/SKILL.md +46 -0
  133. package/presets/cursor/skills/find-skills/SKILL.md +144 -0
  134. package/presets/cursor/skills/jpa-nplusone-detector/SKILL.md +49 -0
  135. package/presets/cursor/skills/jpa-postgres/SKILL.md +626 -0
  136. package/presets/cursor/skills/laravel-specialist/SKILL.md +267 -0
  137. package/presets/cursor/skills/laravel-specialist/references/eloquent.md +351 -0
  138. package/presets/cursor/skills/laravel-specialist/references/livewire.md +512 -0
  139. package/presets/cursor/skills/laravel-specialist/references/queues.md +423 -0
  140. package/presets/cursor/skills/laravel-specialist/references/routing.md +362 -0
  141. package/presets/cursor/skills/laravel-specialist/references/testing.md +522 -0
  142. package/presets/cursor/skills/livewire-alpine-bridge/SKILL.md +39 -0
  143. package/presets/cursor/skills/multi-agent-orchestration/README.md +144 -0
  144. package/presets/cursor/skills/multi-agent-orchestration/SKILL.md +579 -0
  145. package/presets/cursor/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
  146. package/presets/cursor/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
  147. package/presets/cursor/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
  148. package/presets/cursor/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
  149. package/presets/cursor/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
  150. package/presets/cursor/skills/nextjs-typescript/SKILL.md +394 -0
  151. package/presets/cursor/skills/openspec/SKILL.md +52 -0
  152. package/presets/cursor/skills/pagespeed-insights/SKILL.md +445 -0
  153. package/presets/cursor/skills/pagespeed-insights/reference.md +50 -0
  154. package/presets/cursor/skills/pagespeed-perf/SKILL.md +281 -0
  155. package/presets/cursor/skills/php-pro/SKILL.md +210 -0
  156. package/presets/cursor/skills/php-pro/references/async-patterns.md +412 -0
  157. package/presets/cursor/skills/php-pro/references/laravel-patterns.md +377 -0
  158. package/presets/cursor/skills/php-pro/references/modern-php-features.md +323 -0
  159. package/presets/cursor/skills/php-pro/references/symfony-patterns.md +466 -0
  160. package/presets/cursor/skills/php-pro/references/testing-quality.md +466 -0
  161. package/presets/cursor/skills/python/SKILL.md +613 -0
  162. package/presets/cursor/skills/python-django-stack/SKILL.md +500 -0
  163. package/presets/cursor/skills/python-fastapi-stack/SKILL.md +464 -0
  164. package/presets/cursor/skills/security/SKILL.md +384 -0
  165. package/presets/cursor/skills/seo-analytics-injector/SKILL.md +44 -0
  166. package/presets/cursor/skills/spring-auth-auditor/SKILL.md +33 -0
  167. package/presets/cursor/skills/spring-boot-feature/SKILL.md +566 -0
  168. package/presets/cursor/skills/spring-boot-kotlin/SKILL.md +408 -0
  169. package/presets/cursor/skills/spring-boot-testing-strategy/SKILL.md +479 -0
  170. package/presets/cursor/skills/sqlalchemy/SKILL.md +473 -0
  171. package/presets/cursor/skills/tailwind-responsive-auditor/SKILL.md +32 -0
  172. package/presets/cursor/skills/tdd-mutation-tester/SKILL.md +28 -0
  173. package/presets/cursor/skills/testing-tdd/SKILL.md +592 -0
  174. package/presets/cursor/skills/workflow-orchestration-patterns/SKILL.md +98 -0
  175. package/presets/cursor/skills/workflow-orchestration-patterns/references/details.md +223 -0
  176. package/presets/opencode/agents/architect.md +22 -2
  177. package/presets/opencode/agents/complexity-auditor.md +16 -0
  178. package/presets/opencode/agents/contract-builder.md +109 -0
  179. package/presets/opencode/agents/devil.md +158 -0
  180. package/presets/opencode/agents/docs.md +19 -2
  181. package/presets/opencode/agents/goal-planner.md +112 -0
  182. package/presets/opencode/agents/implementer.md +39 -2
  183. package/presets/opencode/agents/orchestrator.md +124 -19
  184. package/presets/opencode/agents/planner.md +61 -0
  185. package/presets/opencode/agents/repo-explorer.md +15 -0
  186. package/presets/opencode/agents/reviewer.md +53 -2
  187. package/presets/opencode/agents/security-reviewer.md +159 -0
  188. package/presets/opencode/agents/task-coach.md +69 -2
  189. package/presets/opencode/agents/tester.md +18 -2
  190. package/presets/opencode/commands/cc-api-contract.md +12 -0
  191. package/presets/opencode/commands/cc-ask.md +55 -0
  192. package/presets/opencode/commands/cc-clarify.md +31 -0
  193. package/presets/opencode/commands/cc-council.md +87 -0
  194. package/presets/opencode/commands/cc-db-migration.md +22 -9
  195. package/presets/opencode/commands/cc-explore.md +35 -0
  196. package/presets/opencode/commands/cc-feature.md +41 -19
  197. package/presets/opencode/commands/cc-fix.md +50 -23
  198. package/presets/opencode/commands/cc-handoff.md +40 -0
  199. package/presets/opencode/commands/cc-iterative.md +127 -0
  200. package/presets/opencode/commands/cc-openspec.md +74 -0
  201. package/presets/opencode/commands/cc-pagespeed.md +12 -0
  202. package/presets/opencode/commands/cc-prototype.md +37 -0
  203. package/presets/opencode/commands/cc-refactor.md +12 -0
  204. package/presets/opencode/commands/cc-review.md +12 -0
  205. package/presets/opencode/commands/cc-scorecard.md +28 -0
  206. package/presets/opencode/commands/cc-tdd-cycle.md +24 -0
  207. package/presets/opencode/commands/cc-test-plan.md +12 -0
  208. package/presets/opencode/commands/cc-triage.md +33 -0
  209. package/presets/opencode/gates/pre-commit/GATE.md +136 -0
  210. package/presets/opencode/prompts/v0.1.0/DEPRECATED.md +11 -0
  211. package/presets/opencode/prompts/v0.2.0/DEPRECATED.md +11 -0
  212. package/presets/opencode/prompts/v0.3.0/DEPRECATED.md +11 -0
  213. package/presets/opencode/prompts/v0.4.0/DEPRECATED.md +11 -0
  214. package/presets/opencode/prompts/v0.5.0/architect.md +222 -0
  215. package/presets/opencode/prompts/v0.5.0/complexity-auditor.md +91 -0
  216. package/presets/opencode/prompts/v0.5.0/contract-builder.md +84 -0
  217. package/presets/opencode/prompts/v0.5.0/docs.md +190 -0
  218. package/presets/opencode/prompts/v0.5.0/goal-planner.md +80 -0
  219. package/presets/opencode/prompts/v0.5.0/implementer.md +171 -0
  220. package/presets/opencode/prompts/v0.5.0/orchestrator.md +388 -0
  221. package/presets/opencode/prompts/v0.5.0/repo-explorer.md +111 -0
  222. package/presets/opencode/prompts/v0.5.0/reviewer.md +248 -0
  223. package/presets/opencode/prompts/v0.5.0/security-reviewer.md +123 -0
  224. package/presets/opencode/prompts/v0.5.0/task-coach.md +156 -0
  225. package/presets/opencode/prompts/v0.5.0/tester.md +252 -0
  226. package/presets/opencode/prompts/v0.6.0/implementer.md +35 -0
  227. package/presets/opencode/prompts/v0.6.0/planner.md +36 -0
  228. package/presets/opencode/prompts/v0.6.0/reviewer.md +40 -0
  229. package/presets/opencode/prompts/v1.0.0/README.md +47 -0
  230. package/presets/opencode/prompts/v1.0.0/architect.md +259 -0
  231. package/presets/opencode/prompts/v1.0.0/complexity-auditor.md +116 -0
  232. package/presets/opencode/prompts/v1.0.0/contract-builder.md +120 -0
  233. package/presets/opencode/prompts/v1.0.0/devil.md +169 -0
  234. package/presets/opencode/prompts/v1.0.0/docs.md +229 -0
  235. package/presets/opencode/prompts/v1.0.0/goal-planner.md +123 -0
  236. package/presets/opencode/prompts/v1.0.0/implementer.md +228 -0
  237. package/presets/opencode/prompts/v1.0.0/orchestrator.md +474 -0
  238. package/presets/opencode/prompts/v1.0.0/planner.md +72 -0
  239. package/presets/opencode/prompts/v1.0.0/repo-explorer.md +147 -0
  240. package/presets/opencode/prompts/v1.0.0/reviewer.md +295 -0
  241. package/presets/opencode/prompts/v1.0.0/security-reviewer.md +170 -0
  242. package/presets/opencode/prompts/v1.0.0/task-coach.md +235 -0
  243. package/presets/opencode/prompts/v1.0.0/tester.md +298 -0
  244. package/presets/opencode/skills/evaluation/SKILL.md +6 -0
  245. package/presets/opencode/skills/openspec/SKILL.md +50 -0
  246. package/presets/seo-hotel/settings.json +0 -17
  247. package/presets/templates/BACKLOG.md +33 -0
  248. package/presets/templates/execution-profile.yml +6 -0
  249. package/presets/templates/model-comparison.md +11 -0
  250. package/presets/templates/regression-checklist.yml +10 -0
  251. package/src/presets/manifests/agy.yml +2 -2
  252. package/src/presets/manifests/claude.yml +2 -2
  253. package/src/presets/manifests/codex.yml +2 -2
  254. package/src/presets/manifests/cursor.yml +19 -3
  255. package/src/presets/manifests/gemini.yml +2 -2
  256. package/src/presets/manifests/opencode.yml +2 -2
  257. package/src/presets/models/agy.yml +97 -49
  258. package/src/presets/models/claude.yml +83 -39
  259. package/src/presets/models/codex.yml +83 -40
  260. package/src/presets/models/cursor.yml +83 -39
  261. package/src/presets/models/gemini.yml +83 -39
  262. package/src/presets/models/opencode.yml +78 -34
@@ -0,0 +1,362 @@
1
+ """
2
+ Framework-Specific Multi-Agent Implementations
3
+
4
+ Templates for CrewAI, AutoGen, LangGraph, and Swarm.
5
+ """
6
+
7
+ from typing import Dict, List, Optional, Any
8
+ from dataclasses import dataclass
9
+
10
+
11
+ @dataclass
12
+ class CrewAITemplate:
13
+ """Template for CrewAI implementation."""
14
+
15
+ @staticmethod
16
+ def create_financial_team() -> Dict[str, Any]:
17
+ """Create CrewAI financial analysis team."""
18
+ return {
19
+ "agents": [
20
+ {
21
+ "name": "Market Analyst",
22
+ "role": "Market Research Specialist",
23
+ "goal": "Analyze market conditions and trends",
24
+ "backstory": "Expert market analyst with 10+ years experience",
25
+ "tools": ["market_data_api", "financial_news"],
26
+ },
27
+ {
28
+ "name": "Financial Analyst",
29
+ "role": "Financial Analysis Specialist",
30
+ "goal": "Analyze company financial statements",
31
+ "backstory": "CFA with deep financial analysis expertise",
32
+ "tools": ["financial_statements", "ratio_calculator"],
33
+ },
34
+ {
35
+ "name": "Risk Manager",
36
+ "role": "Risk Assessment Specialist",
37
+ "goal": "Assess investment risks and scenarios",
38
+ "backstory": "Risk management expert",
39
+ "tools": ["risk_models", "scenario_analysis"],
40
+ },
41
+ {
42
+ "name": "Report Writer",
43
+ "role": "Report Generation Specialist",
44
+ "goal": "Synthesize findings into comprehensive report",
45
+ "backstory": "Professional technical writer",
46
+ "tools": ["document_generator"],
47
+ },
48
+ ],
49
+ "tasks": [
50
+ {
51
+ "agent": "Market Analyst",
52
+ "description": "Analyze market conditions for {company}",
53
+ },
54
+ {
55
+ "agent": "Financial Analyst",
56
+ "description": "Analyze Q3 financial results for {company}",
57
+ },
58
+ {
59
+ "agent": "Risk Manager",
60
+ "description": "Assess risks and create scenarios for {company}",
61
+ },
62
+ {
63
+ "agent": "Report Writer",
64
+ "description": "Write comprehensive investment analysis report",
65
+ },
66
+ ],
67
+ "process": "sequential",
68
+ }
69
+
70
+ @staticmethod
71
+ def create_legal_team() -> Dict[str, Any]:
72
+ """Create CrewAI legal team."""
73
+ return {
74
+ "agents": [
75
+ {
76
+ "name": "Contract Analyzer",
77
+ "role": "Legal Contract Specialist",
78
+ "goal": "Analyze and review contract terms",
79
+ "backstory": "Senior contract attorney",
80
+ },
81
+ {
82
+ "name": "Precedent Researcher",
83
+ "role": "Legal Research Specialist",
84
+ "goal": "Research relevant case law and precedents",
85
+ "backstory": "Legal researcher specializing in case law",
86
+ },
87
+ {
88
+ "name": "Risk Assessor",
89
+ "role": "Legal Risk Specialist",
90
+ "goal": "Identify and assess legal risks",
91
+ "backstory": "Risk management expert in legal domain",
92
+ },
93
+ {
94
+ "name": "Document Drafter",
95
+ "role": "Legal Document Specialist",
96
+ "goal": "Draft legal documents and recommendations",
97
+ "backstory": "Legal document drafting expert",
98
+ },
99
+ ],
100
+ "process": "sequential",
101
+ }
102
+
103
+
104
+ @dataclass
105
+ class AutoGenTemplate:
106
+ """Template for AutoGen implementation."""
107
+
108
+ @staticmethod
109
+ def create_group_chat_config() -> Dict[str, Any]:
110
+ """Create AutoGen group chat configuration."""
111
+ return {
112
+ "agents": [
113
+ {
114
+ "name": "analyst",
115
+ "system_message": "You are a financial analyst. Provide analysis based on data.",
116
+ "llm_config": {"model": "gpt-4", "temperature": 0.7},
117
+ },
118
+ {
119
+ "name": "researcher",
120
+ "system_message": "You are a market researcher. Research trends and competition.",
121
+ "llm_config": {"model": "gpt-4", "temperature": 0.7},
122
+ },
123
+ {
124
+ "name": "critic",
125
+ "system_message": "You are a critical evaluator. Challenge assumptions and findings.",
126
+ "llm_config": {"model": "gpt-4", "temperature": 0.7},
127
+ },
128
+ ],
129
+ "group_chat_config": {
130
+ "agents": ["analyst", "researcher", "critic"],
131
+ "max_round": 10,
132
+ "speaker_selection_method": "auto",
133
+ },
134
+ }
135
+
136
+ @staticmethod
137
+ def create_hierarchical_structure() -> Dict[str, Any]:
138
+ """Create hierarchical AutoGen structure."""
139
+ return {
140
+ "primary_agents": [
141
+ {
142
+ "name": "senior_analyst",
143
+ "role": "Senior analyst coordinating teams",
144
+ "subordinates": ["junior_analyst_1", "junior_analyst_2"],
145
+ }
146
+ ],
147
+ "secondary_agents": [
148
+ {
149
+ "name": "junior_analyst_1",
150
+ "role": "Fundamental analysis specialist",
151
+ },
152
+ {
153
+ "name": "junior_analyst_2",
154
+ "role": "Technical analysis specialist",
155
+ },
156
+ ],
157
+ }
158
+
159
+
160
+ @dataclass
161
+ class LangGraphTemplate:
162
+ """Template for LangGraph workflow implementation."""
163
+
164
+ @staticmethod
165
+ def create_research_workflow() -> Dict[str, Any]:
166
+ """Create LangGraph research workflow."""
167
+ return {
168
+ "name": "research_workflow",
169
+ "state_schema": {
170
+ "topic": str,
171
+ "research_findings": str,
172
+ "analysis": str,
173
+ "recommendations": str,
174
+ },
175
+ "nodes": [
176
+ {
177
+ "name": "researcher",
178
+ "agent": "research_agent",
179
+ "description": "Research the topic",
180
+ },
181
+ {
182
+ "name": "analyst",
183
+ "agent": "analyst_agent",
184
+ "description": "Analyze research findings",
185
+ },
186
+ {
187
+ "name": "critic",
188
+ "agent": "critic_agent",
189
+ "description": "Critique and improve",
190
+ },
191
+ {
192
+ "name": "writer",
193
+ "agent": "writer_agent",
194
+ "description": "Write final report",
195
+ },
196
+ ],
197
+ "edges": [
198
+ ("researcher", "analyst"),
199
+ ("analyst", "critic"),
200
+ ("critic", "writer"),
201
+ ],
202
+ "entry_point": "researcher",
203
+ "exit_point": "writer",
204
+ }
205
+
206
+ @staticmethod
207
+ def create_dynamic_workflow() -> Dict[str, Any]:
208
+ """Create dynamic LangGraph workflow with conditions."""
209
+ return {
210
+ "name": "dynamic_workflow",
211
+ "nodes": [
212
+ {
213
+ "name": "start",
214
+ "type": "input",
215
+ },
216
+ {
217
+ "name": "analyze",
218
+ "type": "agent",
219
+ "agent": "analyzer",
220
+ },
221
+ {
222
+ "name": "quality_check",
223
+ "type": "decision",
224
+ "condition": "analyze_quality > threshold",
225
+ },
226
+ {
227
+ "name": "refine",
228
+ "type": "agent",
229
+ "agent": "refiner",
230
+ },
231
+ {
232
+ "name": "end",
233
+ "type": "output",
234
+ },
235
+ ],
236
+ "conditional_edges": [
237
+ {
238
+ "source": "quality_check",
239
+ "true_target": "end",
240
+ "false_target": "refine",
241
+ }
242
+ ],
243
+ }
244
+
245
+
246
+ @dataclass
247
+ class SwarmTemplate:
248
+ """Template for OpenAI Swarm implementation."""
249
+
250
+ @staticmethod
251
+ def create_customer_support_swarm() -> Dict[str, Any]:
252
+ """Create customer support Swarm."""
253
+ return {
254
+ "agents": [
255
+ {
256
+ "name": "triage_agent",
257
+ "instructions": "Determine which specialist to route the customer to. "
258
+ "Ask clarifying questions if needed.",
259
+ "functions": [
260
+ "route_to_billing",
261
+ "route_to_technical",
262
+ "route_to_account",
263
+ ],
264
+ },
265
+ {
266
+ "name": "billing_specialist",
267
+ "instructions": "Handle all billing and payment related questions. "
268
+ "Can access billing records.",
269
+ "tools": ["billing_system", "payment_processor"],
270
+ },
271
+ {
272
+ "name": "technical_support",
273
+ "instructions": "Handle technical issues and troubleshooting. "
274
+ "Can access diagnostic tools.",
275
+ "tools": ["diagnostic_tools", "knowledge_base"],
276
+ },
277
+ {
278
+ "name": "account_specialist",
279
+ "instructions": "Handle account management and profile changes.",
280
+ "tools": ["account_system"],
281
+ },
282
+ ],
283
+ "handoff_functions": {
284
+ "route_to_billing": "Transfer to billing specialist",
285
+ "route_to_technical": "Transfer to technical support",
286
+ "route_to_account": "Transfer to account specialist",
287
+ },
288
+ }
289
+
290
+ @staticmethod
291
+ def create_sales_swarm() -> Dict[str, Any]:
292
+ """Create sales team Swarm."""
293
+ return {
294
+ "agents": [
295
+ {
296
+ "name": "sales_router",
297
+ "instructions": "Route customer inquiries to appropriate sales agent",
298
+ "functions": ["route_to_enterprise", "route_to_smb"],
299
+ },
300
+ {
301
+ "name": "enterprise_sales",
302
+ "instructions": "Handle enterprise customer inquiries",
303
+ },
304
+ {
305
+ "name": "smb_sales",
306
+ "instructions": "Handle small business inquiries",
307
+ },
308
+ ],
309
+ }
310
+
311
+
312
+ class AgentCommunicationManager:
313
+ """Manage communication patterns between agents."""
314
+
315
+ def __init__(self, agents: Dict[str, Any]):
316
+ """Initialize communication manager."""
317
+ self.agents = agents
318
+ self.message_queue = []
319
+
320
+ def broadcast_message(self, sender: str, message: str, recipients: List[str]):
321
+ """Broadcast message to multiple agents."""
322
+ for recipient in recipients:
323
+ self.message_queue.append({
324
+ "from": sender,
325
+ "to": recipient,
326
+ "message": message,
327
+ "type": "broadcast",
328
+ })
329
+
330
+ def direct_message(self, sender: str, recipient: str, message: str):
331
+ """Send direct message between agents."""
332
+ self.message_queue.append({
333
+ "from": sender,
334
+ "to": recipient,
335
+ "message": message,
336
+ "type": "direct",
337
+ })
338
+
339
+ def publish_shared_state(self, state_key: str, value: Any):
340
+ """Publish to shared state (tool-mediated communication)."""
341
+ self.message_queue.append({
342
+ "type": "shared_state",
343
+ "key": state_key,
344
+ "value": value,
345
+ })
346
+
347
+ def get_pending_messages(self, agent: str) -> List[Dict]:
348
+ """Get messages for specific agent."""
349
+ return [msg for msg in self.message_queue if msg.get("to") == agent]
350
+
351
+ def process_message_queue(self) -> Dict[str, Any]:
352
+ """Process and summarize message queue."""
353
+ direct_messages = [m for m in self.message_queue if m["type"] == "direct"]
354
+ broadcasts = [m for m in self.message_queue if m["type"] == "broadcast"]
355
+ shared_states = [m for m in self.message_queue if m["type"] == "shared_state"]
356
+
357
+ return {
358
+ "direct_messages": len(direct_messages),
359
+ "broadcasts": len(broadcasts),
360
+ "shared_states": len(shared_states),
361
+ "total_messages": len(self.message_queue),
362
+ }