Spaces:
Runtime error
Runtime error
File size: 1,009 Bytes
290ff9e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """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()
|