Post

LLM Integration — Wired, Not Chatted

Run a local LLM with Ollama in your home automation — summarize sensor data, write alerts, and act on the results offline on your own hardware.

LLM Integration — Wired, Not Chatted
LLM settings screen

The Server.LLM node has been redesigned from the ground up. It no longer owns an interactive chat surface. Instead, it behaves like every other Krill node: a source fires it, it does its work, and it fans out to whatever is downstream.

Already using MCP + the Claude Code skill for agentic swarm control? See New Krill MCP Server Claude Skill. This post covers the in-swarm LLM transform node — a different tool for a different job.

The old model (retired)

The original LLM node summoned a chat UI on tap. While it was selected, every other node tap hijacked the context selector. The model received a structured planner JSON schema and was expected to CREATE_NODES, CREATE_LINKS, or UPDATE_NODE directly — bypassing verb dispatch entirely.

That model contradicted every Krill architectural rule, and we already have MCP + the Claude skill for agentic interaction. It’s gone.


The new model

The LLM node is now a transform node in a standard automation chain:

1
2
Cron (every 5 min)  ──►  LLM (summarize)  ──►  SMTP (email the summary)
Button (RESET)      ──►  LLM              (clears conversation history)

Every concept below is the same as for any other Krill executor. If you’ve read How Nodes, Verbs, and Sources Work, you already know the model.


Getting started

1. Install Ollama

On the machine running Krill Server, install Ollama:

1
2
3
curl -fsSL https://ollama.com/install.sh | sh
ollama pull gemma3:4b       # or any model that fits your hardware
ollama serve

2. Add an LLM node

In the Krill App, create a Server.LLM node under your server. In its Settings tab:

  • Ollama API Port — default 11434
  • Model — e.g. gemma3:4b
  • Prompt — the instruction sent on every EXECUTE fire, e.g. “Are the sensors healthy? Respond in one sentence.”
  • Nodes for Context — add any DataPoint or sensor nodes whose live state should be included in the prompt

Click Test Connection to confirm Ollama is reachable before wiring.

3. Wire sources

Go to the Sources tab of the LLM node. Add:

  • A Cron source (fires EXECUTE on schedule) to run inference automatically.
  • A Button source set to verb RESET to clear the conversation and re-seed the system message.

Set Invoked By to Source value changed. The LLM node responds to the verb of whichever source fires it.

4. Wire downstream consumers (optional)

Wire the LLM node as a source of an SMTP, outgoing webhook, or Lambda node. When inference succeeds, Krill fans out to every downstream node using the same verb the LLM received — the conversation reply rides in the SSE event stream.


How each fire works

First EXECUTE (empty chat):

  1. Server builds a system message: agent instructions + raw feature-contract JSON for every unique node type in “Nodes for Context”.
  2. Server appends a user message: your prompt + the live JSON state of every context node.
  3. Sends to Ollama, receives reply.
  4. Persists [system, user, assistant] in meta.chat.
  5. Emits an SSE LLM event carrying the assistant message.
  6. Sets NodeState.NONE and calls executeSources — downstream nodes wake.

Subsequent EXECUTEs (chat non-empty):

Steps 1–2 replay meta.chat verbatim (the feature contracts are already in chat[0]), then append a fresh user turn. The conversation accumulates context across fires.

RESET fire:

Clears meta.chat. Next EXECUTE re-seeds the system message. Useful after a model change or when context has drifted.

Ollama failure:

Sets NodeState.ERROR and records the error in meta.error. Does not call executeSources — the chain stops at the LLM. Fix Ollama, then fire again.


HardwareRecommended model
Raspberry Pi AI HAT (13 TOPS)gemma3:4b
8 GB VRAM GPUllama3.2:8b
24 GB VRAM GPUmistral-small3.2:24b
Multi-GPU serverqwen3:32b or larger

Pick the largest model your hardware can load and respond within your Cron interval. The LLM request timeout is 5 minutes.


Example chains

Daily sensor digest by email:

1
Cron (daily at 08:00)  ──►  LLM (summarize temps, humidity, power)  ──►  SMTP

On-demand query via Button:

1
2
Button (EXECUTE)  ──►  LLM (answer "is the tank level OK?")  ──►  outgoing webhook (Slack)
Button (RESET)    ──►  LLM                                     (clear history)

Alert enrichment:

1
HighThreshold trigger  ──►  LLM (explain the spike)  ──►  SMTP

What the LLM node will not do

  • It will not create, modify, link, or delete nodes. It observes and describes only.
  • It will not ask clarifying questions. The prompt should be self-contained.
  • It does not expose a chat UI. Conversation is a side-effect of repeated source fires, not a user interaction surface.

For agentic swarm control — creating nodes, building automation chains, running diagnostics interactively — use the Krill MCP skill with Claude.


We’re curious what you’re building. File feedback at krill-oss issues.


Last verified: 2026-05-21

This post is licensed under CC BY 4.0 by Sautner Studio, LLC.