factor_agent.web.app#

The frontend’s web service: JSON routes over run_view and the built page, on localhost only.

factor-agent-web <folder> serves the run directories under a folder on http://127.0.0.1:<port>. It binds the loopback interface and has no option to bind another: the pages show prompts, code and statistics and there is no login. On a server, forward the port over SSH.

Routes:

  • GET /api/runs: every run under the folder (list_runs), the latest written first;

  • GET /api/run?name=<name>: one run (RunView.read) by its name in the list, 404 for any other name;

  • GET /api/run/call?name=<name>&number=<number>: one LLM call of a run (read_call) by the number of its call file, 404 when the run has no call file of that number;

  • GET /api/run/files?name=<name>: the config of each start or resume of a run and its snapshot’s files (read_files), read only when the page shows them;

  • GET /api/run/ic?name=<name>&round=<round>&slot=<slot>: a trial’s daily IC and partial IC (read_ic), 404 when it was not evaluated or the run kept none;

  • GET /api/run/round?name=<name>&round=<round>: one round’s plan (read_round), its slots, quota and issues and its Trial graph with each node’s ranks, the round in progress included, 404 for a round neither written nor planned;

  • GET /api/run/version?name=<name>: a text that changes whenever the run writes (run_version), which the page polls before reading the run again;

  • GET /: the page, built from frontend/ into factor_agent/web/static.

FastAPI and uvicorn come with the web extra and are imported only when the app is made, so the module imports without them.

Functions

create_app

The web service over the run directories under root.

main

Serve the run directories under a folder on localhost: the factor-agent-web console script.