Vision models
A model is optional. Scripted steps, browser and accessibility control, recipes and an outside agent run with none, and When you need a model lists what needs one. A vision model adds visual checks, clicks located on screen and the runtime’s own loop.
What the runtime asks
Section titled “What the runtime asks”One endpoint serves every model call. It can be any OpenAI-compatible chat-completions server, hosted or on your own hardware, for example llama.cpp’s llama-server. Gemma 4 is a model that works well, on a GPU.
| Job | What is sent | What comes back | Used by |
|---|---|---|---|
| Judging | A screenshot and a question | Whether the application rendered or shows an error, or whether an expectation holds, with a description | observe:, expect:, screen postconditions, screen.judge |
| Locating | A screenshot and a description of an element | Where the element is, or that it is not there | click_grounded, screen.ground |
| Tool calling | Text only: the goal, the tools and descriptions of the screen | One tool call per turn | goal: steps |
Judging and locating need a model that accepts images and places elements accurately. The loop needs tool calling from the server.
Screenshots go to the endpoint. A hosted model receives them, and a model on your own hardware keeps them inside your network.
Point the runtime at an endpoint
Section titled “Point the runtime at an endpoint”Set these where the runtime starts, which for a Kasm workspace is the session’s environment (see Enable the runtime on a workspace).
| Variable | Meaning |
|---|---|
KASM_RUNTIME_VISION_ENDPOINT |
The server’s base URL, ending in /v1 for most servers |
KASM_RUNTIME_VISION_MODEL |
The model name sent with each request. The default is qwen3-vl-4b |
KASM_RUNTIME_VISION_API_KEY |
A bearer token for a hosted API. It is never logged or written to a report |
The session must be able to reach the endpoint. Inside a session, 127.0.0.1 is the session container itself.
Capture geometry and answer convention
Section titled “Capture geometry and answer convention”Three more settings describe how a model sees the screen and how it answers when asked where something is. They describe the model, and the runtime does not infer them from its name.
| Setting | Variable | Values | Default |
|---|---|---|---|
| Capture geometry | KASM_RUNTIME_VISION_CAPTURE_GEOMETRY |
native sends the screenshot as captured. square-padded adds black bars to make it square, without resizing it |
native |
| Answer convention | KASM_RUNTIME_VISION_ANSWER_CONVENTION |
point asks for one point. box2d asks for a bounding box, y first, and clicks its centre |
point |
| Grounding scale | KASM_RUNTIME_VISION_GROUNDING_SCALE |
The range of the normalised coordinates the model answers in | 1000 |
Take the values from the model card. A model whose image encoder accepts images at their own shape wants native. One that resizes every image to a square wants square-padded, or the screenshot is squashed vertically and the y axis drifts. A model trained to output points wants point, and one trained for detection wants box2d.
A wrong setting raises no error. The model still answers and the runtime clicks in the wrong place. An unknown value stops the runtime with a configuration error. report.json records the values in force under agent.vision, and on every attempt to locate an element.
A position is only meaningful at the screen size it was produced for. With a vision endpoint set, a session is held at 1024×768 and the viewer cannot resize it. report.json records the actual size as screen. See Session geometry to change it.
Example: Gemma 4
Section titled “Example: Gemma 4”export KASM_RUNTIME_VISION_ENDPOINT=http://<model host>:8001/v1export KASM_RUNTIME_VISION_MODEL=gemma-4-12bexport KASM_RUNTIME_VISION_CAPTURE_GEOMETRY=square-paddedexport KASM_RUNTIME_VISION_ANSWER_CONVENTION=box2dOptional: to serve Gemma 4 yourself with llama-server, on a host with a GPU, put the key in a file so it stays out of the process list.
llama-server \ --model gemma-4-12b-it-UD-Q4_K_XL.gguf \ --mmproj mmproj-F16.gguf \ --alias gemma-4-12b \ --host 0.0.0.0 --port 8001 \ --api-key-file ./model-api-key \ --ctx-size 16384 --jinja \ --n-gpu-layers 99 --flash-attn on| Flag | Why the runtime needs it |
|---|---|
--mmproj |
The vision projector. Without it the model is text-only and every judgement fails |
--jinja |
Turns on tool calling. goal: steps need it. For a server whose tool calling is poor or absent, KASM_RUNTIME_FUNCTION_CALLING=injected puts the tools in the prompt instead |
--alias |
Makes the server advertise the name the runtime sends |
--host 0.0.0.0 |
The runtime connects from inside a container |
--ctx-size 16384 or more |
Screenshots are large and runs take many turns. An overflow returns HTTP 200 with empty content |
llama-server listens on every interface with this command, so keep it on a network your sessions share and use the key.
Checking a model
Section titled “Checking a model”- Thinking models spend tokens reasoning before they answer. If the reply cap is reached first,
llama-serverreturns HTTP 200 with empty content. The runtime sends a cap of 2000 tokens for judgements and locating by default (KASM_RUNTIME_MAX_TOKENS_JUDGE). - A hosted provider that shrinks a large screenshot before the model sees it changes where the model’s answers land, with no error.
- For a model you have not used before, set the geometry and convention its model card implies, then run a scenario with
grounding_audit: true. It scores the model’s answers against the control positions an application publishes over AT-SPI, and clicks nothing. - If the endpoint fails repeatedly, the runtime stops calling it and finishes the run on deterministic checks. See When you need a model.