aiui run app.py is the one entry point for an app. It imports app.py (under
aiui run app.py
app.py
the module name user_app, so an if __name__ == "__main__": block does not
user_app
if __name__ == "__main__":
run), reads what the module registered, and starts its own server on --host
--host
and --port.
--port
Run: aiui run app.py (opens the app shell, the aiui run default; use
app
aiui run
aiui run app.py --style chat for the classic chat UI)
aiui run app.py --style chat
Run: aiui run app.py (opens the default app shell; pass --style dashboard for the legacy vanilla-JS dashboard — see UI Styles). A module that builds its own app
--style dashboard
with create_app() and starts Uvicorn under if __name__ == "__main__": is not
create_app()
special-cased: aiui run ignores that app and serves its own. Run such a file
with python app.py instead.
python app.py
Run: aiui run app.py. An async main() together with an import of
main()
AIUIGateway from praisonaiui.integration switches to the praisonai
AIUIGateway
praisonaiui.integration
praisonai
backend. When the module defines main(), the CLI sets the PORT and HOST
PORT
HOST
environment variables from --port/--host (unless they are already set) and
calls your main(), so main() must read them to honour the CLI options, as
above. Without a main(), the CLI builds its own AIUIGateway on
--host/--port and registers the module's agent (or each item of
agent
agents). The backend needs the praisonai package
agents
(pip install "aiui[praisonai]").
pip install "aiui[praisonai]"
| app.py contains | Backend | Style |
|-------------------|---------|-------|
| async main() and from praisonaiui.integration import AIUIGateway | praisonai | as below |
from praisonaiui.integration import AIUIGateway
| anything else | standalone | detected from the callbacks |
standalone
Detection runs whenever --backend is standalone, which is also the
--backend
default, so passing --backend standalone does not turn it off. The style rules
--backend standalone
are in UI Styles.
--reload restarts the server when a file in the folder of app.py changes.
--reload