crewlyze 3.1.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 (48) hide show
  1. package/.dockerignore +12 -0
  2. package/.gitattributes +2 -0
  3. package/CHANGELOG.md +86 -0
  4. package/Dockerfile +21 -0
  5. package/LICENSE +21 -0
  6. package/README.md +139 -0
  7. package/USAGE.md +106 -0
  8. package/agents/__init__.py +0 -0
  9. package/agents/cleaner.py +38 -0
  10. package/agents/insights.py +44 -0
  11. package/agents/relation.py +36 -0
  12. package/agents/visualizer.py +41 -0
  13. package/assets/badge_crewai.svg +4 -0
  14. package/assets/badge_matplotlib.svg +4 -0
  15. package/assets/badge_ollama.svg +4 -0
  16. package/assets/badge_pandas.svg +4 -0
  17. package/assets/badge_seaborn.svg +4 -0
  18. package/assets/branding_image.png +0 -0
  19. package/assets/complete_workflow.svg +216 -0
  20. package/assets/favicon.png +0 -0
  21. package/assets/logo.png +0 -0
  22. package/assets/stars.svg +12 -0
  23. package/bin/crewlyze.js +79 -0
  24. package/config/README.md +129 -0
  25. package/config/__init__.py +1 -0
  26. package/config/context.py +16 -0
  27. package/config/llm_config.py +300 -0
  28. package/config/metrics_tracker.py +70 -0
  29. package/crew.py +870 -0
  30. package/crewlyze-3.1.0.tgz +0 -0
  31. package/fix_syntax.py +54 -0
  32. package/main.py +1279 -0
  33. package/package.json +22 -0
  34. package/pyproject.toml +32 -0
  35. package/requirements.txt +33 -0
  36. package/tools/__init__.py +0 -0
  37. package/tools/dataset_tools.py +803 -0
  38. package/ui/__init__.py +3 -0
  39. package/ui/copilot.py +200 -0
  40. package/ui/export.py +800 -0
  41. package/update_appjs.py +54 -0
  42. package/update_llm.py +21 -0
  43. package/update_main.py +20 -0
  44. package/web/app.js +3142 -0
  45. package/web/index.html +1105 -0
  46. package/web/style.css +2561 -0
  47. package/workflows/__init__.py +0 -0
  48. package/workflows/pipeline.py +254 -0
@@ -0,0 +1,216 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="850" viewBox="0 0 1200 850">
2
+ <defs>
3
+ <!-- Sleek Gradients -->
4
+ <linearGradient id="streamGrad" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" style="stop-color:#a78bfa;stop-opacity:1" /> <!-- Violet -->
6
+ <stop offset="50%" style="stop-color:#22d3ee;stop-opacity:1" /> <!-- Cyan -->
7
+ <stop offset="100%" style="stop-color:#f43f5e;stop-opacity:1" /> <!-- Rose -->
8
+ </linearGradient>
9
+
10
+ <linearGradient id="cardGrad" x1="0%" y1="0%" x2="100%" y2="100%">
11
+ <stop offset="0%" style="stop-color:rgba(30, 41, 59, 0.85)" />
12
+ <stop offset="100%" style="stop-color:rgba(15, 23, 42, 0.95)" />
13
+ </linearGradient>
14
+
15
+ <linearGradient id="chatGrad" x1="0%" y1="0%" x2="100%" y2="0%">
16
+ <stop offset="0%" style="stop-color:rgba(124, 58, 237, 0.15)" />
17
+ <stop offset="100%" style="stop-color:rgba(34, 211, 238, 0.05)" />
18
+ </linearGradient>
19
+
20
+ <linearGradient id="agenticGrad" x1="0%" y1="0%" x2="0%" y2="100%">
21
+ <stop offset="0%" style="stop-color:rgba(28, 28, 33, 0.8)" />
22
+ <stop offset="100%" style="stop-color:rgba(9, 9, 11, 0.95)" />
23
+ </linearGradient>
24
+
25
+ <!-- Glow Filters -->
26
+ <filter id="violetGlow" x="-20%" y="-20%" width="140%" height="140%">
27
+ <feGaussianBlur stdDeviation="6" result="blur" />
28
+ <feComposite in="SourceGraphic" in2="blur" operator="over" />
29
+ </filter>
30
+ <filter id="cyanGlow" x="-20%" y="-20%" width="140%" height="140%">
31
+ <feGaussianBlur stdDeviation="5" result="blur" />
32
+ <feComposite in="SourceGraphic" in2="blur" operator="over" />
33
+ </filter>
34
+ <filter id="neonGlow" x="-50%" y="-50%" width="200%" height="200%">
35
+ <feGaussianBlur stdDeviation="4" result="coloredBlur"/>
36
+ <feMerge>
37
+ <feMergeNode in="coloredBlur"/>
38
+ <feMergeNode in="SourceGraphic"/>
39
+ </feMerge>
40
+ </filter>
41
+ </defs>
42
+
43
+ <!-- Deep space background -->
44
+ <rect width="1200" height="850" fill="#09090b" />
45
+
46
+ <!-- Subtle grid lines -->
47
+ <g stroke="rgba(255,255,255,0.02)" stroke-width="1">
48
+ <path d="M0 100 H1200 M0 200 H1200 M0 300 H1200 M0 400 H1200 M0 500 H1200 M0 600 H1200 M0 700 H1200 M0 800 H1200"/>
49
+ <path d="M100 0 V850 M200 0 V850 M300 0 V850 M400 0 V850 M500 0 V850 M600 0 V850 M700 0 V850 M800 0 V850 M900 0 V850 M1000 0 V850 M1100 0 V850"/>
50
+ </g>
51
+
52
+ <!-- Header Section -->
53
+ <g transform="translate(600, 60)">
54
+ <text x="0" y="0" fill="#ffffff" font-family="'Inter', sans-serif" font-size="34" font-weight="800" text-anchor="middle" filter="url(#violetGlow)">
55
+ Agentic Data Analysis System Workflow
56
+ </text>
57
+ <text x="0" y="32" fill="#a1a1aa" font-family="'Inter', sans-serif" font-size="14" font-weight="600" text-anchor="middle" letter-spacing="3">
58
+ DUAL-ENGINE ARCHITECTURE &amp; MULTI-AGENT ORCHESTRATION
59
+ </text>
60
+ </g>
61
+
62
+ <!-- Central Split Flow Lines -->
63
+ <!-- Main entry arrow to Split -->
64
+ <path d="M 125 400 L 195 400" stroke="#a78bfa" stroke-width="2" fill="none" stroke-dasharray="4" />
65
+ <!-- Split into Track A (Top) & Track B (Bottom) -->
66
+ <path d="M 230 360 L 230 220 L 290 220" stroke="#a78bfa" stroke-width="2" fill="none" />
67
+ <path d="M 230 440 L 230 580 L 290 580" stroke="#22d3ee" stroke-width="2" fill="none" />
68
+
69
+ <!-- 1. CSV INPUT NODE -->
70
+ <g transform="translate(70, 400)">
71
+ <circle r="40" fill="rgba(124, 58, 237, 0.15)" stroke="#a78bfa" stroke-width="2" filter="url(#violetGlow)" />
72
+ <text x="0" y="-12" fill="#ffffff" font-family="sans-serif" font-size="18" font-weight="bold" text-anchor="middle">CSV</text>
73
+ <text x="0" y="10" fill="#a78bfa" font-family="sans-serif" font-size="11" font-weight="bold" text-anchor="middle">DATASET</text>
74
+ <text x="0" y="24" fill="#a1a1aa" font-family="sans-serif" font-size="9" text-anchor="middle">UPLOAD</text>
75
+ </g>
76
+
77
+ <!-- 2. PROJECT METADATA REFINE -->
78
+ <g transform="translate(160, 400)">
79
+ <rect x="-45" y="-35" width="90" height="70" rx="8" fill="url(#cardGrad)" stroke="#e2e8f0" stroke-width="1.5" />
80
+ <text x="0" y="-10" fill="#fff" font-family="sans-serif" font-size="11" font-weight="bold" text-anchor="middle">Metadata</text>
81
+ <text x="0" y="6" fill="#22d3ee" font-family="sans-serif" font-size="10" font-weight="bold" text-anchor="middle">Title &amp; Goal</text>
82
+ <text x="0" y="20" fill="#a1a1aa" font-family="sans-serif" font-size="9" text-anchor="middle">LLM Optimized</text>
83
+ </g>
84
+
85
+ <!-- ──────────────── TRACK A: AI CHAT (TOP ENGINE) ──────────────── -->
86
+ <!-- Outer container for Track A -->
87
+ <rect x="290" y="120" width="810" height="200" rx="16" fill="url(#chatGrad)" stroke="rgba(124, 58, 237, 0.25)" stroke-width="1.5" />
88
+ <text x="310" y="148" fill="#a78bfa" font-family="sans-serif" font-size="15" font-weight="bold">TRACK A: AI DATA COPILOT CHAT (Interactive Exploration)</text>
89
+
90
+ <!-- Copilot Node -->
91
+ <g transform="translate(370, 220)">
92
+ <rect x="-60" y="-30" width="120" height="60" rx="10" fill="#0d0d0f" stroke="#a78bfa" stroke-width="2" />
93
+ <text x="0" y="-8" fill="#fff" font-family="sans-serif" font-size="13" font-weight="bold" text-anchor="middle">🤖 Copilot Agent</text>
94
+ <text x="0" y="12" fill="#a78bfa" font-family="sans-serif" font-size="10" text-anchor="middle">Natural Language</text>
95
+ </g>
96
+ <path d="M 430 220 L 480 220" stroke="#a78bfa" stroke-width="2" fill="none" />
97
+
98
+ <!-- Code Generator -->
99
+ <g transform="translate(560, 220)">
100
+ <rect x="-80" y="-30" width="160" height="60" rx="10" fill="#0d0d0f" stroke="#a78bfa" stroke-width="1.5" />
101
+ <text x="0" y="-8" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">📝 Python Code Gen</text>
102
+ <text x="0" y="12" fill="#a1a1aa" font-family="sans-serif" font-size="10" text-anchor="middle">Formulates pandas scripts</text>
103
+ </g>
104
+ <path d="M 640 220 L 690 220" stroke="#a78bfa" stroke-width="2" fill="none" />
105
+
106
+ <!-- Sandboxed Execution -->
107
+ <g transform="translate(775, 220)">
108
+ <rect x="-85" y="-30" width="170" height="60" rx="10" fill="#0d0d0f" stroke="#22d3ee" stroke-width="2" filter="url(#cyanGlow)" />
109
+ <text x="0" y="-8" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">🔒 Sandboxed Python</text>
110
+ <text x="0" y="12" fill="#22d3ee" font-family="sans-serif" font-size="10" text-anchor="middle">Isolated Subprocess Exec</text>
111
+ </g>
112
+ <path d="M 860 220 L 910 220" stroke="#22d3ee" stroke-width="2" fill="none" />
113
+
114
+ <!-- Interactive Outputs -->
115
+ <g transform="translate(990, 220)">
116
+ <rect x="-70" y="-40" width="140" height="80" rx="10" fill="url(#cardGrad)" stroke="#f43f5e" stroke-width="1.5" />
117
+ <text x="0" y="-18" fill="#fff" font-family="sans-serif" font-size="11" font-weight="bold" text-anchor="middle">Chat Results</text>
118
+ <text x="0" y="0" fill="#a1a1aa" font-family="sans-serif" font-size="10" text-anchor="middle">📈 On-the-fly charts</text>
119
+ <text x="0" y="16" fill="#e2e8f0" font-family="sans-serif" font-size="9" text-anchor="middle">In-place CSV edits</text>
120
+ <text x="0" y="28" fill="#10b981" font-family="sans-serif" font-size="9" text-anchor="middle">(Rename/Delete Cols)</text>
121
+ </g>
122
+
123
+
124
+ <!-- ──────────────── TRACK B: AGENTIC PIPELINE (BOTTOM ENGINE) ──────────────── -->
125
+ <!-- Outer container for Track B -->
126
+ <rect x="290" y="360" width="810" height="420" rx="16" fill="url(#agenticGrad)" stroke="rgba(34, 211, 238, 0.25)" stroke-width="1.5" />
127
+ <text x="310" y="388" fill="#22d3ee" font-family="sans-serif" font-size="15" font-weight="bold">TRACK B: AUTOMATED AGENTIC ANALYSIS (CrewAI Pipeline Orchestration)</text>
128
+
129
+ <!-- Pre-computed profile card -->
130
+ <g transform="translate(370, 440)">
131
+ <rect x="-60" y="-25" width="120" height="50" rx="6" fill="#1e293b" stroke="#94a3b8" stroke-width="1" />
132
+ <text x="0" y="-4" fill="#fff" font-family="sans-serif" font-size="11" font-weight="bold" text-anchor="middle">📊 Dataset Profile</text>
133
+ <text x="0" y="10" fill="#a1a1aa" font-family="sans-serif" font-size="9" text-anchor="middle">Embedded in task context</text>
134
+ </g>
135
+ <path d="M 430 440 L 460 440 L 460 560 L 490 560" stroke="#22d3ee" stroke-width="1.5" fill="none" />
136
+
137
+ <!-- CrewAI Logo & Orchestrator -->
138
+ <g transform="translate(370, 560)">
139
+ <polygon points="0,-35 30,-15 30,15 0,35 -30,15 -30,-15" fill="rgba(34, 211, 238, 0.12)" stroke="#22d3ee" stroke-width="2" filter="url(#cyanGlow)" />
140
+ <text x="0" y="-6" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">CrewAI</text>
141
+ <text x="0" y="8" fill="#22d3ee" font-family="sans-serif" font-size="10" font-weight="bold" text-anchor="middle">Orchestrator</text>
142
+ <text x="0" y="18" fill="#a1a1aa" font-family="sans-serif" font-size="8" text-anchor="middle">Adaptive Cooldown</text>
143
+ </g>
144
+ <!-- Connector arrows from orchestrator to the 4 pipeline agents -->
145
+ <path d="M 400 560 L 510 560" stroke="#22d3ee" stroke-width="2" fill="none" />
146
+ <path d="M 450 560 L 450 470 L 510 470" stroke="#22d3ee" stroke-width="1.5" fill="none" />
147
+ <path d="M 450 560 L 450 650 L 510 650" stroke="#22d3ee" stroke-width="1.5" fill="none" />
148
+ <path d="M 450 560 L 450 720 L 510 720" stroke="#22d3ee" stroke-width="1.5" fill="none" />
149
+
150
+ <!-- PIPELINE AGENTS -->
151
+
152
+ <!-- Agent 1: Data Cleaner -->
153
+ <g transform="translate(580, 470)">
154
+ <rect x="-70" y="-25" width="140" height="50" rx="8" fill="#0d0d0f" stroke="#10b981" stroke-width="2" />
155
+ <text x="0" y="-4" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">🧹 Data Cleaner</text>
156
+ <text x="0" y="12" fill="#10b981" font-family="sans-serif" font-size="9" text-anchor="middle">Performs robust cleaning</text>
157
+ </g>
158
+ <path d="M 650 470 L 890 470 M 890 470 L 890 530" stroke="#10b981" stroke-width="1.5" fill="none" />
159
+
160
+ <!-- Agent 2: Relation Mapper -->
161
+ <g transform="translate(580, 560)">
162
+ <rect x="-70" y="-25" width="140" height="50" rx="8" fill="#0d0d0f" stroke="#a78bfa" stroke-width="2" />
163
+ <text x="0" y="-4" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">🔗 Relation Mapper</text>
164
+ <text x="0" y="12" fill="#a78bfa" font-family="sans-serif" font-size="9" text-anchor="middle">Aggregates schema matrix</text>
165
+ </g>
166
+ <path d="M 650 560 L 910 560" stroke="#a78bfa" stroke-width="1.5" fill="none" />
167
+
168
+ <!-- Agent 3: Business Insights -->
169
+ <g transform="translate(580, 650)">
170
+ <rect x="-70" y="-25" width="140" height="50" rx="8" fill="#0d0d0f" stroke="#f59e0b" stroke-width="2" />
171
+ <text x="0" y="-4" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">💡 Business Insights</text>
172
+ <text x="0" y="12" fill="#f59e0b" font-family="sans-serif" font-size="9" text-anchor="middle">BCG/McKinsey framework</text>
173
+ </g>
174
+ <path d="M 650 650 L 910 650" stroke="#f59e0b" stroke-width="1.5" fill="none" />
175
+
176
+ <!-- Agent 4: Visualizer -->
177
+ <g transform="translate(580, 720)">
178
+ <rect x="-70" y="-25" width="140" height="50" rx="8" fill="#0d0d0f" stroke="#ec4899" stroke-width="2" />
179
+ <text x="0" y="-4" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">📈 Visualizer Agent</text>
180
+ <text x="0" y="12" fill="#ec4899" font-family="sans-serif" font-size="9" text-anchor="middle">Matplotlib styled charts</text>
181
+ </g>
182
+ <path d="M 650 720 L 890 720 M 890 720 L 890 680" stroke="#ec4899" stroke-width="1.5" fill="none" />
183
+
184
+ <!-- Results Aggregator -->
185
+ <g transform="translate(980, 605)">
186
+ <rect x="-75" y="-75" width="150" height="150" rx="12" fill="url(#cardGrad)" stroke="#22d3ee" stroke-width="2" filter="url(#cyanGlow)" />
187
+ <text x="0" y="-46" fill="#fff" font-family="sans-serif" font-size="12" font-weight="bold" text-anchor="middle">Structured Outputs</text>
188
+ <text x="-60" y="-22" fill="#a1a1aa" font-family="sans-serif" font-size="9">📋 Clean Audit Trail</text>
189
+ <text x="-60" y="-4" fill="#a1a1aa" font-family="sans-serif" font-size="9">🌐 Interactive Plotly</text>
190
+ <text x="-60" y="14" fill="#a1a1aa" font-family="sans-serif" font-size="9">💡 McKinsey Cards</text>
191
+ <text x="-60" y="32" fill="#a1a1aa" font-family="sans-serif" font-size="9">⚠️ Risk &amp; Alert Box</text>
192
+ <text x="-60" y="50" fill="#a1a1aa" font-family="sans-serif" font-size="9">📂 Cleaned CSV file</text>
193
+ </g>
194
+
195
+ <!-- Multi-Provider Gateway (Floating Badge) -->
196
+ <g transform="translate(170, 715)">
197
+ <rect x="-70" y="-35" width="140" height="70" rx="8" fill="#1e293b" stroke="#38bdf8" stroke-width="1" />
198
+ <text x="0" y="-14" fill="#38bdf8" font-family="sans-serif" font-size="10" font-weight="bold" text-anchor="middle">LLM PROVIDER GATEWAY</text>
199
+ <text x="0" y="2" fill="#fff" font-family="sans-serif" font-size="9" text-anchor="middle">Ollama, NVIDIA NIM, OpenAI,</text>
200
+ <text x="0" y="15" fill="#fff" font-family="sans-serif" font-size="9" text-anchor="middle">Gemini, Anthropic, DeepSeek</text>
201
+ </g>
202
+
203
+ <!-- ──────────────── OUTPUT EXPORTS & EXTRAS ──────────────── -->
204
+ <!-- Connectors from splits to final exports -->
205
+ <path d="M 1060 220 L 1090 220 L 1090 400 L 1115 400" stroke="#f43f5e" stroke-width="1.5" fill="none" />
206
+ <path d="M 1055 605 L 1090 605 L 1090 440 L 1115 440" stroke="#22d3ee" stroke-width="1.5" fill="none" />
207
+
208
+ <!-- 4. FINAL EXPORTS -->
209
+ <g transform="translate(1150, 420)">
210
+ <circle r="30" fill="#1e293b" stroke="#e2e8f0" stroke-width="2"/>
211
+ <text x="0" y="-6" fill="#fff" font-family="sans-serif" font-size="11" font-weight="bold" text-anchor="middle">EXPORT</text>
212
+ <text x="0" y="8" fill="#a1a1aa" font-family="sans-serif" font-size="9" text-anchor="middle">PDF/ZIP</text>
213
+ <text x="0" y="18" fill="#a1a1aa" font-family="sans-serif" font-size="9" text-anchor="middle">CSV</text>
214
+ </g>
215
+
216
+ </svg>
Binary file
Binary file
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="220" height="32" viewBox="0 0 220 32">
2
+ <defs>
3
+ <linearGradient id="gold" x1="0" x2="1"><stop offset="0" stop-color="#ffd54a"/><stop offset="1" stop-color="#ffb300"/></linearGradient>
4
+ </defs>
5
+ <g transform="translate(0,4)" fill="url(#gold)">
6
+ <polygon points="12,0 15,8 24,8 17,13 20,22 12,17 4,22 7,13 0,8 9,8" />
7
+ <g transform="translate(44,0)"><polygon points="12,0 15,8 24,8 17,13 20,22 12,17 4,22 7,13 0,8 9,8" /></g>
8
+ <g transform="translate(88,0)"><polygon points="12,0 15,8 24,8 17,13 20,22 12,17 4,22 7,13 0,8 9,8" /></g>
9
+ <g transform="translate(132,0)"><polygon points="12,0 15,8 24,8 17,13 20,22 12,17 4,22 7,13 0,8 9,8" /></g>
10
+ <g transform="translate(176,0)"><polygon points="12,0 15,8 24,8 17,13 20,22 12,17 4,22 7,13 0,8 9,8" /></g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+ const { execSync, spawn } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+ const os = require('os');
6
+
7
+ console.log('🚀 Starting Crewlyze...');
8
+
9
+ const projectRoot = path.resolve(__dirname, '..');
10
+ const userHome = path.join(os.homedir(), '.crewlyze');
11
+
12
+ // Ensure home directory configuration folder exists
13
+ if (!fs.existsSync(userHome)) {
14
+ fs.mkdirSync(userHome, { recursive: true });
15
+ }
16
+
17
+ // Redirect runtime workspace folders to home directory
18
+ process.env.CREWLYZE_DATA_DIR = path.join(userHome, 'data');
19
+ process.env.CREWLYZE_OUTPUTS_DIR = path.join(userHome, 'outputs');
20
+
21
+ const venvDir = path.join(userHome, 'venv');
22
+ const requirementsPath = path.join(projectRoot, 'requirements.txt');
23
+ const mainPyPath = path.join(projectRoot, 'main.py');
24
+
25
+ // 1. Check if Python is installed
26
+ let pythonCmd = 'python3';
27
+ try {
28
+ execSync('python3 --version', { stdio: 'ignore' });
29
+ } catch (e) {
30
+ try {
31
+ execSync('python --version', { stdio: 'ignore' });
32
+ pythonCmd = 'python';
33
+ } catch (err) {
34
+ console.error('❌ Error: Python 3 is not installed or not in PATH.');
35
+ process.exit(1);
36
+ }
37
+ }
38
+
39
+ // 2. Create virtual environment inside user's home folder if it doesn't exist
40
+ if (!fs.existsSync(venvDir)) {
41
+ console.log(`📦 Creating Python virtual environment in ${venvDir}...`);
42
+ execSync(`"${pythonCmd}" -m venv "${venvDir}"`, { stdio: 'inherit' });
43
+ }
44
+
45
+ const pipCmd = process.platform === 'win32'
46
+ ? path.join(venvDir, 'Scripts', 'pip')
47
+ : path.join(venvDir, 'bin', 'pip');
48
+
49
+ const uvicornCmd = process.platform === 'win32'
50
+ ? path.join(venvDir, 'Scripts', 'uvicorn')
51
+ : path.join(venvDir, 'bin', 'uvicorn');
52
+
53
+ // 3. Install dependencies
54
+ console.log('📦 Installing/Verifying Python dependencies... This may take a moment.');
55
+ execSync(`"${pipCmd}" install -r "${requirementsPath}"`, { cwd: projectRoot, stdio: 'inherit' });
56
+
57
+ // 4. Start the server
58
+ console.log('🚀 Starting Crewlyze server...');
59
+ const serverProcess = spawn(uvicornCmd, ['main:app', '--host', '127.0.0.1', '--port', '8000', '--reload'], {
60
+ cwd: projectRoot,
61
+ stdio: 'inherit',
62
+ env: process.env
63
+ });
64
+
65
+ serverProcess.on('close', (code) => {
66
+ console.log(`Server exited with code ${code}`);
67
+ });
68
+
69
+ // 5. Auto-open default browser
70
+ const url = 'http://127.0.0.1:8000';
71
+ console.log(`🔗 Crewlyze is running at: ${url}`);
72
+ setTimeout(() => {
73
+ const startCmd = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
74
+ try {
75
+ spawn(startCmd, [url], { shell: true });
76
+ } catch (err) {
77
+ // ignore
78
+ }
79
+ }, 2500);
@@ -0,0 +1,129 @@
1
+ # LLM Configuration Guide
2
+
3
+ This directory contains centralized LLM configuration for the CrewAI Data Analyst application.
4
+
5
+ ## Quick Start
6
+
7
+ ### 1. Choose Your LLM Provider
8
+
9
+ Set the `LLM_PROVIDER` environment variable (in Replit Secrets or `.env` file):
10
+
11
+ ```bash
12
+ LLM_PROVIDER=groq # Options: groq, openai, ollama, anthropic
13
+ ```
14
+
15
+ ### 2. Add Your API Key
16
+
17
+ Add the corresponding API key to Replit Secrets:
18
+
19
+ | Provider | API Key Variable | Get Key From |
20
+ |----------|-----------------|--------------|
21
+ | Groq (Default) | `GROQ_API_KEY` | https://console.groq.com/keys |
22
+ | OpenAI | `OPENAI_API_KEY` | https://platform.openai.com/api-keys |
23
+ | Anthropic | `ANTHROPIC_API_KEY` | https://console.anthropic.com/ |
24
+ | Ollama | `OLLAMA_BASE_URL` | http://localhost:11434 (local) |
25
+
26
+ ### 3. Restart the Application
27
+
28
+ After changing providers, restart the workflow to apply changes.
29
+
30
+ ## Supported Providers
31
+
32
+ ### 🚀 Groq (Recommended)
33
+ - **Model**: llama-3.3-70b-versatile
34
+ - **Speed**: Very fast
35
+ - **Cost**: Low
36
+ - **Best for**: Production use, fast responses
37
+
38
+ ```bash
39
+ LLM_PROVIDER=groq
40
+ GROQ_API_KEY=gsk_...
41
+ ```
42
+
43
+ ### 🤖 OpenAI
44
+ - **Model**: gpt-4o-mini
45
+ - **Speed**: Fast
46
+ - **Cost**: Medium
47
+ - **Best for**: High-quality responses
48
+
49
+ ```bash
50
+ LLM_PROVIDER=openai
51
+ OPENAI_API_KEY=sk-...
52
+ ```
53
+
54
+ ### 🏠 Ollama (Local)
55
+ - **Model**: llama3
56
+ - **Speed**: Depends on hardware
57
+ - **Cost**: Free (runs locally)
58
+ - **Best for**: Privacy, offline use
59
+
60
+ ```bash
61
+ LLM_PROVIDER=ollama
62
+ OLLAMA_BASE_URL=http://localhost:11434
63
+ ```
64
+
65
+ ### 🧠 Anthropic Claude
66
+ - **Model**: claude-3-5-sonnet-20241022
67
+ - **Speed**: Fast
68
+ - **Cost**: Medium
69
+ - **Best for**: Complex reasoning tasks
70
+
71
+ ```bash
72
+ LLM_PROVIDER=anthropic
73
+ ANTHROPIC_API_KEY=sk-ant-...
74
+ ```
75
+
76
+ ## How It Works
77
+
78
+ The `llm_config.py` file provides a centralized configuration system that:
79
+
80
+ 1. **Reads environment variables** to determine which LLM provider to use
81
+ 2. **Validates credentials** before initializing agents
82
+ 3. **Returns standardized config** that works with all CrewAI agents
83
+ 4. **Allows easy switching** between providers without code changes
84
+
85
+ ### Code Example
86
+
87
+ All agents automatically use the centralized config:
88
+
89
+ ```python
90
+ from crewai import Agent, LLM
91
+ from config.llm_config import get_llm_params
92
+
93
+ my_agent = Agent(
94
+ name="My Agent",
95
+ role="My Role",
96
+ llm=LLM(**get_llm_params()), # Automatically uses configured provider
97
+ verbose=True
98
+ )
99
+ ```
100
+
101
+ ## Customizing Models
102
+
103
+ To use a different model for a specific provider, edit `config/llm_config.py`:
104
+
105
+ ```python
106
+ GROQ_CONFIG = {
107
+ "model": "groq/llama-3.1-8b-instant", # Change this
108
+ "api_key": os.getenv("GROQ_API_KEY"),
109
+ }
110
+ ```
111
+
112
+ ## Troubleshooting
113
+
114
+ ### Error: "Invalid LLM provider"
115
+ - Check that `LLM_PROVIDER` is set to one of: groq, openai, ollama, anthropic
116
+
117
+ ### Error: "API_KEY environment variable is not set"
118
+ - Make sure you've added the API key to Replit Secrets
119
+ - Restart the workflow after adding secrets
120
+
121
+ ### Error: "Connection refused" (Ollama)
122
+ - Make sure Ollama is running locally
123
+ - Check that `OLLAMA_BASE_URL` points to the correct address
124
+
125
+ ## Security Notes
126
+
127
+ - **Never commit API keys** to version control
128
+ - Always use Replit Secrets or environment variables
129
+ - The `.env.example` file is safe to commit (contains no real keys)
@@ -0,0 +1 @@
1
+ # Config module
@@ -0,0 +1,16 @@
1
+ import contextvars
2
+
3
+ # Thread-safe request-scoped context variables
4
+ current_session_id = contextvars.ContextVar("current_session_id", default="")
5
+ current_session_csv = contextvars.ContextVar("current_session_csv", default="")
6
+ current_session_output_dir = contextvars.ContextVar("current_session_output_dir", default="")
7
+
8
+ # Thread-safe LLM credentials context
9
+ current_llm_provider = contextvars.ContextVar("current_llm_provider", default="")
10
+ current_llm_model = contextvars.ContextVar("current_llm_model", default="")
11
+ current_llm_api_key = contextvars.ContextVar("current_llm_api_key", default="")
12
+ current_llm_env_key_name = contextvars.ContextVar("current_llm_env_key_name", default="")
13
+
14
+ # Analysis execution parameters context
15
+ current_cooldown = contextvars.ContextVar("current_cooldown", default=5)
16
+ current_deep_analysis = contextvars.ContextVar("current_deep_analysis", default=False)