|
| 1 | +#!/usr/bin/env node |
| 2 | + |
| 3 | +const { execSync } = require('child_process'); |
| 4 | +const path = require('path'); |
| 5 | +const concurrently = require('concurrently'); |
| 6 | + |
| 7 | +// Parse command line arguments |
| 8 | +const args = process.argv.slice(2); |
| 9 | +const showHelp = args.includes('--help') || args.includes('-h'); |
| 10 | +const dryRun = args.includes('--dry-run'); |
| 11 | + |
| 12 | +if (showHelp) { |
| 13 | + console.log(` |
| 14 | +Usage: node run-dojo-everything.js [options] |
| 15 | +
|
| 16 | +Options: |
| 17 | + --dry-run Show what would be started without actually running |
| 18 | + --help, -h Show this help message |
| 19 | +
|
| 20 | +Examples: |
| 21 | + node run-dojo-everything.js |
| 22 | + node run-dojo-everything.js --dry-run |
| 23 | +`); |
| 24 | + process.exit(0); |
| 25 | +} |
| 26 | + |
| 27 | +const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim(); |
| 28 | +const integrationsRoot = path.join(gitRoot, 'typescript-sdk', 'integrations'); |
| 29 | + |
| 30 | +// Server Starter |
| 31 | +const serverStarter = { |
| 32 | + command: 'poetry run dev', |
| 33 | + name: 'Server Starter', |
| 34 | + cwd: path.join(integrationsRoot, 'server-starter/server/python'), |
| 35 | + env: {PORT: 8000}, |
| 36 | +} |
| 37 | + |
| 38 | +// Server Starter All Features |
| 39 | +const serverStarterAllFeatures = { |
| 40 | + command: 'poetry run dev', |
| 41 | + name: 'Server AF', |
| 42 | + cwd: path.join(integrationsRoot, 'server-starter-all-features/server/python'), |
| 43 | + env: {PORT: 8001}, |
| 44 | +} |
| 45 | + |
| 46 | +// Agno |
| 47 | +const agno = { |
| 48 | + command: 'uv run agent.py', |
| 49 | + name: 'Agno', |
| 50 | + cwd: path.join(integrationsRoot, 'agno/examples'), |
| 51 | + env: {PORT: 8002}, |
| 52 | +} |
| 53 | + |
| 54 | +// CrewAI |
| 55 | +const crewai = { |
| 56 | + command: 'poetry run dev', |
| 57 | + name: 'CrewAI', |
| 58 | + cwd: path.join(integrationsRoot, 'crewai/python'), |
| 59 | + env: {PORT: 8003}, |
| 60 | +} |
| 61 | + |
| 62 | +// Langgraph (FastAPI) |
| 63 | +const langgraphFastapi = { |
| 64 | + command: 'poetry run dev', |
| 65 | + name: 'LG FastAPI', |
| 66 | + cwd: path.join(integrationsRoot, 'langgraph/python/ag_ui_langgraph/examples'), |
| 67 | + env: {PORT: 8004}, |
| 68 | +} |
| 69 | + |
| 70 | +// Langgraph (Platform {python}) |
| 71 | +const langgraphPlatformPython = { |
| 72 | + command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --port 8005', |
| 73 | + name: 'LG Platform Py', |
| 74 | + cwd: path.join(integrationsRoot, 'langgraph/examples/python'), |
| 75 | + env: {PORT: 8005}, |
| 76 | +} |
| 77 | + |
| 78 | +// Langgraph (Platform {typescript}) |
| 79 | +const langgraphPlatformTypescript = { |
| 80 | + command: 'pnpx @langchain/langgraph-cli@latest dev --no-browser --port 8006', |
| 81 | + name: 'LG Platform TS', |
| 82 | + cwd: path.join(integrationsRoot, 'langgraph/examples/typescript/'), |
| 83 | + env: {PORT: 8006}, |
| 84 | +} |
| 85 | + |
| 86 | +// Llama Index |
| 87 | +const llamaIndex = { |
| 88 | + command: 'uv run dev', |
| 89 | + name: 'Llama Index', |
| 90 | + cwd: path.join(integrationsRoot, 'llamaindex/server-py'), |
| 91 | + env: {PORT: 8007}, |
| 92 | +} |
| 93 | + |
| 94 | +// Mastra |
| 95 | +const mastra = { |
| 96 | + command: 'npm run dev', |
| 97 | + name: 'Mastra', |
| 98 | + cwd: path.join(integrationsRoot, 'mastra/example'), |
| 99 | + env: {PORT: 8008}, |
| 100 | +} |
| 101 | + |
| 102 | +// Pydantic AI |
| 103 | +const pydanticAi = { |
| 104 | + command: 'uv run dev', |
| 105 | + name: 'Pydantic AI', |
| 106 | + cwd: path.join(integrationsRoot, 'pydantic-ai/examples'), |
| 107 | + env: {PORT: 8009}, |
| 108 | +} |
| 109 | + |
| 110 | +// THE ACTUAL DOJO |
| 111 | +const dojo = { |
| 112 | + command: 'pnpm run start', |
| 113 | + name: 'Dojo', |
| 114 | + cwd: path.join(gitRoot, 'typescript-sdk/apps/dojo'), |
| 115 | + env: { |
| 116 | + PORT: 9999, |
| 117 | + SERVER_STARTER_URL: 'http://localhost:8000', |
| 118 | + SERVER_STARTER_ALL_FEATURES_URL: 'http://localhost:8001', |
| 119 | + AGNO_URL: 'http://localhost:8002', |
| 120 | + CREW_AI_URL: 'http://localhost:8003', |
| 121 | + LANGGRAPH_FAST_API_URL: 'http://localhost:8004', |
| 122 | + // TODO: Move this to run 2 platforms for testing. |
| 123 | + LANGGRAPH_URL: 'http://localhost:8005', |
| 124 | + // LANGGRAPH_PLATFORM_PYTHON_URL: 'http://localhost:8005', |
| 125 | + // LANGGRAPH_PLATFORM_TYPESCRIPT_URL: 'http://localhost:8006', |
| 126 | + LLAMA_INDEX_URL: 'http://localhost:8007', |
| 127 | + MASTRA_URL: 'http://localhost:8008', |
| 128 | + PYDANTIC_AI_URL: 'http://localhost:8009', |
| 129 | + } |
| 130 | +} |
| 131 | + |
| 132 | +const procs = [ |
| 133 | + serverStarter, |
| 134 | + serverStarterAllFeatures, |
| 135 | + agno, |
| 136 | + crewai, |
| 137 | + // langgraphFastapi, // Disabled until it runs |
| 138 | + langgraphPlatformPython, |
| 139 | + // TODO: Also run the typescript version of langgraph. |
| 140 | + langgraphPlatformTypescript, |
| 141 | + llamaIndex, |
| 142 | + mastra, |
| 143 | + pydanticAi, |
| 144 | + dojo |
| 145 | +]; |
| 146 | + |
| 147 | +function printDryRunServices(procs) { |
| 148 | + console.log('Dry run - would start the following services:'); |
| 149 | + procs.forEach(proc => { |
| 150 | + console.log(` - ${proc.name} (${proc.cwd})`); |
| 151 | + console.log(` Command: ${proc.command}`); |
| 152 | + console.log(` Environment variables:`); |
| 153 | + if (proc.env) { |
| 154 | + Object.entries(proc.env).forEach(([key, value]) => { |
| 155 | + console.log(` ${key}: ${value}`); |
| 156 | + }); |
| 157 | + } else { |
| 158 | + console.log(' No environment variables specified.'); |
| 159 | + } |
| 160 | + console.log(''); |
| 161 | + }); |
| 162 | + process.exit(0); |
| 163 | +} |
| 164 | + |
| 165 | +async function main() { |
| 166 | + if (dryRun) { |
| 167 | + printDryRunServices(procs); |
| 168 | + } |
| 169 | + |
| 170 | + console.log('Starting services: ', procs.map(p => p.name).join(', ')); |
| 171 | + |
| 172 | + const {result} = concurrently(procs, {killOthersOn: ['failure', 'success']}); |
| 173 | + |
| 174 | + result.then(() => process.exit(0)).catch((err) => { |
| 175 | + console.error(err); |
| 176 | + process.exit(1); |
| 177 | + }); |
| 178 | +} |
| 179 | + |
| 180 | +main(); |
0 commit comments