# `check`

`thinkthen check` tests whether a server works with ThinkThen. It sends four fixed requests, one after another. Every request is real. A hosted server may charge for it.

## See it first

`--plan` prints the address and the model, then the four request bodies and a count. It sends nothing and needs no key.

*The check would post its four fixed questions to the server's systemone address.*

```
thinkthen check \
  --url http://localhost:8080/v1 \
  --plan |
head -n 4
```

*Output*

```
url http://localhost:8080/v1/systemone
provider systemone
model asked unspecified
model sent jev-1.13.0
```

*exit 0*

## The four probes

Each probe asks about the same parcel delivery, and each covers the question shapes some functions send.

- `noul`: a yes or no question, for `decide`, `filter`, `rank`, and the yes or no questions of `recognize` and `relate`.
- `choice`: a pick, for `choose`, `find`, and the kind question of `recognize`.
- `score`: a scale, for `score`.
- `mixed`: five questions of three kinds in one request, for `tag`, `annotate`, and any request that carries many questions.

*The plan names the four probes in the order a live check sends them.*

```
thinkthen check \
  --url http://localhost:8080/v1 \
  --plan |
grep '^request' |
cut -d ' ' -f 1-2
```

*Output*

```
request noul
request choice
request score
request mixed
```

*exit 0*

## The report

A live check prints one `reply` line for each probe it decoded, then eight rows in this order: `connection`, `key`, `endpoint`, `noul`, `choice`, `score`, `mixed` and `usage`. A row reads `ok`, `warning` or `critical`. It reads `unchecked` when the check stopped before reaching it. A last line counts the critical and warning lines.

A transport failure, or status 401, 402, 403 or 404, stops the check, because every later request would meet it too. Any other failure belongs to its probe, and the check goes on. A finding never quotes the reply.

## Exit codes

- 0: no row is critical. Warnings may stand.
- 2: a usage error, such as no address or an unknown option. Nothing is sent.
- 4: a row is critical, or the key is unset at an address other than this machine.

`check` reads no input, cache, recording or profile. `--cache`, `--no-cache`, `--record`, `--replay` and `--profile` are refused at exit 2. It takes no `--max-retries`, and four probes send at most sixteen attempts.

## Limits

A check has no fixed worst case. A server's `Retry-After` or `Retry-After-Ms` header sets a minimum wait before a retry, with no cap. Without either header, a check at `--timeout 90` takes about 25 minutes at most.

`THINKTHEN_MAX_ESTIMATED_INPUT_TOKENS_TOTAL` binds each probe. A probe the cap cannot admit stops the check before it is sent. The check prints no report and exits 2.

[Any System One server](/install/backends/system-one/) · [The check specification](https://github.com/botassembly/thinkthen/blob/main/specification/check.md) · [Every exit code](/reference/#exit-codes)

On GitHub: [github.com/botassembly/thinkthen](https://github.com/botassembly/thinkthen)
