Start or restart a project's app
start_appStart a project's app and keep it running: the step that puts a project online after its files are written. Runs command in the project folder as a background process with PORT set to the project's routed port (the app must listen on PORT), records it so it comes back after a restart, and waits up to about 10 seconds for the port to answer. Calling it again with the same name restarts it, which is how you pick up changed code. Returns whether the app is answering, its log tail, and the URL. A project's URL serves only while its visibility is public, so set that with update_project when the app should be reachable. For static files, put them under public/ and serve that folder, e.g. "python3 -m http.server $PORT --bind 0.0.0.0 --directory public". Never serve the project folder itself, which holds the project's secrets in .server4agent/env.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional, default "web": the app the URL serves. Give a second process (a worker, a queue consumer) its own name so starting it leaves the web app alone. Lowercase letters, digits, - and _. | |
| command | Yes | What starts the app, run from the project folder, e.g. `node server.js` or `npm start`. It must stay in the foreground (no trailing &) and listen on $PORT. | |
| project_id | Yes | The project's id, as returned by create_project or list_projects. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Public URL. null while the project is private. | |
| name | No | The app's name. web is the one the URL serves. | |
| notes | No | Anything worth acting on, e.g. the project is private. | |
| access | No | Who may open the URL once it is public. | |
| status | Yes | running = answering (or not a server). starting = not answering yet. | |
| log_tail | No | The end of the app's log. | |
| listening | Yes | Whether something answered on the port. | |
| project_id | Yes | The project. | |
| visibility | No | The project's visibility. | |
| listen_port | No | The port the app has to listen on. | |
| restart_command | No | The line recorded so the app comes back after a restart. | |
| replaced_previous | No | Whether a running copy was stopped and replaced. |