Inference backend configuration: supported conventions, credentials, and trust boundaries
This is a reference for two things:
- what
InferenceClient(engine/inference.py) andEmbeddingClient(engine/embedding.py) speak on the wire; - every Configuration Schema field of
config.inferenceandconfig.embedding.
changing-the-inference-model.md covers the procedure for swapping models and context sizes against a real Ollama server. This guide covers the wire convention and config fields themselves, which apply to any OpenAI-compatible target.
1. Wire convention
Both clients speak the OpenAI-compatible convention: POST /v1/chat/completions (InferenceClient) and POST /v1/embeddings (EmbeddingClient). They do not use Ollama's native /api/chat and /api/embed shape.
This is the de facto standard across the self-hosted and cloud landscape. Ollama itself exposes both shapes side by side. The identical convention is spoken by vLLM, LM Studio, llama.cpp's own server, LocalAI, OpenAI directly, and most cloud providers' OpenAI-compatible layers.
Verified only against Ollama. Every claim in this guide about what a target accepts or rejects is checked against a real, reachable Ollama endpoint (tests/test_inference_contract.py, tests/test_inference_live.py). Other OpenAI-compatible targets (OpenAI itself, vLLM, LocalAI) are untested. Pointing Kindred at one of those is expected to work per the shared convention, but is unverified.
2. Configuration Schema fields (INFERENCE_CONFIG_SCHEMA, engine/inference_config.py)
| Field | Type | Default | Sent on the wire as |
|---|---|---|---|
endpoint |
string (URI) | required | The request URL itself. |
model |
string | required | model |
context_window_tokens |
integer | required | Never. Local planning only, see §4. |
reserved_output_tokens |
integer | required | max_tokens, the response's hard cap. See below. |
reasoning_effort |
string, min length 1 | unset (None) |
reasoning_effort, verbatim, only when set. See §3. |
backend_trust |
"local" | "external" |
unset (None) |
Never. Kindred-side classification only, see §5. |
api_key |
string, "x-sensitive" |
unset (None) |
Authorization: Bearer <key> header, only when set. |
timeout_seconds |
number | 120 | The HTTP client's own request timeout. |
retry |
object (max_attempts, temperatures, top_p) |
3 attempts, escalating | temperature and top_p per attempt. |
EMBEDDING_CONFIG_SCHEMA (engine/embedding_config.py) carries the identical api_key field with the identical Bearer-header behavior. reasoning_effort and backend_trust don't apply to embeddings. There is no reasoning-trace concept for an embedding call, and no embedding call ever carries secrecy-protected content (see §5).
max_tokens, not max_completion_tokens
reserved_output_tokens is the response's hard cap, and is sent as max_tokens, the field local OpenAI-compatible servers enforce.
- Ollama 0.22.1 accepts
max_completion_tokenswithout an error and then ignores it. A request capped at 20 tokens produced 972, and a model stuck in a repetition loop ran until the client timeout instead of stopping at its cap. - OpenAI's own reasoning models (o-series and gpt-5-class) are the reverse: they reject
max_tokensoutright. They are not a supported target today. Supporting one needs a configuration setting that sendsmax_completion_tokensinstead, which is a change to the Node Type configuration schemas. - Whether a server enforces the cap is worth checking before relying on it (see "Checking that the cap is enforced" in
changing-the-inference-model.md).
A response cut off at the cap is a failed attempt
When the server reports finish_reason: "length", the text stops wherever the cap fell. It is never returned as an answer, however much of it there is.
- The attempt counts as failed, with the reason
output cut off at the N-token limit. - The retry loop moves on to its next, higher-temperature attempt.
- If every attempt is cut off, the call fails, like any other exhausted retry budget.
- Size
reserved_output_tokensabove the longest answer you expect (see the same guide).
3. reasoning_effort — reasoning-trace capability
This is a free string, not an enum. Kindred never validates or guesses at a target's accepted vocabulary. "none", "low", "medium" and "high" are Ollama's and the o-series' convention, checked only against Ollama. Whatever value is configured is sent on the wire exactly as written.
- Unset (the default): the field is never sent at all. This means "this target hasn't declared reasoning-trace support", not "suppress reasoning". A reasoning-capable target given no value at all may emit its full chain-of-thought trace unconditionally.
- Set: sent verbatim, once per call.
The failure mode this field exists to prevent
A reasoning-capable model asked to think without an explicit, bounded output budget can consume its entire reserved_output_tokens on the trace itself and return empty content. This was seen with example-llm, a small reasoning-capable model.
With the cap not enforced, the same model can also fall into a repetition loop inside its reasoning and keep writing it until the client times out. That is about 84 tokens/s, no answer, and 120 s lost per attempt.
"none" prevents both on that model. "low" still looped. node-types/mes/example_node_config.json and node-types/erp/example_node_config.json both explicitly declare "reasoning_effort": "none" for this reason. That is an explicit declaration, not a default. When the field is unset, nothing is sent, so a site deploying against a reasoning-capable target must declare the suppressing value itself.
4. context_window_tokens — local planning only
The OpenAI-compatible convention has no per-request field for context window. It is a model-fixed, server-side property, not something a caller declares per call.
context_window_tokens is Token Budget's local batch-sizing input only (ModelBudgetProfile in engine/token_budget.py). It is never sent on the wire. A regression test confirms this against a mock backend that answers 400 to any request field outside the exact known chat/completions set, so a stray num_ctx would be caught immediately, not silently ignored.
It must therefore be set to match whatever the target server actually runs the model at. See changing-the-inference-model.md for how to determine that value for a real Ollama deployment. Setting it higher than the server's real context means Token Budget plans batches the server can't honor, with no error surfaced anywhere in the call chain.
5. backend_trust — local vs. external trust-boundary classification
This is an explicit declaration of where a configured endpoint actually runs: "local" or "external". It is never guessed from the endpoint URL (no private-IP heuristic, no hostname pattern). The operator's stated intent is authoritative, the same "no guessing" stance §3 takes for reasoning_effort.
What it gates. Only ShiftHandoffTask's shift-handoff summary drafting, which uses the licensed prompt asset kept out of the repository. Case triage and the Playbook's drafting content need no such protection, so nothing else in this codebase reads backend_trust.
Gate semantics (_build_shift_handoff_runtime in engine/node_main.py and ShiftHandoffTask in engine/shift_handoff.py):
- Unset (the default): treated as untrusted.
ShiftHandoffTasktakes the same fallback as anUNLICENSEDlicense state,_build_unlicensed_summary, which never callsInferenceClientat all, regardless of actual license validity. This closes the "silent side effect of pointingendpointsomewhere new" that the classification exists to prevent. Nobody having made a deliberate choice is treated as a reason to hold back licensed content, not assumed safe. - Either declared value,
"local"or"external": runs the full Licensed path identically, with no logging or warning of any kind. A site explicitly declaring"external"has made a deliberate, informed choice to route this content through a public or cloud LLM. That declaration is itself the "deliberate, visible config state" the classification requires, and Kindred does not re-flag it on every scheduled run. Recurring log noise on a legitimate, accepted configuration would be actively wrong.
Both example configs (node-types/mes/, node-types/erp/) declare "backend_trust": "local". ERP's copy is documentation-accurate metadata only, since ERP never builds a ShiftHandoffTask.
6. Credentials
- Sending.
api_key, when set, sendsAuthorization: Bearer <key>(bearer_headersinengine/bearer_auth.py). When unset, noAuthorizationheader is sent at all. A local or self-hosted target like Ollama needs none. - Sensitive marking.
api_keyis marked"x-sensitive"in both Configuration Schemas.engine/config_loader.pyrejects a Shared Configuration Fragment that sets it, and redacts it out of ajsonschemavalidation-error message.build_inference_profileandbuild_embedding_profiledo the same for their own pydantic validation-error messages (engine/sensitive_config_fields.py). - Encryption. Whether the config file carrying it is SOPS-encrypted is an ordinary deployment choice (
engine/secrets.py), not a special case this field introduces. - Empty string. An empty string (
"") is treated as equivalent to unset (no header sent). This is a deliberate, documented convention, not a gap. The config schema (minLength: 1,engine/inference_config.py) and the pydantic profile (min_length=1,engine/inference.py) reject an emptyapi_keyat config load, precisely because it would be ambiguous with unset. The no-header treatment of a falsy key (engine/bearer_auth.py) is only a backstop.
7. The shipped example config against a live endpoint
test_real_mes_example_config_still_completes_against_a_reachable_endpoint in tests/test_inference_contract.py loads node-types/mes/node_type.json and example_node_config.json exactly as committed. That is the real, deployable config, not a synthetic stand-in. It runs a live call against a reachable Ollama endpoint. This confirms that "reasoning_effort": "none" suppresses a reasoning-capable model's trace-exhaustion failure mode in practice, not just in a mocked-transport test.
It skips cleanly when the configured model isn't the one reachable, rather than failing, matching tests/test_inference_live.py's convention.
8. The management service's own inference settings
The configuration assistant is the one place the management service calls a model. It does not read a Node's config: the management service has no Node Type of its own to carry an inference section, and it must start with no Node configured.
It takes the same fields from its own settings instead, in MANAGEMENT_INFERENCE_* (.env, or the install script's --inference-* options):
- the endpoint and the model;
- the context window the server runs it at (§4's
context_window_tokens) and the output cap (reserved_output_tokens); reasoning_effort, the timeout, the chars-per-token estimate and safety margin, and the retry schedule (§2'sretry).
They build the same InferenceProfile. Everything §1 to §4 say of the wire therefore holds here: max_tokens as the hard cap, and reasoning_effort sent verbatim and never guessed. The same numbers size its prompt.
Two fields of §2 are handled differently:
api_keyis not a setting, because the management service keeps no secret in.env. A model server that needs a bearer token is given a path,MANAGEMENT_INFERENCE_TOKEN_FILE, to a file (mode0600, one token). It is read for each request and held to §6's rules. An endpoint with a name or password in it stops the service at start.- There is no
backend_trust, because the assistant carries no licensed content.
The settings are all-or-nothing and off by default.
Pitfalls
- A
context_window_tokens/num_ctxmismatch surfaces nowhere. See §4. Token Budget plans against whatever value is configured, with no live check against what the server actually runs at. reasoning_effortunset is not a safe default for a reasoning-capable model. See the failure mode in §3. An unset field means "no target declared, nothing sent", so don't assume an unconfigured reasoning-capable target is safe.backend_trustunset silently degrades shift-handoff quality, not the whole node. OnlyShiftHandoffTask's drafting falls back. Every other Task on the same Node instance (CaseTriage, OrderNarrativeTask and the rest) is completely unaffected, since none of them readbackend_trust. A report of "shift-handoff reads plainer than expected" on an otherwise healthy node should check this field first.- A declared
backend_trustvalue is never cross-checked against the realendpoint. Declaring"local"whileendpointactually points at a public cloud host is not caught by anything in this codebase. The operator's stated intent is authoritative by design (§5), not verified.
Release: v0.11.0