forked from sentient-agi/ROMA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
755 lines (639 loc) · 22.5 KB
/
setup.bat
File metadata and controls
755 lines (639 loc) · 22.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
@echo off
setlocal enabledelayedexpansion
REM SentientResearchAgent Unified Setup Script for Windows
REM Supports both Docker and Native installation on Windows
REM Color codes for output (using PowerShell)
set "RED=Write-Host"
set "GREEN=Write-Host"
set "YELLOW=Write-Host"
set "BLUE=Write-Host"
set "NC="
REM Helper functions
:print_info
powershell -Command "Write-Host '[INFO] %~1' -ForegroundColor Blue"
goto :eof
:print_success
powershell -Command "Write-Host '[SUCCESS] %~1' -ForegroundColor Green"
goto :eof
:print_warning
powershell -Command "Write-Host '[WARNING] %~1' -ForegroundColor Yellow"
goto :eof
:print_error
powershell -Command "Write-Host '[ERROR] %~1' -ForegroundColor Red"
goto :eof
REM ASCII Banner
:show_banner
echo.
echo ____ _ _ _
echo / ___| ___ _ __ ^| ^|_^| ^| ___ _ __ ^| ^|_
echo \___ \ / _ \ '_ \^| __^| ^|/ _ \ '_ \^| __^|
echo ___^) ^| __/ ^| ^| ^| ^|_^| ^| __/ ^| ^| ^| ^|_
echo ^|____/ \___^|_^| ^|_^|\__^|_^|\___^|_^| ^|_^|\__^|
echo
echo Research Agent - Setup for Windows
echo.
goto :eof
:show_help
echo Usage: setup.bat [OPTIONS]
echo.
echo Options:
echo --docker Run Docker setup directly
echo --native Run native setup directly
echo --e2b Setup E2B template with AWS credentials (requires E2B_API_KEY and AWS creds in .env)
echo --test-e2b Test E2B template integration (run after --e2b)
echo --help Show this help message
echo.
echo Without options, an interactive menu will be shown.
exit /b 0
REM Show menu
:show_menu
echo.
echo Choose your setup method:
echo.
echo 1) Docker Setup (Recommended)
echo - Isolated environment
echo - No system dependencies
echo - One-command setup
echo - Best for production
echo.
echo 2) Native Setup (Windows)
echo - Direct installation
echo - Full development access
echo - Manual dependency management
echo - Best for development
echo.
echo Both options provide the same functionality!
echo.
set /p "choice=Enter your choice (1 or 2): "
if "%choice%"=="1" (
call :docker_setup
) else if "%choice%"=="2" (
call :native_setup
) else (
call :print_error "Invalid choice. Please run the script again and select 1 or 2."
exit /b 1
)
exit /b 0
REM Main execution
:main
call :show_banner
REM Handle command line arguments
if "%~1"=="" (
call :show_menu
) else if "%~1"=="--help" (
call :show_help
exit /b 0
) else if "%~1"=="--docker" (
call :docker_setup
) else if "%~1"=="--native" (
call :native_setup
) else if "%~1"=="--e2b" (
call :setup_e2b_template
) else if "%~1"=="--test-e2b" (
call :test_e2b_template
) else (
call :print_error "Unknown option: %~1"
echo Use --help for usage information
exit /b 1
)
exit /b 0
REM Check if Docker is installed
:docker_check_requirements
call :print_info "Checking Docker requirements..."
docker --version >nul 2>&1
if errorlevel 1 (
call :print_error "Docker is not installed"
echo Please install Docker Desktop: https://docs.docker.com/docker-for-windows/install/
exit /b 1
)
docker compose version >nul 2>&1
if errorlevel 1 (
call :print_error "Docker Compose is not installed"
echo Please install Docker Desktop which includes Docker Compose
exit /b 1
)
call :print_success "Docker and Docker Compose found"
exit /b 0
REM Setup environment
:docker_setup_environment
call :print_info "Setting up Docker environment..."
if not exist .env (
if exist .env.example (
copy .env.example .env >nul
call :print_info "Created .env file from .env.example"
call :print_warning "Please update .env with your API keys!"
) else (
call :print_warning "No .env.example file found. Please create .env manually."
)
) else (
call :print_info ".env file already exists"
)
if not exist docker\.env (
if exist docker\.env.example (
copy docker\.env.example docker\.env >nul
call :print_info "Created docker/.env from template"
) else (
if exist .env (
copy .env docker\.env >nul 2>nul
)
)
)
REM Create necessary directories
call :print_info "Creating necessary directories..."
if not exist logs mkdir logs >nul 2>nul
if not exist project_results mkdir project_results >nul 2>nul
if not exist emergency_backups mkdir emergency_backups >nul 2>nul
call :print_success "Environment setup complete"
exit /b 0
REM Build Docker images
:docker_build
call :print_info "Building Docker images..."
cd docker
set "compose_files=-f docker-compose.yml"
if exist "..\.env" (
REM Check if S3 mounting is enabled
for /f "usebackq tokens=*" %%a in (`findstr /r "^S3_MOUNT_ENABLED" "..\.env" 2^>nul`) do (
set "s3_mount_line=%%a"
)
if defined s3_mount_line (
echo !s3_mount_line! | findstr /i "true" >nul
if not errorlevel 1 (
REM S3 mounting is enabled, check if directory exists
for /f "usebackq tokens=*" %%a in (`findstr /r "^S3_MOUNT_DIR" "..\.env" 2^>nul`) do (
set "s3_mount_dir_line=%%a"
)
if defined s3_mount_dir_line (
for /f "tokens=2 delims==" %%b in ("!s3_mount_dir_line!") do (
set "s3_mount_dir=%%b"
REM Remove quotes if present
set "s3_mount_dir=!s3_mount_dir:"=!"
)
if defined s3_mount_dir (
if exist "!s3_mount_dir!" (
set "compose_files=!compose_files! -f docker-compose.s3.yml"
call :print_info "Building with S3 mount configuration for directory: !s3_mount_dir!"
) else (
call :print_warning "S3 mount directory !s3_mount_dir! does not exist, skipping S3 compose override"
)
)
)
)
)
)
REM Build Docker images
docker compose !compose_files! build --no-cache
cd ..
call :print_success "Docker images built successfully"
exit /b 0
REM Start Docker services
:docker_start
call :print_info "Starting Docker services..."
cd docker
set "compose_files=-f docker-compose.yml"
if exist "..\.env" (
REM Check if S3 mounting is enabled
for /f "usebackq tokens=*" %%a in (`findstr /r "^S3_MOUNT_ENABLED" "..\.env" 2^>nul`) do (
set "s3_mount_line=%%a"
)
if defined s3_mount_line (
echo !s3_mount_line! | findstr /i "true" >nul
if not errorlevel 1 (
REM S3 mounting is enabled, check if directory exists
for /f "usebackq tokens=*" %%a in (`findstr /r "^S3_MOUNT_DIR" "..\.env" 2^>nul`) do (
set "s3_mount_dir_line=%%a"
)
if defined s3_mount_dir_line (
for /f "tokens=2 delims==" %%b in ("!s3_mount_dir_line!") do (
set "s3_mount_dir=%%b"
REM Remove quotes if present
set "s3_mount_dir=!s3_mount_dir:"=!"
)
if defined s3_mount_dir (
if exist "!s3_mount_dir!" (
set "compose_files=!compose_files! -f docker-compose.s3.yml"
call :print_info "Including S3 mount configuration for directory: !s3_mount_dir!"
) else (
call :print_warning "S3 mount directory !s3_mount_dir! does not exist, skipping S3 compose override"
)
)
)
)
)
)
docker compose !compose_files! up -d
REM Wait for services
call :print_info "Waiting for services to start..."
timeout /t 10 /nobreak >nul
REM Check backend health
powershell -Command "try { $response = Invoke-WebRequest -Uri 'http://localhost:5000/api/health' -Method GET -TimeoutSec 5; if ($response.StatusCode -eq 200) { exit 0 } else { exit 1 } } catch { exit 1 }" >nul 2>&1
if errorlevel 1 (
call :print_warning "Backend health check failed - it may still be starting"
echo Check logs with: cd docker && docker compose logs backend
) else (
call :print_success "Backend is healthy"
)
REM Check frontend
powershell -Command "try { $response = Invoke-WebRequest -Uri 'http://localhost:3000' -Method GET -TimeoutSec 5; if ($response.StatusCode -eq 200) { exit 0 } else { exit 1 } } catch { exit 1 }" >nul 2>&1
if errorlevel 1 (
call :print_info "Frontend may still be starting..."
) else (
call :print_success "Frontend is running on http://localhost:3000"
)
cd ..
REM Auto-open browser for Docker frontend
start "" "http://localhost:3000"
exit /b 0
REM Docker setup main function
:docker_setup
call :print_info "Starting Docker setup..."
call :docker_check_requirements
if errorlevel 1 exit /b 1
call :docker_setup_environment
call :docker_build
call :docker_start
echo.
echo ========================================
call :print_success "Docker Setup Complete!"
echo ========================================
echo.
echo Services:
echo - Backend API: http://localhost:5000
echo - Frontend Dev: http://localhost:3000
echo.
echo Features:
if exist .env (
findstr /r "^E2B_API_KEY" .env >nul 2>&1
if errorlevel 1 (
echo - E2B Code Execution: ⚠️ Configure E2B_API_KEY in .env
) else (
findstr /r "your_e2b_api_key_here" .env >nul 2>&1
if errorlevel 1 (
echo - E2B Code Execution: ✅ Configured
) else (
echo - E2B Code Execution: ⚠️ Configure E2B_API_KEY in .env
)
)
findstr /r "^S3_BUCKET_NAME" .env >nul 2>&1
if errorlevel 1 (
echo - S3 Integration: ⚠️ Configure AWS credentials in .env
) else (
findstr /r "your-s3-bucket-name" .env >nul 2>&1
if errorlevel 1 (
echo - S3 Integration: ✅ Configured
) else (
echo - S3 Integration: ⚠️ Configure AWS credentials in .env
)
)
) else (
echo - E2B Code Execution: ⚠️ Configure E2B_API_KEY in .env
echo - S3 Integration: ⚠️ Configure AWS credentials in .env
)
echo.
echo Useful Docker commands:
echo - View logs: cd docker && docker compose logs -f
echo - Stop: cd docker && docker compose down
echo - Restart: cd docker && docker compose restart
echo - View status: cd docker && docker compose ps
echo.
if exist .env (
findstr /r "your_.*_api_key_here" .env >nul 2>&1
if not errorlevel 1 (
call :print_warning "Don't forget to configure your API keys and S3 settings in .env"
)
findstr /r "your-.*-bucket-name" .env >nul 2>&1
if not errorlevel 1 (
call :print_warning "Don't forget to configure your API keys and S3 settings in .env"
)
)
echo.
call :print_info "🚀 Optional: Setup E2B sandbox for code execution"
call :print_info " Run: setup.bat --e2b (requires E2B_API_KEY and AWS credentials in .env"
call :print_info " Test: setup.bat --test-e2b (after E2B setup)"
exit /b 0
REM Setup E2B template
:setup_e2b_template
call :print_info "Setting up E2B template with AWS credentials..."
REM Check if E2B CLI is installed
npm list -g @e2b/cli >nul 2>&1
if errorlevel 1 (
call :print_error "E2B CLI not found. Please install it first:"
echo npm install -g @e2b/cli
exit /b 1
)
REM Check if .env file exists
if not exist .env (
call :print_error ".env file not found. Please create it with AWS credentials first."
exit /b 1
)
REM Load environment variables from .env
call :print_info "Loading AWS credentials from .env..."
for /f "usebackq tokens=*" %%a in (`.env`) do (
set "line=%%a"
if "!line:~0,1!" neq "#" (
set "!line!"
)
)
REM Validate required environment variables
if not defined AWS_ACCESS_KEY_ID (
call :print_error "Missing required AWS credentials in .env file:"
call :print_error "Required: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, S3_BUCKET_NAME"
exit /b 1
)
if not defined AWS_SECRET_ACCESS_KEY (
call :print_error "Missing required AWS credentials in .env file:"
call :print_error "Required: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, S3_BUCKET_NAME"
exit /b 1
)
if not defined S3_BUCKET_NAME (
call :print_error "Missing required AWS credentials in .env file:"
call :print_error "Required: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, S3_BUCKET_NAME"
exit /b 1
)
call :print_info "AWS credentials found:"
call :print_info " AWS_ACCESS_KEY_ID: %AWS_ACCESS_KEY_ID:~0,10%..."
call :print_info " S3_BUCKET_NAME: %S3_BUCKET_NAME%"
call :print_info " AWS_REGION: %AWS_REGION%"
REM Change to E2B template directory
if not exist "docker\e2b-sandbox" (
call :print_error "E2B template directory not found: docker/e2b-sandbox"
exit /b 1
)
cd docker\e2b-sandbox
REM Get S3 mount directory from .env or use default
set "S3_MOUNT_DIR=/opt/sentient"
if exist "..\..\.env" (
for /f "usebackq tokens=*" %%a in (`findstr /r "^S3_MOUNT_DIR" "..\..\.env" 2^>nul`) do (
set "s3_mount_dir_line=%%a"
)
if defined s3_mount_dir_line (
for /f "tokens=2 delims==" %%b in ("!s3_mount_dir_line!") do (
set "S3_MOUNT_DIR=%%b"
REM Remove quotes if present
set "S3_MOUNT_DIR=!S3_MOUNT_DIR:"=!"
)
)
)
REM Build E2B template with build args
call :print_info "Building E2B template with AWS credentials and mount directory as build args..."
call :print_info " S3_MOUNT_DIR: !S3_MOUNT_DIR!"
e2b template build --build-arg AWS_ACCESS_KEY_ID="%AWS_ACCESS_KEY_ID%" --build-arg AWS_SECRET_ACCESS_KEY="%AWS_SECRET_ACCESS_KEY%" --build-arg AWS_REGION="%AWS_REGION%" --build-arg S3_BUCKET_NAME="%S3_BUCKET_NAME%" --build-arg S3_MOUNT_DIR="!S3_MOUNT_DIR!" --name sentient-e2b-s3
if errorlevel 1 (
call :print_error "E2B template build failed"
cd ..\..
exit /b 1
)
call :print_success "E2B template built successfully!"
call :print_info "Template name: sentient-e2b-s3"
call :print_info "You can now use this template with AgnoAgent E2BTools"
call :print_info "Test the template with: setup.bat --test-e2b"
cd ..\..
exit /b 0
REM Test E2B template
:test_e2b_template
call :print_info "Testing E2B template with AWS integration..."
REM Check if E2B CLI is available
e2b --version >nul 2>&1
if errorlevel 1 (
call :print_error "E2B CLI not found. Install with: npm install -g @e2b/cli"
exit /b 1
)
REM Check E2B authentication
call :print_info "Checking E2B authentication..."
e2b auth whoami >nul 2>&1
if errorlevel 1 (
call :print_warning "E2B not authenticated. Attempting to log in..."
call :print_info "This will open your browser to authenticate with E2B"
e2b auth login
if errorlevel 1 (
call :print_error "E2B authentication failed. Please try manually: e2b auth login"
exit /b 1
)
)
call :print_success "E2B authentication verified"
REM Check if template exists
set "template_name=sentient-e2b-s3"
call :print_info "Checking E2B template: !template_name!"
e2b template list 2>nul | findstr /c:"!template_name!" >nul
if errorlevel 1 (
call :print_warning "E2B template '!template_name!' not found"
call :print_info "Available templates:"
e2b template list 2>nul
call :print_info "Build the template with: cd docker/e2b-sandbox && e2b template build --name !template_name!"
exit /b 1
)
call :print_success "E2B template '!template_name!' found"
REM Load E2B API key from environment
if defined E2B_API_KEY (
set "E2B_API_KEY=!E2B_API_KEY!"
)
REM Check AWS environment variables
call :print_info "Checking AWS configuration..."
set "missing_vars="
if not defined AWS_ACCESS_KEY_ID set "missing_vars=!missing_vars! AWS_ACCESS_KEY_ID"
if not defined AWS_SECRET_ACCESS_KEY set "missing_vars=!missing_vars! AWS_SECRET_ACCESS_KEY"
if not defined S3_BUCKET_NAME set "missing_vars=!missing_vars! S3_BUCKET_NAME"
if defined missing_vars (
call :print_warning "Missing AWS environment variables:!missing_vars!"
call :print_info "Configure these in your .env file for full functionality"
) else (
call :print_success "AWS credentials configured"
)
REM Test basic E2B sandbox creation (without specific libraries)
call :print_info "Testing E2B sandbox creation..."
python -c "import os; import sys; print('[INFO] Testing basic E2B functionality...'); e2b_key = os.getenv('E2B_API_KEY'); print('[SUCCESS] E2B_API_KEY configured' if e2b_key else '[ERROR] E2B_API_KEY not set'); sys.exit(0 if e2b_key else 1)" >nul 2>&1
if errorlevel 1 (
call :print_warning "E2B template test completed with limitations"
call :print_info "E2B CLI is working but Python libraries may need installation"
) else (
call :print_success "E2B template test completed successfully!"
call :print_info "Template '!template_name!' is ready for use"
)
exit /b 0
REM Check system compatibility for native setup
:native_check_system
call :print_info "Checking system compatibility (Windows)..."
REM Check if we're on Windows
ver | findstr /i "Windows" >nul
if errorlevel 1 (
call :print_error "This path is for Windows systems."
exit /b 1
)
call :print_success "Running on Windows"
exit /b 0
REM Install Python 3.12
:native_install_python
call :print_info "Installing Python 3.12 (Windows)..."
REM Check if Python 3.12 is already installed
python --version 2>nul | findstr "3.12" >nul
if not errorlevel 1 (
call :print_success "Python 3.12 is already installed"
exit /b 0
)
REM Try to install Python via winget (Windows Package Manager)
where winget >nul 2>nul
if not errorlevel 1 (
call :print_info "Installing Python 3.12 via winget..."
winget install --id Python.Python.3.12 -e --source winget
if not errorlevel 1 (
call :print_success "Python 3.12 installed successfully"
exit /b 0
)
)
REM If winget is not available or fails, provide instructions
call :print_warning "winget not found or failed to install Python"
call :print_info "Please manually install Python 3.12 from https://www.python.org/downloads/"
call :print_info "Make sure to add Python to your PATH during installation"
pause
exit /b 0
REM Install PDM and UV package managers
:native_install_pdm_uv
call :print_info "Installing PDM and UV package managers..."
REM Install PDM
where pdm >nul 2>nul
if errorlevel 1 (
call :print_info "Installing PDM..."
python -m pip install pdm
if errorlevel 1 (
call :print_warning "Failed to install PDM via pip, trying alternative method..."
curl -sSL https://pdm-project.org/install-pdm.py | python -
)
) else (
call :print_success "PDM is already installed"
)
REM Install UV
where uv >nul 2>nul
if errorlevel 1 (
call :print_info "Installing UV..."
python -m pip install uv
if errorlevel 1 (
call :print_warning "Failed to install UV via pip"
)
) else (
call :print_success "UV is already installed"
)
call :print_success "PDM and UV package managers installed successfully"
exit /b 0
REM Install Node.js
:native_install_node
call :print_info "Installing Node.js..."
REM Check if Node.js is already installed
where node >nul 2>nul
if not errorlevel 1 (
call :print_success "Node.js is already installed"
node --version
exit /b 0
)
REM Try to install Node.js via winget
where winget >nul 2>nul
if not errorlevel 1 (
call :print_info "Installing Node.js via winget..."
winget install --id OpenJS.NodeJS -e --source winget
if not errorlevel 1 (
call :print_success "Node.js installed successfully"
exit /b 0
)
)
REM If winget is not available or fails, provide instructions
call :print_warning "winget not found or failed to install Node.js"
call :print_info "Please manually install Node.js from https://nodejs.org/"
pause
exit /b 0
REM Setup environment
:native_setup_environment
call :print_info "Setting up environment configuration..."
REM Create .env file if it doesn't exist
if not exist .env (
if exist .env.example (
copy .env.example .env >nul
call :print_info "Created .env file from .env.example"
call :print_warning "Please update .env with your API keys!"
) else (
call :print_warning "No .env.example file found. Please create .env manually."
)
) else (
call :print_info ".env file already exists"
)
REM Create necessary directories
call :print_info "Creating necessary directories..."
if not exist logs mkdir logs >nul 2>nul
if not exist project_results mkdir project_results >nul 2>nul
if not exist emergency_backups mkdir emergency_backups >nul 2>nul
call :print_success "Environment setup complete"
exit /b 0
REM Setup project with UV
:native_setup_project
call :print_info "Setting up project with UV..."
REM Check if we're in the project directory
if not exist "pyproject.toml" (
call :print_error "Please run this script from the SentientResearchAgent project root directory"
exit /b 1
)
REM Create virtual environment with UV
call :print_info "Creating virtual environment with UV..."
if exist ".venv" (
call :print_info "Virtual environment already exists, using existing one"
) else (
uv venv --python 3.12
)
REM Activate virtual environment
call :print_info "Activating virtual environment..."
call .venv\Scripts\activate.bat
REM Install dependencies with UV
call :print_info "Installing Python dependencies with UV..."
uv sync
call :print_success "Project setup complete"
exit /b 0
REM Install frontend dependencies
:native_install_frontend
call :print_info "Installing frontend dependencies..."
REM Check if frontend directory exists
if not exist "frontend" (
call :print_error "Frontend directory not found"
exit /b 1
)
cd frontend
REM Install dependencies
call :print_info "Running npm install..."
npm install
cd ..
call :print_success "Frontend dependencies installed"
exit /b 0
REM Native setup main function
:native_setup
call :print_info "Starting native Windows setup..."
call :native_check_system
if errorlevel 1 exit /b 1
call :native_install_python
call :native_install_pdm_uv
call :native_install_node
call :native_setup_environment
call :native_setup_project
call :native_install_frontend
echo.
echo ========================================
call :print_success "Native Setup Complete!"
echo ========================================
echo.
echo To run the servers:
echo.
echo 1. Start the backend server:
echo Start a new Command Prompt window
echo Navigate to the project directory
echo Run: .venv\Scripts\activate.bat
echo Run: python -m sentientresearchagent
echo.
echo 2. Start the frontend server:
echo Start a new Command Prompt window
echo Navigate to the frontend directory
echo Run: npm run dev
echo.
echo Server URLs:
echo - Backend API: http://localhost:5000
echo - Frontend: http://localhost:3000
echo.
call :print_warning "Don't forget to:"
echo 1. Update .env file with your API keys
echo.
exit /b 0
REM Call main function with all arguments
call :main %*