Skip to main content

Kapela CLI

A CLI for querying enterprise knowledge from Kapela. Includes an interactive chat TUI for humans and non-interactive commands for AI agents and scripts.

Installation

pip install kapela-cli

Or with uv:

uv pip install kapela-cli

Setup

Run the interactive chat TUI — on first launch it will guide you through setup:

kapela-cli chat

This prompts for your Kapela server URL and personal access token (PAT), tests the connection, and saves config to ~/.config/kapela-cli/config.json (or $XDG_CONFIG_HOME/kapela-cli/config.json if set). To reconfigure later, use the /configure command inside the TUI.

Environment variables override config file values:

Variable Required Description
KAPELA_SERVER_URL No Server URL
KAPELA_PAT No Personal access token for authentication (required if no config file)
KAPELA_PERSONA_ID No Default agent/persona ID
KAPELA_STREAM_MARKDOWN No Enable/disable progressive markdown rendering (true/false)
KAPELA_SSH_HOST_KEY No Path to SSH host key for serve command

Usage

Interactive chat

kapela-cli chat
kapela-cli chat --no-stream-markdown
Flag Description
--no-stream-markdown Disable progressive markdown rendering during streaming

One-shot question

kapela-cli ask "What is our company's PTO policy?"
kapela-cli ask --agent-id 5 "Summarize this topic"
kapela-cli ask --json "Hello"
Flag Description
--agent-id <int> Agent ID to use (overrides default)
--json Output NDJSON stream events instead of plain text
--prompt <string> Question text (use with piped stdin context)
--quiet Buffer output and print once at end
--max-output <int> Max bytes before truncating (0 to disable)

List agents

kapela-cli agents
kapela-cli agents --json

Serve over SSH

# Start a public SSH endpoint for the CLI TUI
kapela-cli serve --host 0.0.0.0 --port 2222

# Connect as a client
ssh your-host -p 2222

Clients can either:

  • paste a personal access token (PAT) at the login prompt, or
  • skip the prompt by sending KAPELA_PAT over SSH:
export KAPELA_PAT=your-pat
ssh -o SendEnv=KAPELA_PAT your-host -p 2222

Useful hardening flags:

  • --host-key (default ~/.config/kapela-cli/host_ed25519)
  • --idle-timeout (default 15m)
  • --max-session-timeout (default 8h)
  • --rate-limit-per-minute (default 20)
  • --rate-limit-burst (default 40)
  • --rate-limit-cache (default 4096)

Commands

Command Mode Description
chat Interactive Launch the interactive chat TUI (requires terminal)
ask Agent / Script Ask a question and print the answer to stdout
agents Agent / Script List available agents (ID, name, description)
validate-config Agent / Script Check CLI configuration and server connectivity
install-skill Agent / Script Install the Kapela CLI agent skill file
experiments Agent / Script List experimental features and their status
serve Interactive Serve the Kapela TUI over SSH

Global Flags

Flag Description
--version, -v Print client and server version information
--debug Run in debug mode (verbose logging)

Agent / Non-Interactive Use

When called without a TTY (e.g., by an AI agent or piped into another command), kapela-cli adjusts its behavior:

  • No subcommand: prints help and exits 0 (instead of launching the TUI)
  • Results to stdout, progress/errors to stderr
  • No ANSI codes or interactive prompts
  • ask output truncated to 50000 bytes by default; full response saved to a temp file. Use --max-output 0 to disable.

Configuration

If a human has already run kapela-cli chat (which includes first-time setup), the CLI works out of the box — no additional setup needed. Environment variables can override the config file or serve as an alternative when no config file exists:

export KAPELA_SERVER_URL="https://your-kapela-server.com"
export KAPELA_PAT="your-pat"

Exit Codes

Code Name When
0 Success Command completed
1 General Unknown error
2 BadRequest Invalid arguments
3 NotConfigured Missing config/PAT
4 AuthFailure Invalid PAT (401/403)
5 Unreachable Server unreachable
6 RateLimited Server returned 429
7 Timeout Request timed out
8 ServerError Server returned 5xx
9 NotAvailable Feature/endpoint doesn't exist

Skill File

Install the bundled SKILL.md so AI coding agents can discover the CLI:

kapela-cli install-skill
kapela-cli install-skill --global
kapela-cli install-skill --copy
kapela-cli install-skill --agent claude-code
Flag Description
--global, -g Install to home directory instead of project
--copy Copy files instead of symlinking
--agent, -a Target specific agents (e.g. claude-code; can be repeated)

Slash Commands (in TUI)

Command Description
/help Show help message
/clear Clear chat and start a new session
/agent List and switch agents
/attach <path> Attach a file to next message
/sessions List recent chat sessions
/configure Re-run connection setup
/connectors Open connectors in browser
/settings Open settings in browser
/quit Exit Kapela CLI

Keyboard Shortcuts

Key Action
Enter Send message
Escape Cancel current generation
Ctrl+O Toggle source citations
Ctrl+D Quit (press twice)
Scroll / Shift+Up/Down Scroll chat history
Page Up / Page Down Scroll half page

Building from Source

Requires Go 1.24+.

cd cli
go build -o kapela-cli .

Development

# Run tests
go test ./...

# Build
go build -o kapela-cli .

# Lint
golangci-lint run ./...

Publishing to PyPI

The CLI is distributed as a Python package via PyPI. The build system uses hatchling with manygo to cross-compile Go binaries into platform-specific wheels.

Tag a release and push — the release-cli.yml workflow builds wheels for all platforms and publishes to PyPI automatically:

tag --prefix cli

To do this manually:

git tag cli/v0.1.0
git push origin cli/v0.1.0

The workflow builds wheels for: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, windows/amd64, windows/arm64.

Manual release

Build a wheel locally with uv. Set GOOS and GOARCH to cross-compile for other platforms (Go handles this natively — no cross-compiler needed):

# Build for current platform
uv build --wheel

# Cross-compile for a different platform
GOOS=linux GOARCH=amd64 uv build --wheel

# Upload to PyPI
uv publish

Versioning

Versions are derived from git tags with the cli/ prefix (e.g. cli/v0.1.0). The tag is parsed by internal/_version.py and injected into the Go binary via -ldflags at build time.

Metadata

Release files for kapela-cli 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for kapela-cli 0.1.1
File
kapela_cli-0.1.1-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
kapela_cli-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
kapela_cli-0.1.1-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
kapela_cli-0.1.1-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
kapela_cli-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
kapela_cli-0.1.1-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 36.1 MB

Release files / kapela_cli-0.1.1-py3-none-win_arm64.whl

Download URL kapela_cli-0.1.1-py3-none-win_arm64.whl
Size 5.7 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
b17c50129cd439133c0d625cdd4bec53d1b3e8f4393fb565d00504267d7e7774
BLAKE2b-256 checksum
How to use checksums
28f712e77de3449dc1d18f219ccd95c0910275f49bc2f97dba9770a560f2e83f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kapela_cli-0.1.1-py3-none-win_amd64.whl

Download URL kapela_cli-0.1.1-py3-none-win_amd64.whl
Size 6.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
7d800583d2d4ae759d7e0f6e78a04a1ece1d981528d388187f934c3d27dc53aa
BLAKE2b-256 checksum
How to use checksums
0216f7f3d8cde17574bfca5648c83377860e10ac977c8ae3aa1b163efacd7ee9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kapela_cli-0.1.1-py3-none-manylinux_2_17_x86_64.whl

Download URL kapela_cli-0.1.1-py3-none-manylinux_2_17_x86_64.whl
Size 6.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
bad0cc3818fb3908506625678a2503a7314a3156a8d08a573e6e8092d27c644c
BLAKE2b-256 checksum
How to use checksums
f450877894abbef15163d76ffd98a9626e693e11c3d30b45dab4b76c34a28555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kapela_cli-0.1.1-py3-none-manylinux_2_17_aarch64.whl

Download URL kapela_cli-0.1.1-py3-none-manylinux_2_17_aarch64.whl
Size 5.6 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
91a6ff093f1b1a5425db473b19b76366e2e7b441edfd8f433a310dfb36851b69
BLAKE2b-256 checksum
How to use checksums
b80aa1355bab0272f35c426fcef32034592a29f06f652ebcee39dc12d9c06835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kapela_cli-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL kapela_cli-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 5.9 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b81837f79e251a018aa7ac702fe3d3ef8f1d6e5ec0a55a19637891d840006087
BLAKE2b-256 checksum
How to use checksums
b08a3aa583123bec7af677962ec38580f4eb1252db0419a0bb6e2a21041272bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kapela_cli-0.1.1-py3-none-macosx_10_12_x86_64.whl

Download URL kapela_cli-0.1.1-py3-none-macosx_10_12_x86_64.whl
Size 6.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
db8a1b5bb1eee15506f84afc261f1d2b7bf3069e67dc648aca996f8c3c9c5d76
BLAKE2b-256 checksum
How to use checksums
fc11fbca5b3fb7042b70aa895d739bf9dcc6a8640cb6a422fb49a218b126649a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.1 This release

6 release files

0.1.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page