MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / startAgentServer

Function startAgentServer

scripts/dev-static.mjs:326–364  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

324}
325
326function startAgentServer(config) {
327 logService(
328 "agent-server",
329 `Starting on port ${config.agentServerPort}...`,
330 c.blue,
331 );
332
333 const agentServerCmd = buildAgentServerCommand(process.env);
334 logService("agent-server", `Using ${agentServerCmd.source}`, c.dim);
335
336 const safeConfig = buildSafeDevConfig(config.canvasPath, {
337 ...process.env,
338 OH_CANVAS_SAFE_STATE_DIR: config.stateDir,
339 OH_CANVAS_SAFE_BACKEND_PORT: config.agentServerPort.toString(),
340 OH_CANVAS_SAFE_VSCODE_PORT: config.vscodePort.toString(),
341 });
342
343 const agentServerEnv = {
344 ...buildAgentServerEnv(safeConfig),
345 ...buildAgentServerAutomationEnv(config),
346 };
347
348 spawnService(
349 "agent-server",
350 agentServerCmd.command,
351 [
352 ...agentServerCmd.args,
353 "--host",
354 "0.0.0.0",
355 "--port",
356 String(config.agentServerPort),
357 ],
358 {
359 cwd: safeConfig.workspacesPath,
360 env: agentServerEnv,
361 color: c.blue,
362 },
363 );
364}
365
366function buildAutomationBackendEnv(config, env = process.env) {
367 // Both backends share the same session API key value.

Callers 1

mainFunction · 0.70

Calls 6

buildAgentServerCommandFunction · 0.90
buildSafeDevConfigFunction · 0.90
buildAgentServerEnvFunction · 0.90
logServiceFunction · 0.70
spawnServiceFunction · 0.70

Tested by

no test coverage detected