client.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. """
  2. This is the main file for the runtime client.
  3. It is responsible for executing actions received from OpenDevin backend and producing observations.
  4. NOTE: this will be executed inside the docker sandbox.
  5. """
  6. import argparse
  7. import asyncio
  8. import os
  9. import re
  10. import shutil
  11. import subprocess
  12. from contextlib import asynccontextmanager
  13. from pathlib import Path
  14. import pexpect
  15. from fastapi import FastAPI, HTTPException, Request, UploadFile
  16. from fastapi.responses import JSONResponse
  17. from pathspec import PathSpec
  18. from pathspec.patterns import GitWildMatchPattern
  19. from pydantic import BaseModel
  20. from uvicorn import run
  21. from opendevin.core.logger import opendevin_logger as logger
  22. from opendevin.events.action import (
  23. Action,
  24. BrowseInteractiveAction,
  25. BrowseURLAction,
  26. CmdRunAction,
  27. FileReadAction,
  28. FileWriteAction,
  29. IPythonRunCellAction,
  30. )
  31. from opendevin.events.observation import (
  32. CmdOutputObservation,
  33. ErrorObservation,
  34. FileReadObservation,
  35. FileWriteObservation,
  36. IPythonRunCellObservation,
  37. Observation,
  38. )
  39. from opendevin.events.serialization import event_from_dict, event_to_dict
  40. from opendevin.runtime.browser import browse
  41. from opendevin.runtime.browser.browser_env import BrowserEnv
  42. from opendevin.runtime.plugins import (
  43. ALL_PLUGINS,
  44. JupyterPlugin,
  45. Plugin,
  46. )
  47. from opendevin.runtime.utils import split_bash_commands
  48. from opendevin.runtime.utils.files import insert_lines, read_lines
  49. class ActionRequest(BaseModel):
  50. action: dict
  51. ROOT_GID = 0
  52. INIT_COMMANDS = [
  53. 'git config --global user.name "opendevin"',
  54. 'git config --global user.email "opendevin@all-hands.dev"',
  55. "alias git='git --no-pager'",
  56. ]
  57. class RuntimeClient:
  58. """RuntimeClient is running inside docker sandbox.
  59. It is responsible for executing actions received from OpenDevin backend and producing observations.
  60. """
  61. def __init__(
  62. self,
  63. plugins_to_load: list[Plugin],
  64. work_dir: str,
  65. username: str,
  66. user_id: int,
  67. browsergym_eval_env: str | None,
  68. ) -> None:
  69. self.plugins_to_load = plugins_to_load
  70. self.username = username
  71. self.user_id = user_id
  72. self.pwd = work_dir # current PWD
  73. self._initial_pwd = work_dir
  74. self._init_user(self.username, self.user_id)
  75. self._init_bash_shell(self.pwd, self.username)
  76. self.lock = asyncio.Lock()
  77. self.plugins: dict[str, Plugin] = {}
  78. self.browser = BrowserEnv(browsergym_eval_env)
  79. self._initial_pwd = work_dir
  80. @property
  81. def initial_pwd(self):
  82. return self._initial_pwd
  83. async def ainit(self):
  84. for plugin in self.plugins_to_load:
  85. await plugin.initialize(self.username)
  86. self.plugins[plugin.name] = plugin
  87. logger.info(f'Initializing plugin: {plugin.name}')
  88. if isinstance(plugin, JupyterPlugin):
  89. await self.run_ipython(
  90. IPythonRunCellAction(code=f'import os; os.chdir("{self.pwd}")')
  91. )
  92. # This is a temporary workaround
  93. # TODO: refactor AgentSkills to be part of JupyterPlugin
  94. # AFTER ServerRuntime is deprecated
  95. if 'agent_skills' in self.plugins and 'jupyter' in self.plugins:
  96. obs = await self.run_ipython(
  97. IPythonRunCellAction(code='from agentskills import *')
  98. )
  99. logger.info(f'AgentSkills initialized: {obs}')
  100. await self._init_bash_commands()
  101. def _init_user(self, username: str, user_id: int) -> None:
  102. """Create user if not exists."""
  103. # Skip root since it is already created
  104. if username == 'root':
  105. return
  106. # Add sudoer
  107. sudoer_line = r"echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"
  108. output = subprocess.run(sudoer_line, shell=True, capture_output=True)
  109. if output.returncode != 0:
  110. raise RuntimeError(f'Failed to add sudoer: {output.stderr.decode()}')
  111. logger.debug(f'Added sudoer successfully. Output: [{output.stdout.decode()}]')
  112. # Add user and change ownership of the initial working directory
  113. output = subprocess.run(
  114. (
  115. f'useradd -rm -d /home/{username} -s /bin/bash '
  116. f'-g root -G sudo -u {user_id} {username} &&'
  117. f'chown -R {username}:root {self.initial_pwd} && '
  118. f'chmod g+s {self.initial_pwd}'
  119. ),
  120. shell=True,
  121. capture_output=True,
  122. )
  123. if output.returncode != 0:
  124. raise RuntimeError(
  125. f'Failed to create user {username}: {output.stderr.decode()}'
  126. )
  127. logger.debug(
  128. f'Added user {username} successfully. Output: [{output.stdout.decode()}]'
  129. )
  130. def _init_bash_shell(self, work_dir: str, username: str) -> None:
  131. self.shell = pexpect.spawn(
  132. f'su - {username}',
  133. encoding='utf-8',
  134. echo=False,
  135. )
  136. self.__bash_PS1 = r'[PEXPECT_BEGIN] \u@\h:\w [PEXPECT_END]'
  137. # This should NOT match "PS1=\u@\h:\w [PEXPECT]$" when `env` is executed
  138. self.__bash_expect_regex = (
  139. r'\[PEXPECT_BEGIN\] ([a-z0-9_-]*)@([a-zA-Z0-9.-]*):(.+) \[PEXPECT_END\]'
  140. )
  141. self.shell.sendline(f'export PS1="{self.__bash_PS1}"; export PS2=""')
  142. self.shell.expect(self.__bash_expect_regex)
  143. self.shell.sendline(f'cd {work_dir}')
  144. self.shell.expect(self.__bash_expect_regex)
  145. logger.debug(
  146. f'Bash initialized. Working directory: {work_dir}. Output: {self.shell.before}'
  147. )
  148. async def _init_bash_commands(self):
  149. logger.info(f'Initializing by running {len(INIT_COMMANDS)} bash commands...')
  150. for command in INIT_COMMANDS:
  151. action = CmdRunAction(command=command)
  152. action.timeout = 300
  153. logger.debug(f'Executing init command: {command}')
  154. obs: CmdOutputObservation = await self.run(action)
  155. logger.debug(
  156. f'Init command outputs (exit code: {obs.exit_code}): {obs.content}'
  157. )
  158. assert obs.exit_code == 0
  159. logger.info('Bash init commands completed')
  160. def _get_bash_prompt_and_update_pwd(self):
  161. ps1 = self.shell.after
  162. # begin at the last occurence of '[PEXPECT_BEGIN]'.
  163. # In multi-line bash commands, the prompt will be repeated
  164. # and the matched regex captures all of them
  165. # - we only want the last one (newest prompt)
  166. _begin_pos = ps1.rfind('[PEXPECT_BEGIN]')
  167. if _begin_pos != -1:
  168. ps1 = ps1[_begin_pos:]
  169. # parse the ps1 to get username, hostname, and working directory
  170. matched = re.match(self.__bash_expect_regex, ps1)
  171. assert (
  172. matched is not None
  173. ), f'Failed to parse bash prompt: {ps1}. This should not happen.'
  174. username, hostname, working_dir = matched.groups()
  175. self.pwd = os.path.expanduser(working_dir)
  176. # re-assemble the prompt
  177. prompt = f'{username}@{hostname}:{working_dir} '
  178. if username == 'root':
  179. prompt += '#'
  180. else:
  181. prompt += '$'
  182. return prompt + ' '
  183. def _execute_bash(
  184. self,
  185. command: str,
  186. timeout: int | None,
  187. keep_prompt: bool = True,
  188. ) -> tuple[str, int]:
  189. logger.debug(f'Executing command: {command}')
  190. try:
  191. self.shell.sendline(command)
  192. self.shell.expect(self.__bash_expect_regex, timeout=timeout)
  193. output = self.shell.before
  194. # Get exit code
  195. self.shell.sendline('echo $?')
  196. logger.debug(f'Executing command for exit code: {command}')
  197. self.shell.expect(self.__bash_expect_regex, timeout=timeout)
  198. _exit_code_output = self.shell.before
  199. logger.debug(f'Exit code Output: {_exit_code_output}')
  200. exit_code = int(_exit_code_output.strip().split()[0])
  201. except pexpect.TIMEOUT as e:
  202. self.shell.sendintr() # send SIGINT to the shell
  203. self.shell.expect(self.__bash_expect_regex, timeout=timeout)
  204. output = self.shell.before
  205. output += (
  206. '\r\n\r\n'
  207. + f'[Command timed out after {timeout} seconds. SIGINT was sent to interrupt it.]'
  208. )
  209. exit_code = 130 # SIGINT
  210. logger.error(f'Failed to execute command: {command}. Error: {e}')
  211. finally:
  212. bash_prompt = self._get_bash_prompt_and_update_pwd()
  213. if keep_prompt:
  214. output += '\r\n' + bash_prompt
  215. logger.debug(f'Command output: {output}')
  216. return output, exit_code
  217. async def run_action(self, action) -> Observation:
  218. action_type = action.action
  219. observation = await getattr(self, action_type)(action)
  220. return observation
  221. async def run(self, action: CmdRunAction) -> CmdOutputObservation:
  222. try:
  223. assert (
  224. action.timeout is not None
  225. ), f'Timeout argument is required for CmdRunAction: {action}'
  226. commands = split_bash_commands(action.command)
  227. all_output = ''
  228. for command in commands:
  229. output, exit_code = self._execute_bash(
  230. command,
  231. timeout=action.timeout,
  232. keep_prompt=action.keep_prompt,
  233. )
  234. if all_output:
  235. # previous output already exists with prompt "user@hostname:working_dir #""
  236. # we need to add the command to the previous output,
  237. # so model knows the following is the output of another action)
  238. all_output = all_output.rstrip() + ' ' + command + '\r\n'
  239. all_output += str(output) + '\r\n'
  240. if exit_code != 0:
  241. break
  242. return CmdOutputObservation(
  243. command_id=-1,
  244. content=all_output.rstrip('\r\n'),
  245. command=action.command,
  246. exit_code=exit_code,
  247. )
  248. except UnicodeDecodeError:
  249. raise RuntimeError('Command output could not be decoded as utf-8')
  250. async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
  251. if 'jupyter' in self.plugins:
  252. _jupyter_plugin: JupyterPlugin = self.plugins['jupyter'] # type: ignore
  253. # This is used to make AgentSkills in Jupyter aware of the
  254. # current working directory in Bash
  255. if self.pwd != getattr(self, '_jupyter_pwd', None):
  256. logger.debug(
  257. f"{self.pwd} != {getattr(self, '_jupyter_pwd', None)} -> reset Jupyter PWD"
  258. )
  259. reset_jupyter_pwd_code = f'import os; os.environ["JUPYTER_PWD"] = os.path.abspath("{self.pwd}")'
  260. _aux_action = IPythonRunCellAction(code=reset_jupyter_pwd_code)
  261. _reset_obs = await _jupyter_plugin.run(_aux_action)
  262. logger.debug(
  263. f'Changed working directory in IPython to: {self.pwd}. Output: {_reset_obs}'
  264. )
  265. self._jupyter_pwd = self.pwd
  266. obs: IPythonRunCellObservation = await _jupyter_plugin.run(action)
  267. return obs
  268. else:
  269. raise RuntimeError(
  270. 'JupyterRequirement not found. Unable to run IPython action.'
  271. )
  272. def _get_working_directory(self):
  273. # NOTE: this is part of initialization, so we hard code the timeout
  274. result, exit_code = self._execute_bash('pwd', timeout=60, keep_prompt=False)
  275. if exit_code != 0:
  276. raise RuntimeError('Failed to get working directory')
  277. return result.strip()
  278. def _resolve_path(self, path: str, working_dir: str) -> str:
  279. filepath = Path(path)
  280. if not filepath.is_absolute():
  281. return str(Path(working_dir) / filepath)
  282. return str(filepath)
  283. async def read(self, action: FileReadAction) -> Observation:
  284. # NOTE: the client code is running inside the sandbox,
  285. # so there's no need to check permission
  286. working_dir = self._get_working_directory()
  287. filepath = self._resolve_path(action.path, working_dir)
  288. try:
  289. with open(filepath, 'r', encoding='utf-8') as file:
  290. lines = read_lines(file.readlines(), action.start, action.end)
  291. except FileNotFoundError:
  292. return ErrorObservation(
  293. f'File not found: {filepath}. Your current working directory is {working_dir}.'
  294. )
  295. except UnicodeDecodeError:
  296. return ErrorObservation(f'File could not be decoded as utf-8: {filepath}.')
  297. except IsADirectoryError:
  298. return ErrorObservation(
  299. f'Path is a directory: {filepath}. You can only read files'
  300. )
  301. code_view = ''.join(lines)
  302. return FileReadObservation(path=filepath, content=code_view)
  303. async def write(self, action: FileWriteAction) -> Observation:
  304. working_dir = self._get_working_directory()
  305. filepath = self._resolve_path(action.path, working_dir)
  306. insert = action.content.split('\n')
  307. try:
  308. if not os.path.exists(os.path.dirname(filepath)):
  309. os.makedirs(os.path.dirname(filepath))
  310. file_exists = os.path.exists(filepath)
  311. if file_exists:
  312. file_stat = os.stat(filepath)
  313. else:
  314. file_stat = None
  315. mode = 'w' if not file_exists else 'r+'
  316. try:
  317. with open(filepath, mode, encoding='utf-8') as file:
  318. if mode != 'w':
  319. all_lines = file.readlines()
  320. new_file = insert_lines(
  321. insert, all_lines, action.start, action.end
  322. )
  323. else:
  324. new_file = [i + '\n' for i in insert]
  325. file.seek(0)
  326. file.writelines(new_file)
  327. file.truncate()
  328. # Handle file permissions
  329. if file_exists:
  330. assert file_stat is not None
  331. # restore the original file permissions if the file already exists
  332. os.chmod(filepath, file_stat.st_mode)
  333. os.chown(filepath, file_stat.st_uid, ROOT_GID)
  334. else:
  335. # set the new file permissions if the file is new
  336. os.chmod(filepath, 0o644)
  337. os.chown(filepath, self.user_id, ROOT_GID)
  338. except FileNotFoundError:
  339. return ErrorObservation(f'File not found: {filepath}')
  340. except IsADirectoryError:
  341. return ErrorObservation(
  342. f'Path is a directory: {filepath}. You can only write to files'
  343. )
  344. except UnicodeDecodeError:
  345. return ErrorObservation(
  346. f'File could not be decoded as utf-8: {filepath}'
  347. )
  348. except PermissionError:
  349. return ErrorObservation(f'Malformed paths not permitted: {filepath}')
  350. return FileWriteObservation(content='', path=filepath)
  351. async def browse(self, action: BrowseURLAction) -> Observation:
  352. return await browse(action, self.browser)
  353. async def browse_interactive(self, action: BrowseInteractiveAction) -> Observation:
  354. return await browse(action, self.browser)
  355. def close(self):
  356. self.shell.close()
  357. self.browser.close()
  358. if __name__ == '__main__':
  359. parser = argparse.ArgumentParser()
  360. parser.add_argument('port', type=int, help='Port to listen on')
  361. parser.add_argument('--working-dir', type=str, help='Working directory')
  362. parser.add_argument('--plugins', type=str, help='Plugins to initialize', nargs='+')
  363. parser.add_argument(
  364. '--username', type=str, help='User to run as', default='opendevin'
  365. )
  366. parser.add_argument('--user-id', type=int, help='User ID to run as', default=1000)
  367. parser.add_argument(
  368. '--browsergym-eval-env',
  369. type=str,
  370. help='BrowserGym environment used for browser evaluation',
  371. default=None,
  372. )
  373. # example: python client.py 8000 --working-dir /workspace --plugins JupyterRequirement
  374. args = parser.parse_args()
  375. plugins_to_load: list[Plugin] = []
  376. if args.plugins:
  377. for plugin in args.plugins:
  378. if plugin not in ALL_PLUGINS:
  379. raise ValueError(f'Plugin {plugin} not found')
  380. plugins_to_load.append(ALL_PLUGINS[plugin]()) # type: ignore
  381. client: RuntimeClient | None = None
  382. @asynccontextmanager
  383. async def lifespan(app: FastAPI):
  384. global client
  385. client = RuntimeClient(
  386. plugins_to_load,
  387. work_dir=args.working_dir,
  388. username=args.username,
  389. user_id=args.user_id,
  390. browsergym_eval_env=args.browsergym_eval_env,
  391. )
  392. await client.ainit()
  393. yield
  394. # Clean up & release the resources
  395. client.close()
  396. app = FastAPI(lifespan=lifespan)
  397. @app.middleware('http')
  398. async def one_request_at_a_time(request: Request, call_next):
  399. assert client is not None
  400. async with client.lock:
  401. response = await call_next(request)
  402. return response
  403. @app.post('/execute_action')
  404. async def execute_action(action_request: ActionRequest):
  405. assert client is not None
  406. try:
  407. action = event_from_dict(action_request.action)
  408. if not isinstance(action, Action):
  409. raise HTTPException(status_code=400, detail='Invalid action type')
  410. observation = await client.run_action(action)
  411. return event_to_dict(observation)
  412. except Exception as e:
  413. logger.error(f'Error processing command: {str(e)}')
  414. raise HTTPException(status_code=500, detail=str(e))
  415. @app.post('/upload_file')
  416. async def upload_file(
  417. file: UploadFile, destination: str = '/', recursive: bool = False
  418. ):
  419. assert client is not None
  420. try:
  421. # Ensure the destination directory exists
  422. if not os.path.isabs(destination):
  423. raise HTTPException(
  424. status_code=400, detail='Destination must be an absolute path'
  425. )
  426. full_dest_path = destination
  427. if not os.path.exists(full_dest_path):
  428. os.makedirs(full_dest_path, exist_ok=True)
  429. if recursive:
  430. # For recursive uploads, we expect a zip file
  431. if not file.filename.endswith('.zip'):
  432. raise HTTPException(
  433. status_code=400, detail='Recursive uploads must be zip files'
  434. )
  435. zip_path = os.path.join(full_dest_path, file.filename)
  436. with open(zip_path, 'wb') as buffer:
  437. shutil.copyfileobj(file.file, buffer)
  438. # Extract the zip file
  439. shutil.unpack_archive(zip_path, full_dest_path)
  440. os.remove(zip_path) # Remove the zip file after extraction
  441. logger.info(
  442. f'Uploaded file {file.filename} and extracted to {destination}'
  443. )
  444. else:
  445. # For single file uploads
  446. file_path = os.path.join(full_dest_path, file.filename)
  447. with open(file_path, 'wb') as buffer:
  448. shutil.copyfileobj(file.file, buffer)
  449. logger.info(f'Uploaded file {file.filename} to {destination}')
  450. return JSONResponse(
  451. content={
  452. 'filename': file.filename,
  453. 'destination': destination,
  454. 'recursive': recursive,
  455. },
  456. status_code=200,
  457. )
  458. except Exception as e:
  459. raise HTTPException(status_code=500, detail=str(e))
  460. @app.get('/alive')
  461. async def alive():
  462. return {'status': 'ok'}
  463. # ================================
  464. # File-specific operations for UI
  465. # ================================
  466. @app.post('/list_files')
  467. async def list_files(request: Request):
  468. """List files in the specified path.
  469. This function retrieves a list of files from the agent's runtime file store,
  470. excluding certain system and hidden files/directories.
  471. To list files:
  472. ```sh
  473. curl http://localhost:3000/api/list-files
  474. ```
  475. Args:
  476. request (Request): The incoming request object.
  477. path (str, optional): The path to list files from. Defaults to '/'.
  478. Returns:
  479. list: A list of file names in the specified path.
  480. Raises:
  481. HTTPException: If there's an error listing the files.
  482. """
  483. assert client is not None
  484. # get request as dict
  485. request_dict = await request.json()
  486. path = request_dict.get('path', None)
  487. # Get the full path of the requested directory
  488. if path is None:
  489. full_path = client.initial_pwd
  490. elif os.path.isabs(path):
  491. full_path = path
  492. else:
  493. full_path = os.path.join(client.initial_pwd, path)
  494. if not os.path.exists(full_path):
  495. return JSONResponse(
  496. content={'error': f'Directory {full_path} does not exist'},
  497. status_code=400,
  498. )
  499. try:
  500. # Check if the directory exists
  501. if not os.path.exists(full_path) or not os.path.isdir(full_path):
  502. return []
  503. # Check if .gitignore exists
  504. gitignore_path = os.path.join(full_path, '.gitignore')
  505. if os.path.exists(gitignore_path):
  506. # Use PathSpec to parse .gitignore
  507. with open(gitignore_path, 'r') as f:
  508. spec = PathSpec.from_lines(GitWildMatchPattern, f.readlines())
  509. else:
  510. # Fallback to default exclude list if .gitignore doesn't exist
  511. default_exclude = [
  512. '.git',
  513. '.DS_Store',
  514. '.svn',
  515. '.hg',
  516. '.idea',
  517. '.vscode',
  518. '.settings',
  519. '.pytest_cache',
  520. '__pycache__',
  521. 'node_modules',
  522. 'vendor',
  523. 'build',
  524. 'dist',
  525. 'bin',
  526. 'logs',
  527. 'log',
  528. 'tmp',
  529. 'temp',
  530. 'coverage',
  531. 'venv',
  532. 'env',
  533. ]
  534. spec = PathSpec.from_lines(GitWildMatchPattern, default_exclude)
  535. entries = os.listdir(full_path)
  536. # Filter entries using PathSpec
  537. filtered_entries = [
  538. os.path.join(full_path, entry)
  539. for entry in entries
  540. if not spec.match_file(os.path.relpath(entry, str(full_path)))
  541. ]
  542. # Separate directories and files
  543. directories = []
  544. files = []
  545. for entry in filtered_entries:
  546. # Remove leading slash and any parent directory components
  547. entry_relative = entry.lstrip('/').split('/')[-1]
  548. # Construct the full path by joining the base path with the relative entry path
  549. full_entry_path = os.path.join(full_path, entry_relative)
  550. if os.path.exists(full_entry_path):
  551. is_dir = os.path.isdir(full_entry_path)
  552. if is_dir:
  553. # add trailing slash to directories
  554. # required by FE to differentiate directories and files
  555. entry = entry.rstrip('/') + '/'
  556. directories.append(entry)
  557. else:
  558. files.append(entry)
  559. # Sort directories and files separately
  560. directories.sort(key=lambda s: s.lower())
  561. files.sort(key=lambda s: s.lower())
  562. # Combine sorted directories and files
  563. sorted_entries = directories + files
  564. return sorted_entries
  565. except Exception as e:
  566. logger.error(f'Error listing files: {e}', exc_info=True)
  567. return []
  568. logger.info(f'Starting action execution API on port {args.port}')
  569. print(f'Starting action execution API on port {args.port}')
  570. run(app, host='0.0.0.0', port=args.port)