Local LLM Agent Runbook
Use this runbook when an operator asks an AI coding agent to start a local llama.cpp or Ollama model, connect it to DKG, and prove that DKG tool use works. The agent must not report the setup as ready until the DKG daemon, model endpoint, Query Catalog policy, and smoke tests have all been checked.
For architecture, troubleshooting, and benchmark details, see Run a Local LLM with DKG.
Select the backend
Keep the operator's explicit choice. If no backend is named, use llama.cpp as the reference server. Ollama is a supported alternative, not a replacement for llama.cpp.
llama.cpp
http://127.0.0.1:8080/v1/chat/completions
/v1/models, with /health fallback
qwen3-8b-q4-k-m
Ollama
http://127.0.0.1:11434/v1/chat/completions
/v1/models
qwen3:8b
Install the default llama.cpp server
llama-server from llama.cpp is the default local inference server for this runbook. This selects the runtime, not the model family: the same server runs the recommended Qwen GGUF model.
An agent must detect the operating system, execute the corresponding install, resolve the absolute executable path, and verify it before continuing.
macOS
Use the upstream Homebrew package:
brew install llama.cpp
export LLAMA_SERVER="$(command -v llama-server)"
"$LLAMA_SERVER" --versionIf Homebrew is unavailable, install it first or use the source-build procedure in the full local LLM guide. Metal acceleration is enabled by default in upstream macOS builds.
Linux
If Conda is already available, use the official conda-forge package:
On Ubuntu or Debian without Conda, build the server from source:
For an NVIDIA build, install the CUDA toolkit and configure with -DGGML_CUDA=ON; see the full Linux instructions.
Windows
Open PowerShell and install the upstream Winget package:
Open a new PowerShell so PATH is refreshed, then resolve and verify the executable:
If Winget is unavailable or a custom CUDA build is required, use the Visual Studio or release-binary procedure in the full Windows instructions.
Do not silently change the selected backend. llama.cpp and Ollama are supported; any other runtime requires an explicit operator choice and must pass the same OpenAI-compatible contract and DKG smoke tests.
Install Ollama when selected
Complete the full guide's canonical Install and run Ollama procedure. That single section owns installation, desktop/terminal/systemd server ownership, the minimum context, model loading, and readiness checks. Record the resolved executable, version, selected model tag, ollama ps context, and exact /v1/models match as agent evidence; do not restate or vary the policy here.
Model decision table
Model
llama-server model selector
dkg llm --model value
Real-DKG score
Use
Qwen3-8B Q4_K_M
-hf Qwen/Qwen3-8B-GGUF:Q4_K_M
qwen3-8b-q4-k-m
13/13
Default. Best tested balance for chat, catalog queries, reads, and bounded writes
Bonsai-8B Q1_0
-hf prism-ml/Bonsai-8B-gguf:Q1_0
bonsai-8b-q1
8/13
Low-memory experiment. A generated and validated Query Catalog is mandatory; expose only catalog tools for domain reads
Qwen3.8-27B UD-IQ1_M
Download Qwen3.8-27B-UD-IQ1_M.gguf from unsloth/Qwen3.8-27B-GGUF, then use -m
qwen3.8-27b-iq1
9/13
Not recommended on 16 GB. Slow and memory-heavy; catalog-first is mandatory
The score is from the repository's 13-scenario real-DKG benchmark on the reference 16 GB Apple Silicon machine using llama.cpp. It is comparative evidence, not an Ollama parity claim or universal hardware guarantee. An Ollama model/server combination must pass the smoke test and benchmark independently.
Instruction to give an AI coding agent
Copy the following block into the coding agent's task. Replace values in angle brackets, but keep the order and completion checks.
Exact launch commands
For a source checkout, build the required runtime once:
Then use node packages/cli/dist/cli.js in place of dkg in the commands below. Set DKG_HOME explicitly when the source checkout must use a non-default node home.
llama.cpp reference launch
Set values once in the shell running the client:
Start the recommended model in a dedicated terminal:
After the health check, start the normal read-only chat:
Ollama launch
Complete the canonical Install and run Ollama procedure first. It is the sole source for installation, context ownership, and readiness. Once that procedure passes, start the read-only DKG chat against the verified server:
For Node UI, export those endpoint and model values as DKG_LLM_URL and DKG_LLM_MODEL, and set DKG_LLM_BACKEND=ollama, in the daemon environment before starting or restarting DKG.
For an explicitly approved Query Catalog build, use the recommended Qwen llama.cpp server and temporarily start this client:
Give it the domain schema and query requirements, then ask it to validate one parameterized, read-only query at a time and save it with dkg_query_catalog_save. Exit this session after the reviewed catalog entries have been saved and independently run through dkg query-catalog run.
For Bonsai Q1_0, first complete the Query Catalog gate above, then replace the model server command with:
Restrict the final Q1 chat to catalog reads:
The 27B 1-bit experiment is not recommended on a 16 GB machine. If the operator explicitly requests it, download and launch it with one slot and no vision projector:
After its catalog gate and health check, start it with:
Use --allow-write only for an approved catalog-build turn. The end-user demo must return to the read-only command above.
Last updated
Was this helpful?