Spaces:
Runtime error
Runtime error
| """Local dev launcher for the ergo-agentic FastAPI server. | |
| Usage: | |
| uv run python scripts/run_server.py | |
| PORT=9000 uv run python scripts/run_server.py | |
| Picks a per-worktree port automatically when running inside a Conductor | |
| worktree (so multiple worktrees can serve in parallel). Exporting ``PORT`` | |
| overrides this. | |
| For production, run uvicorn directly: | |
| uv run uvicorn ergo_agentic.server:app --host 0.0.0.0 --port 8000 --workers 4 | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| from pathlib import Path | |
| import uvicorn | |
| sys.path.insert(0, str(Path(__file__).parent)) | |
| from _ports import server_port # noqa: E402 | |
| def main() -> None: | |
| port = server_port() | |
| print(f"[run_server] http://127.0.0.1:{port}") | |
| uvicorn.run( | |
| "ergo_agentic.server:app", | |
| host=os.environ.get("HOST", "127.0.0.1"), | |
| port=port, | |
| reload=os.environ.get("RELOAD", "true").lower() == "true", | |
| ) | |
| if __name__ == "__main__": | |
| main() | |