Built-in Session Entrypoints
Xun ships four console scripts (declared under [project.scripts] in pyproject.toml), one for each session shape. They differ only in where the agent runs and how it interacts with you; the core execution logic is exactly the same.
[project.scripts]
xun = "xun:main"
xuns = "xun:main_serve"
xunc = "xun:main_container"
xunx = "xun.supervisor:main"
The four entrypoints at a glance
| Command |
Shape |
Process location |
Interaction surface |
Typical scenario |
xun |
Terminal session |
current Python process |
terminal REPL (>>>) |
work with the agent in the current directory, editing code and writing docs |
xuns |
Web service |
current Python process |
browser chat UI + file panel |
you need browser tools, file upload/download, switching between sessions |
xunc |
Container session |
xuns inside a Docker container |
browser (port mapped to the host) |
you want an isolated environment, or the host has no Python environment |
xunx |
Multi-user shared service |
host orchestrator + one container per user |
browser (routed by username prefix) |
one server gives each person their own persistent environment |
Both xunc and xunx run xuns inside a container, so the four entrypoints really come down to two ways of running the agent (terminal, web) plus two deployment wrappers (single container, multi-user gateway).
flowchart LR
XUN["xun"] --> P1["current process<br/>terminal REPL"]
XUNS["xuns"] --> P2["current process<br/>browser UI"]
XUNC["xunc"] --> P3["one container<br/>runs xuns inside"]
XUNX["xunx"] --> P4["one container per user<br/>runs xuns inside"]
Parameters at a glance
Which one should I pick
flowchart TD
Q1{"need the browser UI?"} -->|no| XUN["xun<br/>terminal session"]
Q1 -->|yes| Q2{"need isolation?"}
Q2 -->|no| XUNS["xuns<br/>local web service"]
Q2 -->|yes| Q3{"shared by many users?"}
Q3 -->|no| XUNC["xunc<br/>single container"]
Q3 -->|yes| XUNX["xunx<br/>multi-user service"]
Mapping to the Python API
| Entrypoint |
Equivalent call |
xun |
setup_agent(name="agent", default_tools=True, default_commands=True, workdir=Path.cwd()) + interactive_session(agent, instruction) |
xuns |
web_session(workdir=..., host=..., port=..., token=..., base_path=..., manage_sessions=...) |
xunc |
runs xuns ... inside a container (see src/xun/entrypoint.py::main_container) |
xunx |
the xun.supervisor module: UserStore + DockerManager + Supervisor + Multiplexer |
When embedding Xun in your own program you can skip these scripts entirely and use setup_agent or Agent directly; see the API guide.