For troubleshooting, add the global --debug option before a command. It enables
maximum log output and prints a full exception traceback when a command fails:
arkai --debug inference startarkai is a CLI for running AI agents with local models on your own hardware. It orchestrates three services β an OpenAI-compatible inference server (llama.cpp or optional MLX-LM), an MCP plugin server (wtmcp), and optionally an arapuca sandbox β so you can launch a fully configured agent session with a single command. Configuration is layered: user-level defaults, per-project overrides, and CLI flags.
When you run arkai agent start, it starts llama-server (loading your GGUF model), starts wtmcp (which exposes MCP tools to the agent over HTTP), then launches the agent binary configured to talk to both over localhost. Optionally it wraps the agent in an arapuca sandbox that restricts filesystem and network access. On exit, arkai tears down wtmcp β and optionally the inference server β unless --keep-mcp or --keep-inference are passed.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β arkai agent start β
β β
β ββββββββββββββββ HTTP/v1 βββββββββββββββββββ β
β β llama-serverβββββββββββββββ β β
β β (inference) β β agent binary β β
β ββββββββββββββββ β (opencode/crush β β
β β /claude) β β
β ββββββββββββββββ MCP/HTTP β β β
β β wtmcp βββββββββββββββ β β
β β (plugins) β βββββββββββββββββββ β
β ββββββββββββββββ β β
β ββββββββ΄βββββββ β
β β arapuca β β
β β (sandbox) β β
β βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Common development and CLI tools
Pythonpipgitshasumgrep,sed,bash(modern version)
External tools:
gitβ for downloading and updating Hugging Face model repositoriesllama.cpp(llama-serverandllama-quantize)mlx-lm(pip install -e '.[mlx]', optional; Apple Silicon)wtmcpβ for MCP tool integration with agents (optional)arapucaβ for sandboxed agent execution (optional)- Agent binary:
opencode,crush,claude, orpiβ at least one required
-
Clone the repository:
git clone https://github.com/yourusername/arkai.git cd arkai -
Create and activate a Python virtual environment:
python3 -m venv venv source venv/bin/activate -
Install the package:
pip install -e .For development tools (pytest, ruff, etc.):
pip install -e ".[dev]"
On Linux,
arapucais available as a Fedora package. On macOS,llama.cppandarapucaare available through Homebrew.
Download a model repository:
arkai model download hf:ibm-granite/granite-4.1-8b-GGUF
Start agent:
arkai agent start -m hf:ibm-granite/granite-4.1-8b-GGUF -a opencode
Install pi.dev and its standard MCP, web-access, and subagent packages:
arkai agent install pi
Run arkai agent install without a name to list installable agents. The command
warns that installation writes files to disk and requires confirmation.
It installs @earendil-works/pi-coding-agent, pi-mcp-adapter, pi-web-access,
and pi-subagents.
Pi is installed only for arkai under ~/.local/state/arkai/pi/; it is not added to
your global npm installation or shell PATH. Node.js and npm must be installed.
If you think you only live once (or don't have wtmcp or arapuca installed):
arkai agent start \
-m hf:ibm-granite/granite-4.1-8b-GGUF \
-a opencode \
--no-sandbox \
--no-mcp
Models are stored as GGUF files in ~/.local/share/arkai/models/. The
inference.model config key refers to the filename within that directory.
Named model profiles can be kept in the same configuration file. Set
inference.model to the profile name; its model value is started and its
sampling values are passed to the selected backend:
inference:
model: balanced
profiles:
fast:
model: hf:mlx-community/Llama-3.2-3B-Instruct-4bit
temperature: 0.2
top_k: 40
balanced:
model: granite-4.1-8b-instruct-Q6_K.gguf
temperature: 0.7
top_p: 0.9
min_p: 0.05
presence_penalty: 0.0
frequency_penalty: 0.0
repetition_penalty: 1.1arkai model download <provider>:<model-reference>Downloads the model into Arkai's local provider cache. Every download must use
an explicit provider, such as hf:owner/model or ollama:model:tag. Some
repositories contain files that llama.cpp can use directly; others must be
converted to GGUF before they can be loaded locally.
Large model repositories may require the repository's configured Git large-file
support (git lfs) to materialize the weight files.
arkai model download hf:ibm-granite/granite-4.1-8b-instruct-GGUF
arkai model download ollama:llama3.2:latestAfter downloading model, use the same provider-qualified reference for inference,
for example arkai agent start -m ollama:llama3.2:latest.
arkai model convert <provider>:<model-reference> [-q QUANTIZATION] [-o OUTPUT]Converts a cached provider model to GGUF format and places it in the models directory. Use this only when the downloaded repository is not already supported directly by llama.cpp.
| Flag | Default | Description |
|---|---|---|
-q/--quantization |
Q6_K |
Quantization level |
-o/--output |
~/.local/share/arkai/models/MODEL-QUANTIZATION.gguf |
Output path |
Common quantization levels: Q4_K_M (smaller, faster), Q5_K_M, Q6_K (near original inference quality).
arkai model convert hf:ibm-granite/granite-4.1-8b-instruct-GGUF -q Q6_Karkai model listShows locally converted and provider models in Arkai's model cache.
arkai model remove <model-name>Deletes a local GGUF file by filename (not full path).
arkai model remove granite-4.1-8b-instruct-Q6_K.ggufarkai inference manages the configured OpenAI-compatible inference server.
The server runs in the background and stays running between agent sessions.
arkai inference start [--model NAME] [--gpu-layers N] [--context N] [--port N]Starts llama-server on localhost:8081 (default). CLI flags override the
config values for that run only.
| Flag | Description |
|---|---|
--model NAME |
Override model from config |
--gpu-layers N |
Override number of GPU layers (-1 = all) |
--context N |
Override context window size in tokens |
--port N |
Override port from config |
Note: use
hf:org/modelas the model value to load a HuggingFace model.
GPU detection: arkai auto-detects Metal (Apple Silicon), CUDA (NVIDIA),
ROCm (AMD), or falls back to CPU. Setting gpu_layers: -1 in config offloads
all layers to GPU.
The inference server exposes an OpenAI-compatible API at http://127.0.0.1:<port>/v1.
Install the optional backend and select an MLX model from Hugging Face:
pip install -e '.[mlx]'
arkai model download hf:mlx-community/Llama-3.2-3B-Instruct-4bit
arkai inference start --model hf:mlx-community/Llama-3.2-3B-Instruct-4bitinference:
backend: mlx
model: hf:mlx-community/Llama-3.2-3B-Instruct-4bit
port: 8081Arkai resolves hf: models from its local provider cache before starting
MLX-LM, so the server does not download an already cached model. gpu_layers
and context_size are llama.cpp-specific settings and are not passed to MLX-LM.
arkai inference statusShows: running/stopped, PID, model, port, GPU layers, context size, health, and detected GPU type.
arkai inference stopTerminates the server and cleans up PID and state files.
arkai agent start is the primary command. It auto-starts the inference server if
not already running, starts wtmcp (unless --no-mcp), launches the agent, and
tears down services on exit.
arkai agent start [-a AGENT] [-m MODEL] [options]Supported agents: opencode, crush, claude
| Flag | Description |
|---|---|
-a/--agent AGENT |
Override agent from config |
-m/--model MODEL |
Override model from config |
--no-mcp |
Skip wtmcp entirely |
--no-sandbox |
Skip sandbox for this run |
-s/--sandbox PROFILE |
Use a specific sandbox profile for this run |
-I/--keep-inference |
Leave inference server running after exit |
-M/--keep-mcp |
Leave wtmcp running after exit |
-v/--volume PATH |
Mount extra volume in sandbox (repeatable) |
-e/--env KEY=VALUE |
Set env var in sandbox (repeatable) |
--cwd PATH |
Override directory mounted as cwd in sandbox |
Note: use
hf:org/modelas the model value to load a HuggingFace model.
On exit: wtmcp stops automatically. The inference server also stops unless
--keep-inference is passed. Use --keep-inference when you want the server
warm for the next session.
wtmcp is an MCP server that exposes tools (plugins) to the agent over HTTP.
arkai agent start manages wtmcp automatically, but you can also control it directly.
These commands edit .arkai.yaml in the current directory (must exist β run
arkai config init first):
arkai wtmcp enable <plugin> # add plugin to .arkai.yaml
arkai wtmcp disable <plugin> # remove plugin from .arkai.yamlwtmcp.plugins in .arkai.yaml is a list of plugin names:
- Key absent: inherit plugins from user config
plugins: []: explicitly disable all pluginsplugins: [workspace, terminal]: use only these plugins
arkai wtmcp list [--port N]Shows all discovered plugins with status:
- π’ enabled (in config and discovered by wtmcp)
- βͺ discovered but not enabled
- π΄ enabled but not discovered by wtmcp
Requires a running wtmcp instance. If multiple instances are running, specify --port.
arkai wtmcp start [--port N] [--enable PLUGIN] [--disable PLUGIN]
arkai wtmcp stop [--port N]
arkai wtmcp status [--port N]--enable/--disable on start override the project config plugins for that
run only. --port is required for stop and list when multiple instances
are running.
arkai can wrap agent execution in an arapuca sandbox. The sandbox restricts what the agent can access:
- Filesystem: only explicitly mounted paths are visible
- Network (Linux): only the inference server and wtmcp ports are reachable; all other network access is denied
- Network (macOS):
baselineseccomp profile is applied
The current working directory is mounted read-write by default (override path with
--cwd).
Named profiles are presets stored in your user config under
sandbox.profiles.<name>. When arkai agent start runs, it uses the active profile
(or the root sandbox defaults if no profile is active).
Profile names must be alphanumeric + underscores. The names default and
active are reserved.
# List all profiles and which is active
arkai sandbox list
# Show full details of a profile
arkai sandbox show <profile-name>
arkai sandbox show default # root sandbox defaults
arkai sandbox show active # currently active profile
# Create a profile
arkai sandbox create <name> [--from PROFILE] [--memory MB] [--cpus N] \
[--pids N] [--timeout S] [-v /path[:ro]] [-e KEY=VALUE]
# Delete a profile
arkai sandbox delete <name>
# Promote a profile's settings to root defaults
arkai sandbox set-default <name>
# Set the active profile (used by arkai agent)
arkai sandbox active <name>
# Clear the active profile (use root defaults)
arkai sandbox active# Create a restricted profile for untrusted code
arkai sandbox create restricted --memory 1024 --cpus 1 --pids 128
# Make it the active profile
arkai sandbox active restricted
# Run the agent (uses restricted profile automatically)
arkai agent start
# Override to a different profile for one run
arkai agent start -s devThese flags on arkai agent start override the active profile for that run only:
| Flag | Effect |
|---|---|
-s/--sandbox PROFILE |
Use a specific profile |
--no-sandbox |
Disable sandbox entirely |
-v/--volume PATH |
Add an extra volume mount |
-e/--env KEY=VALUE |
Add an env var inside the sandbox |
--cwd PATH |
Override cwd mounted in sandbox |
Configuration is YAML. Precedence (lowest to highest):
- Built-in defaults
- User config:
~/.config/arkai/arkai.yaml - Project config:
.arkai.yamlin current directory - CLI flags
arkai config init # scaffold .arkai.yaml in current directory
arkai config validate # validate .arkai.yaml
arkai config validate --file PATH # validate a specific file| Key | Type | Default | Description |
|---|---|---|---|
agent.name |
string | opencode |
Agent to use: opencode, crush, or claude |
agent.path |
string | (agent name) | Custom path to agent binary |
agent.mcp |
bool | true |
Whether to start wtmcp for agent sessions |
| Key | Type | Default | Description |
|---|---|---|---|
inference.model |
string | β | Local model filename, or hf:<repo> for a HuggingFace model |
inference.profiles |
mapping | β | Named model profiles; each profile has model and optional sampling settings |
inference.backend |
string | llama-cpp |
llama-cpp or optional mlx |
inference.path |
string | backend-dependent | Path to llama-server or mlx_lm.server |
inference.port |
int | 8081 |
Port for inference server (1024β65535) |
inference.gpu_layers |
int | -1 |
GPU layers to offload (-1 = all) |
inference.context_size |
int | 65536 |
Context window size in tokens |
inference.startup_timeout |
int | 600 |
Maximum seconds to wait for the server to become ready |
The sampling settings can also be placed directly under inference to provide
defaults for the selected model: temperature, top_p, top_k, min_p,
presence_penalty, frequency_penalty, and repetition_penalty. Profile values
override these defaults.
Model sampling settings are temperature, top_p, top_k, min_p,
presence_penalty, frequency_penalty, and repetition_penalty. They are
translated to the corresponding llama-server or mlx_lm.server CLI options.
Inference backends are registered command builders. The manager supplies the
common model, port, GPU-layer, and context settings, then handles the process
lifecycle and OpenAI-compatible REST API. Add a backend by implementing
InferenceBackend.build_command() and registering it with
register_backend().
| Key | Type | Default | Description |
|---|---|---|---|
wtmcp.path |
string | wtmcp |
Path to wtmcp binary |
wtmcp.port |
int | 8080 |
Port for wtmcp server (1024β65535) |
wtmcp.workdir |
string | β | Working directory for wtmcp |
wtmcp.plugins |
list | (inherit) | Plugin list; [] = disable all; absent = inherit from user config |
| Key | Type | Default | Description |
|---|---|---|---|
sandbox.enabled |
bool | true |
Enable sandboxing |
sandbox.path |
string | arapuca |
Path to arapuca binary |
sandbox.memory_mb |
int | 2048 |
Memory limit in MB |
sandbox.cpus |
int | 2 |
CPU count |
sandbox.pids |
int | 256 |
PID limit |
sandbox.timeout |
int | 0 |
Timeout in seconds (0 = no limit) |
sandbox.volume |
list | [] |
Extra volume mounts (/path or /path:ro) |
sandbox.environment |
map | β | Extra environment variables passed into sandbox |
sandbox.active_profile |
string | β | Name of the active sandbox profile |
sandbox.profiles.<name> |
map | β | Named sandbox profile (same keys as above) |
agent:
name: opencode
inference:
backend: llama-cpp
path: /usr/local/bin/llama-server
port: 8081
gpu_layers: -1
context_size: 65536
wtmcp:
path: /usr/local/bin/wtmcp
port: 8080
sandbox:
enabled: true
path: /usr/local/bin/arapuca
memory_mb: 2048
cpus: 2
pids: 256
timeout: 0inference:
model: granite-4.1-8b-instruct-Q6_K.gguf
wtmcp:
plugins: [workspace, terminal, github]Apache 2.0 β see LICENSE.