Skip to content

11. Model

This section covers how the analyzer is set up against a managed model endpoint (11.1) and which model does which job (11.2). Prices, dates and other numbers that matter only when you build or compare are in the table "Details" at the end (11.3).

The model is one part of the analyzer, not the part that makes it safe. Code and rules around it, a harness, decide what it is told, what it sees, what it can touch and how its work is checked, and nothing it answers is authorization: its only output is a proposal that policy code and a person check outside it, and that a verifier samples after the deploy (built, #682, but it writes reports only when the executor runs with --verify-outcomes, off by default; the executor reads them as untrusted evidence and decides Cleared, #683). The analyzer as a harness maps each part to the section that describes it.

The analyzer as a harness around the model: guides, context, tools and checks around a model that proposes only, and the path outside it from the proposal through the policy check, the GitOps pull request, a person merging and Flux deploying to the verifier, which is built and writes reports only with the executor flag --verify-outcomes (off by default), and the executor, which reads them as untrusted evidence and decides whether the symptom cleared.

11.1. Setup

The analyzer runs locally during development and in the cluster later, against a configured endpoint. For Foundry, seven rules apply.

  1. Own resource and budget. A separate Foundry resource and budget for the lab.
  2. A capable model. It is available in the chosen region and deployment type, with structured outputs and tool calling.
  3. Pay-per-token first. No provisioned throughput without measured steady load.
  4. Entra ID authentication. The identity gets the minimum data-plane role for inference.
  5. Settings in config, not in code (below).
  6. Failures are handled and tested. Timeouts, throttling, malformed output and an unavailable model.
  7. Quality is measured first. It is measured on recorded scenarios before any automation is enabled.

Rule 5: what is configured where

  • Deployment name, model ID and version, API version and TPM/RPM limits are config.
  • The provider, endpoint, deployment name, API version and daily token cap of the triage and escalation models are fields of RemediationSettings spec.analysis.models (5.4), with no key. provider is Foundry (the default), Anthropic or OpenAICompatible and names the API the adapter speaks, not the model family: a Claude model on Microsoft Foundry is still Foundry (ADR-0037). Each role has its own deployment, so triage and escalation may use different providers; there is no fallback between them.
  • TPM/RPM limits are set on the deployment itself.
  • The model ID and version come from the reply. The operator names the one each role must answer with (--triage-model, --escalation-model), and a reply naming another is refused (UnexpectedModel); the check against the evaluation list is planned (11.2).

Why the endpoint is guarded

The endpoint decides where the analyzer's Entra ID token and the redacted context go. So the analyzer:

  • refuses a host outside an operator-held allow-list of suffixes (--model-endpoint-suffixes, required for a Foundry deployment, no default; without it the analyzer builds no token source and refuses every Foundry deployment (ProviderNotConfigured, #814); an entry such as .<resource>.services.ai.azure.com allows that one host), and a port other than 443, before it builds a provider or requests a token (EndpointNotAllowed);
  • refuses private, loopback and link-local addresses when dialing;
  • requests the Cognitive Services audience only for the model (the analysis record store asks for its own Storage token, section 9.1).

built The allow-list in the analyzer (internal/analyzer/models, #76), the last two in the Foundry adapter (#75). The analysis loop reads spec.analysis.models when the analyzer runs with --triage-model.

For an Anthropic deployment the host is fixed in code, api.anthropic.com, and the allow-list does not apply (ADR-0037 decision 2). So the Entra ID token never goes to that host and the API key never to a Foundry host:

  • the API server refuses an Anthropic deployment whose endpoint is not exactly https://api.anthropic.com, and a deployment of any other provider whose host is api.anthropic.com, so a provider added later inherits that ban (two CEL rules on ModelDeployment);
  • the analyzer checks both again: its Foundry path refuses that host whatever --model-endpoint-suffixes lists, before a provider is built or a token requested (EndpointNotAllowed);
  • it refuses an Anthropic deployment when it runs without --anthropic-api-key-file (ProviderNotConfigured), one at an endpoint other than the API's fixed one (EndpointNotAllowed; the allow-list is not consulted), and one whose deployment is not the model ID of its role's --triage-model or --escalation-model (UnexpectedModel), before any call and without using a unit of the daily budget. apiVersion may be left out of an Anthropic deployment (the CRD requires it for Foundry and forbids it for OpenAICompatible, #814); a value there is not sent: the adapter's API version is a constant.

built in internal/analyzer/models and the API types (#729).

OpenAI-compatible endpoints

built OpenAICompatible matches settings against exact install-time --openai-compatible-endpoints declarations, including the nonempty allowed models list. An undeclared model alias ends ModelNotAllowed before any request. Each owns its base URL, inference API and optional key file; no settings path is used to construct a request. The shared internal/providers/model/openaiwire codec keeps Foundry wire behavior unchanged. No compatible suffix list exists. Scheme/host case, default port and one trailing slash normalize; dot segments, userinfo, queries and fragments are refused. Duplicate bases, segment path prefixes on the same authority, invalid model lists and Foundry/Azure/Anthropic host overlaps fail chart rendering and analyzer startup. Nonempty keys shorter than 16 bytes are malformed and are not retried. A key file belongs to one declaration: startup refuses two declarations that name one file, and a declaration that names the --anthropic-api-key-file file, by path and by file identity (a link counts), and the compatible and Anthropic adapters check identity again before each read, so a file that appears after start as a link to another declared key is refused without a request. The chart refuses two endpoints that mount the same Secret key (through a secret volume's items too), or the Anthropic key; for a projected or CSI volume it refuses only the same source written twice, and one key to one declaration is the operator's to keep.

Set --disable-foundry for compatible-only inference without an Entra token source. The Foundry suffix list remains Foundry-only. Every declared compatible host is refused for Foundry and Anthropic. Private addresses require a declared Service with namespace, pod selector and target port; HTTPS with trusted TLS and address guards remain required. No redirects or proxy are used. Missing or unusable usage and failed sent calls cost the input estimate plus output bound and a rounded-up 10% margin; complete usage costs at least the input estimate. Every attempt the endpoint may have billed is charged, retries included (each one that got a response or may have reached a connection; not a refused dial or an unreadable key), and the adapter makes no retry the remaining analysis and daily budget cannot cover at that ceiling. An endpoint that reports less than it billed is charged the larger of the input estimate and its report. The raw body and joined decoded strings, numbers and object keys are scanned for credential echoes before any completion is returned, in a view that keeps only ASCII letters, digits and the key's punctuation, so no character inserted into the key hides it. Model text is stored without control characters (Unicode Cc except newline and tab, #852), and the view drops a superset of them, so a key contiguous in stored text is refused; #852, the condition of this provider, is built (below). A reply whose content or argument fields have a wrong JSON type is refused as malformed output with its own fixed text. Re-encoded keys (base64, percent encoding, homoglyphs) and splits across replies remain outside this check: the endpoint is trusted with the key at install. Output redaction, typed validation and deterministic policy still apply. ADR-0042 is Accepted.

The harness qualifies a model and server together, including the Responses tool path of #501.

Where inference runs

Global deployments can process data outside the resource's region. The resource region alone does not guarantee where inference happens (deployment types).

With an Anthropic deployment, the redacted context and tool results of that role go to the Anthropic API under the account of its key, outside the lab's Azure subscription and region; the adapter does not ask for an inference region. Where context goes is decided per analyzer (it can use this provider only with a key file) and then per deployment: anyone who may edit RemediationSettings can move a role to this provider, so that permission is also a decision about where context goes. The analyzer logs the provider each role uses when it changes (also at the first analysis after a start) and records a Normal Event ModelProviderChanged on the Incident whose call to it is the first to return having sent a request (not one that reserved no budget unit, was cancelled before its call, or whose call sent nothing). Calls are noted as they return, so with analyses in parallel the Event can go to a later call than the first that sent, when that one returns first, naming only the role and the provider names. The analysis record names each role's provider next to its deployment (providers beside deployments). Data handling says what the operator has to check in the vendor's terms.

The lab region

The lab uses Sweden Central (ADR-0016). It was checked on 2026-11-01 on the lab subscription with az cognitiveservices model list.

  • It is the only EU region listed with both OpenAI and Anthropic models.
  • Anthropic models there are offered as Global Standard only.
  • Azure OpenAI token prices are the same in every EU and US region. Global Standard is about 10% cheaper than Data Zone Standard (figures in 11.3).
  • The lab node price in Sweden Central is the lowest of the EU regions compared. East US 2 was cheaper but outside the EU (figures in 11.3).

11.2. Model strategy

Three layers share the work.

  • Small model. It summarizes context, classifies the symptom and proposes a known runbook. It makes one structured call on a prepared context, without tools.
  • Stronger model. It takes hard incidents, ambiguous dependencies and multi-step analysis, with read tools and fixed step, token and spend budgets. It is an escalation, not the default.
  • Deterministic code. It enforces policy, computes bounds, builds the diff and decides whether execution is allowed.

When the stronger model is used

Deterministic signals trigger it, never model output:

  • the context was truncated or a source could not be fetched;
  • the small model's output failed schema validation after one retry.

A proposed action outside the catalog's bounds (it fails policy.CheckAction) is neither: it gets no retry and no feedback to the model, so the model cannot search for what the policy allows, and the analysis ends as a hand-off with its own reason, ActionOutOfBounds (decided 2026-11-05). Schema failures keep their one corrective retry. What the model does see, before it answers, is the bounds of the RemediationPolicy that will decide its proposal, in the context's policy bounds block (3.3, #493, decided 2026-11-07, proposed in ADR-0026): fixed operator configuration, the same for every answer, rendered from the policy's typed fields by the policy package's own checks. It is not a probe: the model learns nothing about its proposal, and nothing clamps a value to the bounds. The policy still decides (invariant 1). The bounds are limits, not a target: the prompt asks for the smallest change the evidence supports (planned: ADR-0040, Accepted, removes this rule for memory limits because code sets the size) and for the summary to name the evidence that sets the size, and the pull request body shows the size of the step beside the policy.

At most one escalation per incident fingerprint per cooldown window. A runbook match (a rule with no model call) never reaches the model at all. built in the analysis loop (3.3), which the analyzer starts with --triage-model and runs with --escalation-model (#76).

The ModelProvider interface

ModelProvider is built as Complete(ctx, CompletionRequest) (Completion, error).

  • In: messages, tool definitions, an optional response schema and MaxOutputTokens.
  • Out: Content (a string), tool calls, Usage, UsageUnknown (a billed reply whose usage could not be read) and a Model field.
  • Throttling and transient failures (408, 429, 5xx, timeouts) come back as ErrRetryable; an unknown deployment is ErrNotFound, final.
  • A reply that breaks the request's contract is ErrMalformedOutput, returned with the reply's Usage and Model.

built Model text is stored without control characters, and a tool call that holds one is refused (#852, ADR-0023, decisions of 2026-11-17; the order of redaction and cleaning by the decision of 2026-11-22). A control character here is a code point of Unicode category Cc (C0, DEL and C1) other than newline and tab. Where a reply of any provider enters the analysis loop, one function (providers.WithoutControls) removes them from the content and from each tool call's ID, name and arguments, before the loop parses, logs or compares anything, and keeps the content as it came. The order. The free text that is stored (the summary and the missing data, in the outcome's log line and the analysis record) is redacted from the reply as it came, controls included, every marker is put in place, and only then are the controls removed from the redacted text (run.shownModelText). The redactor reads the text as it is, as on origin/main, and once more without its controls (its controls view, 10), and adds what that reading finds; nothing in the text is changed before the readings run. So removing a control can take away nothing a rule reads (a carriage return before Bearer is the word boundary of the token rule, and x CR Bearer and a token is stored as xBearer [credential]), the markers hold no control, and what is stored shows no control on any terminal, also when printed raw (kubectl get -o jsonpath). The content and the arguments are JSON: the controls go from each decoded string, keys included, whether the reply wrote them raw (DEL and C1, which JSON allows in a string) or as an escape (\u001b, \b, \f, \r). Only decoded strings are cleaned, never the JSON text: a raw control between the two halves of a surrogate pair leaves two U+FFFD, not one joined character, and a raw C0 control inside a string, which JSON refuses, is left for the parser to refuse. Text without controls is left byte for byte. The result: free text is cleaned, every other field refuses (decided 2026-11-17, second). Where the content held a control is reported with it (Completion.ContentControls, the JSON path of each string or key that held one), and the analysis loop, which knows the result's schema, decides from it. A control in a free-text field of the result (the summary, the hypotheses, the evidence quotes, the missing data, the uncertainty, the expected effect) is removed. A control anywhere else (the action type, the container, the memory values, the evidence source, the verification checks, an object key) refuses the result as not matching the schema: removing it would turn the container ap ESC p, which the validator refuses, into app. The triage call retries it once with the schema refusal, and the escalation ends InvalidOutput. Each string field of the result declares which it is with a controls tag next to its type (internal/analysis/result.go); a field without the tag is refused, and a test fails until it is declared. A tool call whose name, ID or any decoded argument string or key held a control is marked (ToolCall.HeldControls) and never run: removing the control could turn a refused value into an accepted one (sh ESC op as a namespace becomes shop). Through the built adapters only arguments reach this refusal: a tool name or ID with a control fails the adapter's own check first, and the whole reply is refused as malformed output. Its result is the fixed text refused: the tool call held control characters in its name, ID or arguments and was not run, it uses its step like any refused call, and a clean call of the same reply still runs. The loop logs the refusal at Info with the tool's name, sets shadewright.tool.held_controls on the tool call's span, and counts it in the outcome's log line and the analysis record (toolCallsWithControls). The Anthropic adapter replays the reply's own blocks, so that model sees the call as it wrote it; the Foundry and OpenAI-compatible adapters send back the cleaned call; either way with the refusal as its result. Cluster text keeps its controls (decision of 2026-11-22): the context blocks, the tool results and the reviewer hint are shown as origin/main shows them, with the decision of the redactor that also reads them without their controls. A quote of the model was read without controls, so the evidence check compares it with each quotable part without its controls: a quote of an ANSI-coloured log line is found whether the model copies the line without the escapes or writes them back, and nothing is shown from that comparison. The rest of an escape sequence stays as the visible text it is, and letters a backspace, a carriage return or a sequence would hide on a terminal are shown. Format characters (Cf: bidi overrides such as U+202E, zero-width characters) are kept; only the kubectl plugin removes them for display. Model is not cleaned (each adapter accepts only a name of a fixed ASCII pattern), and the opaque provider blocks go back to their adapter unchanged. Model text stored outside the analysis loop follows the same rule: the scoring intake (ADR-0047) keeps the judge's note only when the redactor finds nothing in it as it came (which includes the reading without controls) nor once its controls are removed, and stores it without them.

built The interface, a fake and the Foundry adapter for OpenAI-format models (internal/providers/model/foundry, #75). The adapter:

  • is bound to one endpoint, deployment and API version, the fields of spec.analysis.models (rule 5); there is no fallback to another deployment;
  • speaks chat completions, or the Responses API (/openai/v1/responses, API version v1 only) for a deployment with inferenceAPI: Responses (#501): the gpt-6.1 models refuse function tools on chat completions while their reasoning is on, so escalation needs it for them. The Responses request carries the same messages, tool definitions (each with strict: false, as chat completions treat them), response schema (in text.format) and output limit, with store: false; the reply passes the same checks, its reasoning items are skipped, and an incomplete response is cut off, filtered or ended for an unknown reason, as for a chat completion. Generated corpus tests check that both forms carry the same request and give the same result for the same reply;
  • authenticates with workload identity through Entra ID, with the standard library, and sends a token only when its audience is Cognitive Services;
  • gives every call a deadline and each attempt its own, and retries network failures, timeouts, 408, 429 and 5xx a bounded number of times with backoff, honouring retry-after-ms and Retry-After;
  • marks a call that got a 429 on every attempt, each before the attempt's deadline, as refused before processing (ErrNotProcessed), which the budget charges 0 tokens, but only when the endpoint's host ends in .openai.azure.com, .cognitiveservices.azure.com or .services.ai.azure.com: Microsoft's statement that such a refusal is not billed covers its own service, and a gateway, proxy or custom domain in front of a model may bill and still answer 429 (design 12.3, #725);
  • returns an unknown deployment (404) as ErrNotFound, and a refused identity (401, 403, or a token for another audience) as ErrForbidden;
  • accepts only a DNS host name in the endpoint, and connects only to public unicast addresses, so an endpoint that resolves to a private, loopback, link-local, shared or reserved address, or to an IPv6 address embedding one (NAT64, 6to4) or one whose embedded IPv4 cannot be read (Teredo), gets no token;
  • reads at most 1 MiB of a reply and checks it as untrusted input. A reply cut off, filtered or refused, an output item of another kind than reasoning, an assistant message or a function call (Responses API), content that is not a JSON object when a schema was sent, or a call of a tool the request did not offer is ErrMalformedOutput, returned with the reply's usage because it was billed. A response that arrives after the attempt's or the call's deadline ended, whatever its status (an empty 200, for example), is that timeout, retryable and not counted as billed (#438);
  • reports the token usage of every call (input, cached input and output) with the reply and to an OnCall hook, and marks a call whose billed reply had no readable usage (too large, cut short, not a chat completion or response) as UsageUnknown, so the budget counts it conservatively;
  • puts no URL, token, prompt or reply text in its errors and logs nothing.

go test -tags foundrysmoke runs it against a real deployment by hand (see the package documentation; FOUNDRY_INFERENCE_API=Responses for the Responses API).

built The analyzer gives the analysis loop a Foundry provider per Foundry deployment of spec.analysis.models, after the host allow-list above, with its workload identity as the token source; without --model-endpoint-suffixes it builds no token source and refuses such a deployment (#76).

built for the evaluation: the Anthropic API adapter (internal/providers/model/anthropic, #728), plain net/http and no vendor SDK, with the same contract as the Foundry adapter. It is bound to one model ID and refuses a reply that names another, posts only to https://api.anthropic.com (a constant) and follows no redirect, reads its API key from a file at every request and never puts it in an error, retries 408, 429 and 5xx (529 included) honouring retry-after in seconds, returns 404 as ErrNotFound, asks for prompt caching at the end of the system prompt, reports cache reads as cached input and cache writes as plain input, sends a configured effort (default low) with max_tokens set to the request's limit plus a thinking allowance (default 4096), and sends the thinking blocks of a tool round back unchanged. make eval-model runs it with EVAL_MODEL=anthropic (Evaluate the model).

built The analyzer gives the analysis loop an Anthropic provider for a deployment with provider: Anthropic (ADR-0037, #729), bound to the model ID in deployment, with the key file of --anthropic-api-key-file. The key is a static credential under the rule of invariant 6: a read-only mounted file the cluster operator provides (a Secret or a CSI volume), read at every attempt so rotation needs no restart, never in an environment variable, a custom resource, a log, an Event or an error; the analyzer gets no RBAC on Secrets. A missing, empty or unreadable file is a retryable model error within the bounds of ADR-0023, then a hand-off with ProviderNotConfigured when no attempt of the call sent a request (otherwise ModelUnavailable); a malformed file (too large, a key too long or with a character a header cannot carry, such as an inner newline or a UTF-8 byte order mark) is not retried and ends the same way, never as ModelForbidden, since nothing reached the API. The analyzer logs every failed call with the adapter's fixed error text, never the key or the path, and charges a call that sent no request nothing against the token bounds. Until the run-time evaluation check exists, an Anthropic deployment is for lab evaluation only, as a Foundry one is. Since #814 Azure is not required for this provider: an analyzer started with --anthropic-api-key-file and without --model-endpoint-suffixes reads no workload identity and builds no Azure token source, and an Anthropic deployment may leave apiVersion out (it is not sent). planned The chart value that mounts the key and the lab setup (#729); the kustomize manifests in config/ get no mount.

Planned. A deployment field on the request and a typed timeout error. A Foundry adapter for the Anthropic family.

Evaluation gate

A change to a prompt, model or schema must pass the scenario evaluation before merge.

  • In CI it runs against a fake model. It covers plumbing, schemas and refusal paths only. It does not test the prompt's defences or model quality. built test/eval replays each scenario's recorded replies through the real context builder, read tools and analysis loop in make test; the test job writes the report into its summary (Evaluate the model, #78).
  • Quality is gated by a recorded real-model evaluation, keyed by the manifest digest of ADR-0025. built The manual Evaluation workflow runs the same harness against the Foundry deployments and reports the manifest, its digest, the scores, the tokens and an estimated cost; EVAL_MODEL=anthropic make eval-model does the same by hand against a Claude model through the Anthropic API (#728), and EVAL_MODEL=openaicompatible make eval-model against a model behind an OpenAI-compatible API, the public OpenAI API by default (#864). planned Storing passing results in this repository (for example test/eval/results/).
  • Recorded contexts from the fleet scenarios live here too: test/eval/testdata/scenarios/, with the fleet's scenarios/*/expected.yaml copied unchanged from the fleet commit that source.yaml names, a rubric per scenario that says how each expected fact is scored, and the scenario's RemediationPolicies (policy.yaml): the context shows their bounds, and a plan they refuse fails the scenario (#493). built for all eight scenarios, written by hand from the scenario manifests, and for variants of a scenario that the lab met, such as oom/rollout, scored against the scenario's unchanged expectation (Evaluate the model). oom/absorbed is the oom Incident with its absorbed tally, the recorded scenario the gate asked for before the tally reached the model (ADR-0039 point 18, #796), and TestPromptGolden checks that every scenario with an empty tally gets the same prompt as before. Escalation scenarios (test/eval/testdata/escalation/, #504) hold a fact only a read tool shows and run on the escalation model with the read tools, forced or through the builder's own signal (a context cut to its total bound, a metrics source that is down), with replayed pod logs where the scenario has them, their expected reads scored (Evaluate the model); planned replacing them with contexts and replies recorded from lab runs (ADR-0015).

It fails closed. planned The analysis loop computes the prompt hash (PromptVersion) but does not check an evaluation list yet (the harness is #78, the list and the check are its follow-up); until it does, a run with a real model is an evaluation run in the lab, not production use, and that check is the gate before a release that starts the loop (ADR-0025 decision 7). built The Completion.Model check: a reply must name the model the operator configured for its role. planned The analyzer embeds the list of evaluated (model, prompt hash) pairs and refuses automatic analysis, with the reason reported, when the configured deployment's model (or Completion.Model) has no passing record (a follow-up of #78). Details in ADR-0023. planned ADR-0025 keys the pass on a manifest of every behaviour-affecting input (model and version, prompt and tools hashes, context builder, redaction configuration, rubric, thresholds, repeats), so a change to any of them invalidates it.

Choosing concrete models

Concrete models are chosen by benchmark on the scenario set. Measure diagnosis accuracy, plan usefulness, false fixes, latency and cost per resolved incident. The defaults from the first benchmark, and the definition of a false fix, are in ADR-0027: triage gpt-5.4-mini-2026-03-17 provisional, no escalation default.

11.3. Details

Topic Detail
Lab region check 2026-11-01, az cognitiveservices model list, lab subscription
GPT-5.4 mini input price 0.6733 EUR per 1 M tokens Global, 0.7406 EUR Data Zone (Azure Retail Prices API, 2026-11-01)
Node Standard_B2as_v2, Sweden Central 0.0698 EUR/h, lowest of the EU regions compared
Node, North Europe 0.0733 EUR/h
Node, East US 2 0.0675 EUR/h, cheaper but outside the EU (same date)
Escalation limit At most one per incident fingerprint per cooldown window
Retry before escalation One retry after a schema validation failure