Skip to content

Installation ​

Requirements ​

  • Python 3.12+ — the package uses PEP 695 syntax and cannot import on older versions.
  • An OpenAI-compatible provider — base URL, API key and model name, given as environment variables or in the config file (see Configuration).
  • Docker — only for xunc / xunx.

Install the package ​

bash
pip install xun-agent          # installs xun, xuns, xunc, xunx, xune
playwright install             # only if you use the built-in browser tools

Point the agent at your provider:

bash
export XUN_OPENAI_BASE_URL="https://api.example.com/v1"
export XUN_OPENAI_API_KEY="..."
export XUN_OPENAI_MODEL="..."   # optional: auto-detected from the provider when empty

The same variables are read from a .env file in the working directory, which is the usual place for secrets.

Then start a session in the current directory:

bash
xun                              # interactive terminal session
xuns .                           # web service on http://localhost:18960
xuns --no-initial-agent          # web service without an LLM-backed agent

The web service prints its URL with an access token on startup; /docs/ serves this documentation when it has been packaged into the release.

Install from source ​

The web frontend is a Vue app that ships inside the package, so build it first:

bash
git clone https://github.com/MenxLi/xun.git
cd xun
make build-web      # cd web && npm i && npm run build  → src/xun/assets/web
pip install .       # build backend: uv_build

make test runs the unit test suite. The build only needs the src/xun tree; web/ builds the static assets that xuns serves at /chat/.

Build the Docker image ​

The image is the base of both xunc (single sandbox) and xunx (one container per user). It must be built from a repository checkout:

bash
make build-docker   # build-web, then docker build -t xun -f docker/Dockerfile .

This produces the image xun:latest. It is a single-stage ubuntu:noble image with a /venv virtualenv containing xun and its console scripts, plus Node (nvm), Rust, Chromium for Playwright, Git, LibreOffice and common CLI tools — a full working environment for an agent. Two paths matter: /workspace (the working directory) and /.xun (XUN_HOME inside the container).

bash
xunc                # ephemeral workspace inside the container
xunc .              # bind-mount the current directory as /workspace
xunc --copy .       # copy it into /workspace instead
xunc --exec "xun"   # run the terminal session instead of the web service

Host configuration is copied in

On xunc / xunx startup, config.json, extensions/ and skills/ are copied from the host XUN_HOME (default ./.xun) into /.xun. XUN_HOME itself is never forwarded.

This documentation site ​

Documentation is a VitePress project under docs/; npm run docs:build in that directory writes the bilingual static site to site/ at the repository root, and make doc-dist copies it into the package assets so that xuns can serve it at /docs/. See README-BUILD-DOCS.md for how the site is generated by an agent.

Xun 1.4.3 (source 5f35bd8, 2026-10-18) documentation, generated from the source tree.