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 picked up from a .env file — each xun* command loads the nearest one in the working directory or any of its parents at startup, never overriding what you already exported. That 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, fixed by the image).

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 startup, config.json, extensions/ and skills/ are copied from the host XUN_HOME (default ~/.xun) into the container's /xun — for xunx, into that user's persistent home directory, which is what is mounted there. 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/. make doc-sync instead copies the site shipped in the published xun-agent wheel. See README-BUILD-DOCS.md for how the site is generated by an agent.

Xun 1.5.1 (source 88942ea, 2026-11-07) documentation, generated from the source tree.