React + TypeScript, built with Vite. Routing is React Router, data fetching is SWR, components are Ant Design styled with Emotion, and the UI is extensible through named extension points — see docs/app-extensions.md.
Node is pinned in .nvmrc; Yarn ships via corepack.
By default, the UI connects to a live backend. Run the following commands from
the ui directory:
yarn installThe quickest way from nothing to this app running on real data is
scripts/setup-cluster. One command builds a Kind
cluster, installs this checkout on it, and leaves an agent there to talk to:
../scripts/setup-cluster/setup-cluster.sh # ~20 min, mostly image buildsIt ends by holding two port-forwards open — the UI on 8080 and the controller on
8083 — so the dev server needs no configuration at all. Keep that terminal
running. In another terminal, from the ui directory, start the dev server:
yarn dev # http://localhost:8001For any other way of getting kagent running — an existing cluster, a different install — see DEVELOPMENT.md, and forward the controller yourself:
kubectl -n kagent port-forward svc/kagent-controller 8083:8083Either way 8083 is where the proxy looks, so neither case needs a .env entry. Two
settings change that when you want them to: KAGENT_UI_DEV_CONTROLLER_URL=http://127.0.0.1:8080
sends the proxy through the UI pod's nginx instead, which is the hop a deployed build
takes; and KAGENT_UI_API_BASE_URL calls a backend directly, bypassing the proxy.
Which backend is serving is decided in exactly one place, src/api/config.ts.
Nothing above the data layer knows or cares.
To use the in-browser mock backend, start the dev server with mock mode enabled. No cluster is required.
KAGENT_UI_ENABLE_MOCK=true yarn dev # http://localhost:8001To keep mock mode enabled across runs, copy .env.example to
.env and uncomment KAGENT_UI_ENABLE_MOCK=true.
With mock mode enabled, append ?mock=<scenario> to any route to force a state
that is otherwise hard to reach by hand:
| Scenario | Effect |
|---|---|
ok |
normal data (the default) |
empty |
every collection comes back empty |
error |
requests fail, so error handling is visible |
slow |
responses are delayed, so loading states are visible |
The choice persists across in-app navigation, e.g. /agents?mock=error.
To return to a live backend, stop the dev server and unset KAGENT_UI_ENABLE_MOCK
or set it to false in your shell and .env, then start it a
457A
gain with yarn dev.
Settings an operator configures per deployment cannot travel in the bundle — the
bundler inlines import.meta.env at build time, which would freeze the chart's
values as of the image build. They arrive on window.environmentVariables
instead, rendered from the pod's environment by the entrypoint/ program on every start
and loaded by a script tag ahead of the app, so they are readable synchronously
by the first module that runs. src/env.ts lists them; .env.example documents
setting them locally.
That synchronous delivery is load-bearing rather than incidental: the API base URL is a module-level constant, so there is no point early enough for an awaited fetch to have landed.
| Setting | Effect |
|---|---|
KAGENT_UI_API_BASE_URL |
where the browser calls the API (default /api) |
KAGENT_UI_ENABLE_MOCK |
true serves the whole API from in-browser fixtures |
KAGENT_UI_SSO_REDIRECT_PATH |
where "Sign in with SSO" sends the browser |
KAGENT_UI_STREAM_TIMEOUT_MS |
chat stream inactivity timeout |
KAGENT_UI_ENABLE_MOCK is a development setting. The release image deliberately ships no
mock backend, so a built bundle logs a warning and uses the real API rather than
entering a mode it cannot serve.
yarn typecheck # tsc
yarn lint # eslint
yarn test # unit tests (vitest)
yarn test:pw # end-to-end tests (playwright)The end-to-end suite runs against the mock backend and needs no cluster, no port-forward, and no provider credentials. See playwright/README.md, and playwright/DEFERRED.md for coverage not yet ported.
| Path | Contents |
|---|---|
src/api/ |
data layer — typed domain models, SWR hooks, the chat client interface |
src/mocks/ |
in-browser mock backend and its fixtures |
src/pages/ |
one module per route |
src/components/Structure/ |
app shell — header, sidebar, page frame |
src/appExtensions/ |
extension framework, and a worked example |
src/theme/ |
design tokens, in one place so styling can be overridden |
playwright/ |
end-to-end suite |