Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,16 @@ Choose your preferred models and providers based on your requirements and prefer

Launch the complete application stack (frontend, backend, and agents):

### Linux / Macos
```bash
bash start.sh
```

### Windows (PowerShell)
```powershell
.\start.ps1
```

## Accessing the Interface

- **Web UI**: Navigate to [http://localhost:1420](http://localhost:1420) in your browser
Expand Down
17 changes: 11 additions & 6 deletions python/scripts/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,27 @@
PROJECT_DIR = Path(__file__).resolve().parent.parent.parent
PYTHON_DIR = PROJECT_DIR / "python"
ENV_PATH = PROJECT_DIR / ".env"
ENV_PATH_STR = str(ENV_PATH.resolve())

# Convert paths to POSIX format (forward slashes) for cross-platform compatibility
# as_posix() works on both Windows and Unix systems
PROJECT_DIR_STR = PROJECT_DIR.as_posix()
PYTHON_DIR_STR = PYTHON_DIR.as_posix()
ENV_PATH_STR = ENV_PATH.as_posix()

# Mapping from agent name to launch command
MAP_NAME_COMMAND: Dict[str, str] = {}
for name, analyst in MAP_NAME_ANALYST.items():
MAP_NAME_COMMAND[name] = (
f"cd {PYTHON_DIR}/third_party/ai-hedge-fund && uv run --env-file {ENV_PATH} -m adapter --analyst {analyst}"
f"cd {PYTHON_DIR_STR}/third_party/ai-hedge-fund && uv run --env-file {ENV_PATH_STR} -m adapter --analyst {analyst}"
)
MAP_NAME_COMMAND[SEC_AGENT_NAME] = (
f"uv run --env-file {ENV_PATH} -m valuecell.agents.sec_agent"
f"uv run --env-file {ENV_PATH_STR} -m valuecell.agents.sec_agent"
)
MAP_NAME_COMMAND[TRADING_AGENTS_NAME] = (
f"cd {PYTHON_DIR}/third_party/TradingAgents && uv run --env-file {ENV_PATH} -m adapter"
f"cd {PYTHON_DIR_STR}/third_party/TradingAgents && uv run --env-file {ENV_PATH_STR} -m adapter"
)
BACKEND_COMMAND = (
f"cd {PYTHON_DIR} && uv run --env-file {ENV_PATH} -m valuecell.server.main"
f"cd {PYTHON_DIR_STR} && uv run --env-file {ENV_PATH_STR} -m valuecell.server.main"
)
FRONTEND_URL = "http://localhost:1420"

Expand All @@ -69,7 +74,7 @@ def check_envfile_is_set():
def main():
check_envfile_is_set()
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
log_dir = f"{PROJECT_DIR}/logs/{timestamp}"
log_dir = f"{PROJECT_DIR_STR}/logs/{timestamp}"

# Use questionary multi-select to allow choosing multiple agents
selected_agents = questionary.checkbox(
Expand Down
111 changes: 111 additions & 0 deletions python/scripts/prepare_envs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# PowerShell script to prepare Python environments
# Equivalent to prepare_envs.sh

$ErrorActionPreference = "Stop"

# Color output functions
function Write-Highlight($message) {
Write-Host $message -ForegroundColor Blue
}

function Write-Success($message) {
Write-Host $message -ForegroundColor Green
}

function Write-Warn($message) {
Write-Host $message -ForegroundColor Yellow
}

function Write-Err($message) {
Write-Host $message -ForegroundColor Red
}

function Highlight-Command($command) {
Write-Highlight "Running: $command"
}

# Check current directory and switch to python if needed
$currentPath = Get-Location
if ((Test-Path "python") -and (Test-Path "python\pyproject.toml") -and (Test-Path ".gitignore")) {
Write-Warn "Detected project root. Switching to python directory..."
Set-Location "python"
} elseif (-not (Test-Path "pyproject.toml") -or -not (Test-Path "third_party")) {
Write-Err "Error: This script must be run from the project python directory or project root. You are in $currentPath"
exit 1
}

# Final check if in python directory
if (-not (Test-Path "pyproject.toml") -or -not (Test-Path "third_party")) {
Write-Err "Error: Failed to switch to python directory. You are in $(Get-Location)"
exit 1
}

# Check if uv is installed
if (-not (Get-Command "uv" -ErrorAction SilentlyContinue)) {
Write-Err "Error: 'uv' command not found. Please install 'uv' from https://docs.astral.sh/uv/"
exit 1
}

Write-Highlight "=========================================="
Write-Highlight "Starting environment preparation..."
Write-Highlight "=========================================="

# Prepare main environment
Write-Success "Project root confirmed. Preparing environments..."

Write-Warn "Setting up main Python environment..."
if (-not (Test-Path ".venv")) {
Highlight-Command "uv venv --python 3.12"
uv venv --python 3.12
} else {
Write-Warn ".venv already exists, skipping venv creation."
}
Highlight-Command "uv sync --group dev"
uv sync --group dev
Write-Success "Main environment setup complete."

Write-Highlight "=========================================="
Write-Highlight "Setting up third-party environments..."
Write-Highlight "=========================================="

# Setup ai-hedge-fund environment
Write-Warn "Setting up ai-hedge-fund environment..."
Push-Location ".\third_party\ai-hedge-fund"
try {
if (-not (Test-Path ".venv")) {
Highlight-Command "uv venv --python 3.12"
uv venv --python 3.12
} else {
Write-Warn ".venv already exists, skipping venv creation."
}
Highlight-Command "uv sync"
uv sync
Write-Success "ai-hedge-fund environment setup complete."
} finally {
Pop-Location
}

Write-Warn "------------------------------------------"
Write-Warn "Setting up TradingAgents environment..."
Write-Warn "------------------------------------------"

# Setup TradingAgents environment
Push-Location ".\third_party\TradingAgents"
try {
if (-not (Test-Path ".venv")) {
Highlight-Command "uv venv --python 3.12"
uv venv --python 3.12
} else {
Write-Warn ".venv already exists, skipping venv creation."
}
Highlight-Command "uv sync"
uv sync
Write-Success "TradingAgents environment setup complete."
} finally {
Pop-Location
}

Write-Success "=========================================="
Write-Success "All environments are set up."
Write-Success "=========================================="

Loading