# How do I run the defender on my own model?

> Assign the defender's jobs to a runner on your own machine, give it a model you host, and check that it is the one doing the work. Golem then makes no model call for you.

By default Golem runs the defender's agents for you, on the model you choose. You can run them yourself instead: a **runner** on your own machine asks Golem for each job's work, does it with a model you host, and records the answer. Conversations are then read on your machine by your model, and Golem makes no model call for your workspace.

This page sets that up from start to finish with a model served by [Ollama](https://ollama.com). The same steps work for any server that speaks the OpenAI chat-completions API, and for Anthropic or Google Vertex AI on your own account.

## What you need

- A workspace owner or admin, for the console steps.
- A machine that stays on, with Docker, that can reach Golem over HTTPS.
- A model server that machine can reach. For Ollama on the same machine:

  ```
  ollama pull qwen3:8b
  printf 'FROM qwen3:8b\nPARAMETER num_ctx 32768\n' > Modelfile
  ollama create qwen3-8b-32k -f Modelfile
  curl http://localhost:11434/v1/models
  ```

  The last command must list `qwen3-8b-32k:latest`. If it does not, fix that first: the runner cannot do better than this request.

  The two middle lines matter. Ollama gives a model 4,096 tokens of context unless told otherwise and cuts a longer prompt short without an error. What the runner sends for one conversation runs from 4,000 to 14,000 tokens, so on the default the model never sees most of it and every read fails. The copy made here has room for 32,768.

A small local model reads less carefully than a large hosted one. Start with one to prove the setup, then decide which model you trust with the work.

## 1. Turn Triage on

In the console, open **Defender** and turn **Triage** on. Nothing is read until it is on, whoever runs it.

## 2. Take the jobs

Open **Settings**, top right on the Defender page. Under **Who runs each job**, every job starts as **Golem**. Choose **All mine** and confirm.

Golem stops doing those jobs at once: its own agents are refused on their next pass and their keys in your workspace are revoked. Until your runner starts, nobody is doing them.

Two things to know before you take jobs one at a time instead:

- The triage reader and the investigator share one identity, so they move together.
- Golem does the payload reader's, supervisor's, definition scanner's and threat intelligence's work only where it also runs the triage reader. If you take the triage reader you take those with it, which is what **All mine** does.

> [!WARNING]
> No runner can do **Threat intelligence** yet. While that job is yours, the defender's indicator lookups do not run. If you depend on them, leave every job with Golem for now and use your own model through **Model** in the same sheet instead.

## 3. Mint the runner key

In the same sheet, under **Your own runner**, choose **Set up**. Turn on **A model on this machine**, then choose **Mint the runner key**.

The dialog shows two things. Copy both before you close it, because the key is shown once.

The first is a file. Save it as `analyst-workspaces.json` on the runner's machine:

```
[{"customer_id": "<your workspace id>",
  "workspace_key": "glk_<your runner key>"}]
```

A runner key is the runner's only credential. It enrolls the runner as the defender's jobs in your workspace and as nothing else, and you can revoke it in **Deploy**, under **Install**, like any other key. Keep the file readable only by the account that runs Docker.

## 4. Start the runner

The second thing the dialog shows is the command. Run it in the directory that holds the file:

```
docker run -d --name golem-analyst-worker \
  --add-host=host.docker.internal:host-gateway \
  -v ./analyst-workspaces.json:/etc/golem/analyst-workspaces.json:ro \
  -v golem-analyst-keys:/var/lib/golem/analyst-keys \
  -e GOLEM_ANALYST_ENABLED=true \
  -e GOLEM_ANALYST_WORKSPACES_FILE=/etc/golem/analyst-workspaces.json \
  -e GOLEM_ANALYST_KEY_DIR=/var/lib/golem/analyst-keys \
  -e GOLEM_ANALYST_INGEST_URL=https://ingest.golem.team \
  -e GOLEM_ANALYST_CORE_API_URL=https://relay.golem.team \
  -e GOLEM_ANALYST_CONTEXT_MCP_URL=https://context.golem.team/defender \
  -e GOLEM_ANALYST_TOKEN_URL=https://app.golem.team/oauth/token \
  -e GOLEM_RUNNER_MODEL_PROVIDER=openai_compatible \
  -e GOLEM_RUNNER_MODEL_ENDPOINT=http://host.docker.internal:11434/v1 \
  -e GOLEM_RUNNER_MODEL=qwen3-8b-32k:latest \
  ghcr.io/golemteam/golem-defender-runner:latest
```

What the lines you may need to change mean:

| Line | What it is |
|---|---|
| `--add-host=host.docker.internal:host-gateway` | Lets the container reach a model server on the machine it runs on. Needed on Linux; harmless elsewhere. |
| `golem-analyst-keys` volume | Where the runner keeps the signing keys it enrolls with. Keep it across restarts, or the runner enrolls again as new. |
| `GOLEM_ANALYST_CORE_API_URL` | Golem's relay, which passes the runner's requests on to Golem. On Golem's hosted service it is `https://relay.golem.team`. |
| `GOLEM_RUNNER_MODEL_ENDPOINT` | Your model server's `/v1` address, as the container sees it. |
| `GOLEM_RUNNER_MODEL` | The model's name exactly as your server lists it. |

The command the dialog prints differs from this one in two ways:

- It names `qwen3:8b`. Change that to the copy you made, `qwen3-8b-32k:latest`.
- It also sets `GOLEM_ANALYST_RELAY_URL` and `GOLEM_ANALYST_DEEP_READ_ENABLED=true`. Those are for the payload reader, which reads whole transcripts out of your own storage through your relay. Leave both out to start, as above. Until you add them the supervisor cannot finish a case that needs a transcript read: its log says `payload tier is not wired` for those, and it works the rest.

### A different model

Set these on the runner in place of the three `GOLEM_RUNNER_MODEL` lines above:

| Your model | Settings |
|---|---|
| Any OpenAI-compatible server (vLLM, LM Studio, Open WebUI, OpenAI) | `GOLEM_RUNNER_MODEL_PROVIDER=openai_compatible`, `GOLEM_RUNNER_MODEL_ENDPOINT=<its /v1 address>`, `GOLEM_RUNNER_MODEL=<model>`, and `GOLEM_RUNNER_MODEL_KEY_FILE=<path>` if it needs a key |
| Anthropic | `GOLEM_RUNNER_MODEL_PROVIDER=anthropic`, `GOLEM_RUNNER_MODEL=<model id>`, `GOLEM_RUNNER_MODEL_KEY_FILE=<path to a file holding your API key>` |
| Google Vertex AI | `GOLEM_RUNNER_MODEL_PROVIDER=vertex`, `GOLEM_RUNNER_MODEL=<model>`, `GOLEM_RUNNER_MODEL_PROJECT=<project>`, `GOLEM_RUNNER_MODEL_LOCATION=<location>`, `GOLEM_RUNNER_MODEL_KEY_FILE=<path to the service-account JSON>` |

A key file is a path inside the container, so mount it with another `-v` line. To give one job a different model, add `GOLEM_RUNNER_MODEL_PAYLOAD`, `_SUPERVISOR`, `_INVESTIGATOR`, `_REVIEWER` or `_DEFINITION`.

A model set this way never leaves your machine: Golem stores no key and no address for it. If a provider is named and cannot work, the runner does not start. It will not fall back to the model chosen in the console, because that would send your conversations somewhere you did not pick.

## 5. Check that it is your runner doing the work

First the runner's own log:

```
docker logs golem-analyst-worker
```

Look for these three lines, in this order:

```
analyst-worker: workspace credentialed by its enrolled key
analyst-worker: workspace model resolved ... provider=openai_compatible model=qwen3-8b-32k:latest ... credential="set on this machine"
analyst-worker: enrolled a job's host with the workspace's key
```

Then the console. Back in **Defender**, **Settings**, each job your runner took reads like this, and the rows update on their own every few seconds:

```
Yours, on qwen3-8b-32k:latest. Last asked for work 20s ago.
```

The **Model** card in the same sheet reads **Set on your runner**, with the model's name. The model named there before does not apply to a runner that names its own.

Then a real conversation. A conversation is read once it has been quiet for the **Settle window**, which is 30 minutes by default, so a new setup shows nothing for half an hour. To see it sooner, lower **Settle window** in Triage's **Settings** while you test. When one is read, the runner's log shows a pass with `assessed=1` and a `model_calls` count above zero, and the reading appears in your [signed record](/record) under `golem-metadata-argument-analyst`.

## When something is wrong

| What you see | What it means | What to do |
|---|---|---|
| A job's row reads **Yours. No runner of yours has enrolled yet** | Golem has stopped and your runner has not started that job. | Check the runner is running and the job's own switch is on. The reviewer and the definition scanner have their own switches. |
| The runner's log says Golem runs a job, with `code=job_run_by_golem` | That job is assigned to Golem. The runner leaves it alone and keeps doing its other jobs. | Nothing, if that is what you chose. Otherwise assign the job to **Yours** under **Who runs each job**. |
| Refused with `runner_key_required` or `runner_key_other_job` | The key in the file is not a runner key, or was not minted for that job. | Mint a new runner key from **Your own runner** and replace the file. |
| A row says its last try failed because the model could not be reached | The container cannot reach the address in `GOLEM_RUNNER_MODEL_ENDPOINT`. | From the machine, run the `curl` from the top of this page. For a server on the same machine, use `host.docker.internal`, not `localhost`. |
| The runner's log says `no JSON object in model response` or `report has no step-0 session finding`, and passes end with `assessed=0` | The model did not answer in the form asked. Most often its context window is too small and the prompt was cut short; Ollama's own log then says `truncating input prompt`. | Give the model a larger context window, as at the top of this page. If the prompt was not cut, the model is too small for the work. |
| A row says the model was not found | The name in `GOLEM_RUNNER_MODEL` is not one your server lists. | Use the name exactly as `/v1/models` returns it. |
| Nothing is read, and no error | No conversation has settled, the spend cap is reached, or the machines in question are outside what Triage reads. | Check **Settle window**, **Spend caps** and **Which machines**. |

## What Golem still does

Your runner does the reading. Golem still hands out the work, checks who is asking for it, applies your spend caps and limits, and keeps the record. The caps, the limits, each job's switch and the notes you give each agent stay in the console and apply to your runner as they do to Golem's.

## Handing a job back

Under **Who runs each job**, set the job to **Golem**. Your runner's key for that job is revoked and Golem takes the job again on its next pass. A runner key you leave in place cannot take the job back: Golem refuses it until you assign the job to **Yours** again.

Your runner keeps doing the jobs it still has, and picks a job up again on its next pass when you give it back. Two limits apply today:

- A runner that has never run cannot start while Golem runs the triage reader. Start it with the triage reader set to **Yours**. After its first pass you can hand the reader back.
- If you hand back a job other than the triage reader and later take it again, restart the runner.
