Skip to content
Stackship documentation Svenska

Stackship platformAdministrators

Manage AI profiles

Decide which language model each platform service may use, what information it may be given, and where that information is processed.

Requires: kernel/aiProfiles/read, kernel/aiProfiles/write, kernel/aiProfiles/delete

An AI profile is a governed way to use a language model: one LLM gateway, one model on it, and — the point of the exercise — a statement of what information may be sent through it. Platform services ask the platform for a profile every time they run, and the platform refuses when the profile is not cleared for what the service is about to send.

Without that layer, pointing Sentinel — which reads pod logs and events from every namespace in the cluster — at a public inference endpoint is two clicks that leave no trace and trigger no refusal. With it, the decision is recorded, visible, and checked on every call.

Profiles are managed under Settings → Platform Settings, on the AI profiles tab. Which profile each service uses is set on the AI usage tab. Both are shown only to principals who can read profiles — see Permissions.

Information classification

Classification follows KLASSA, the model Sveriges Kommuner och Regioner publishes for municipalities and regions, so a classification made in KLASSA and one made here mean the same thing. Information is scored on three security aspects, independently:

Aspect The question it answers
Konfidentialitet (confidentiality) What damage follows if this reaches someone unauthorised?
Riktighet (integrity) What damage follows if this is not correct and complete?
Tillgänglighet (availability) What damage follows if this cannot be reached when it is needed?

Each aspect gets a consequence level from 0 to 4:

Level KLASSA's name Means
0 Försumbar skada No noticeable effect on anyone, and none on the ability to do the work
1 Måttlig skada Significant inconvenience for the people concerned, but manageable; measurably reduced efficiency
2 Betydande skada Major distress or substantial financial harm; the work is still done, but noticeably less well
3 Allvarlig skada Irreversible harm to someone's life or health; critical functions affected
4 Av betydelse för Sveriges säkerhet The information falls under säkerhetsskyddslagen (2018:585)

Important

No profile can be cleared for level 4. KLASSA supplies no controls at that level — it is a marker that a säkerhetsskyddsanalys is needed instead — and neither does this platform. The highest a profile may be cleared for is 3. A purpose classified 4 on any aspect can use no language model here at all, and the platform says so rather than offering a profile.

The comparison is per aspect and all three must pass. An endpoint trusted with confidential information is not thereby trusted to return correct answers, and neither says anything about whether it will answer at all.

Create a profile

You need an LLM gateway first — a profile is a policy on top of one.

  1. Open the AI profiles tab and choose Add profile.

  2. Fill in the identity and the endpoint:

    Field What to enter
    Name A display name, for example Local Llama (sovereign). At most 100 characters
    Slug The name services ask for the profile by, suggested from the name. 1–40 lowercase letters, digits and hyphens. It cannot be changed later
    Description What the profile is for, in your own words. At most 500 characters
    Gateway The registered gateway that carries the requests
    Model One of that gateway's enabled models. One model, not a preference order — a profile whose model can change silently is a profile whose classification means nothing
  3. Fill in Informationsklassning — the highest level this profile may be given on each of the three aspects. There is no default: a ceiling nobody chose is not a classification, so all three must be set before the profile can be saved.

  4. Fill in how the endpoint treats what it is given. These are the facts that make a ceiling defensible, and they are what the platform shows and records:

    Field What to enter
    Residency Where the endpoint processes the data: Unspecified, On premises, Sweden, EEA or Global. See the note below
    Provider retains data Whether the provider stores prompts or trains on them. Usually the fact that decides the ceiling
    Requires redaction Only a service that removes secrets and personal data before sending may use this profile
    Accepted task types Which kinds of material the profile takes: Description, Source code, Operational data. Leave all of them selected to accept anything
  5. Choose Add profile.

Warning

Residency is a declaration, not a control. The platform records it, shows it and audits it. It does not enforce it: every pod already has outbound access on port 443, and the platform's namespace policy sweep claims sole authority over those rules, so nothing here stops a packet reaching a host outside the region you named. Treat the field as the answer to "what did we decide and who decided it", which is what an auditor asks — not as a guarantee about where the bytes went.

Task types

The second axis of the rule. Classification alone cannot draw the distinction an operator usually wants, because a description, a manifest and a log line can all be classified the same:

Task type What it is
Description Prose about what is wanted: requirements, summaries, explanations
Source code Source, configuration and manifests, and changes proposed to them
Operational data What a running system produced: logs, events, metrics, cluster state

A profile that accepts only Description can be assigned to a purpose that sends prose, and is refused for one that sends logs — whatever the classification says.

Choose which profile each service uses

Open the AI usage tab. It has one row per purpose — a job a platform service uses a model for. Today all of them are Sentinel's:

Purpose What it does Classified Task type
sentinel.triage Fast first pass over all evidence K2 · R1 · T1 Operational data
sentinel.brain Deep analysis that writes findings K2 · R1 · T1 Operational data
sentinel.code Proposes patches K2 · R2 · T1 Source code

Each row shows how the platform classifies what that purpose sends, and why. Expand the reason before you disagree with the number — it says what Sentinel actually reads and what its redaction pass removes first.

For each purpose:

  1. Choose a Profile. Only profiles that clear the purpose can be chosen; the others are listed but disabled, each with the reason it cannot serve this purpose.
  2. Optionally raise the classification for this installation — see below.
  3. Choose Save on that row. Each row is saved on its own and shows when it was last changed.

Changes apply from the service's next run; Sentinel runs every 30 minutes by default.

Raise a purpose's classification

The platform's own assessment is a floor, not a verdict. An installation whose logs carry more than the platform assumes can raise any aspect of any purpose, and the raise is then what every check uses.

You cannot set a level below the platform's. An administrator who believes Sentinel's triage stage sends less than the platform says it does is describing a disagreement about what the code does, and a form field is the wrong place to settle it.

Raising is per aspect. Setting confidentiality to 3 leaves riktighet and tillgänglighet following the platform's own assessment, so a later reassessment still reaches them. Writing the platform's own level back removes the raise entirely.

A common reason to raise: turning on Send Log Evidence to LLM in Sentinel's settings adds container log tails to what every run sends. The platform's classification already allows for that being on, but an installation whose applications log personal data in volume may well decide 3 is the honest number.

What a row can say

Marker Meaning Stops the service
Not cleared The profile's ceiling is below the purpose's classification on some aspect Yes
Task type not accepted The purpose sends a kind of material the profile does not take Yes
Profile disabled The profile is parked Yes
Redaction required The profile requires redaction and this service does not redact Yes
Classification not reviewed Nobody has confirmed what this profile may be given — see Profiles from before No
Gateway unhealthy The gateway's last check was not Healthy No
Model not enabled The profile's model is disabled on the gateway, or no longer on it No
Model no longer listed The model is enabled, but the gateway's server no longer lists it No

The split is deliberate. A profile that is not cleared must not be used, so the platform refuses and the service skips its run with the reason. A gateway that is briefly unreachable is a fact to report: the service's own call is the real test, and refusing there would turn a flapping health check into an outage.

Profiles from before AI profiles existed

Upgrading an installation that had Sentinel pointed at a gateway and model creates one profile per distinct gateway-and-model pair and points the purposes at them, so nothing stops working.

Those profiles are cleared for exactly what the purposes using them need — a ceiling the platform chose on your behalf — and they are marked Classification not reviewed until someone confirms it. The marker does not block anything: an upgrade that stops Sentinel would be worse than the gap this feature closes. Open each one, check the ceiling, the residency and the retention against what you know about the endpoint, and save.

Their names read LiteLLM (prod) · gpt-4o-mini and their descriptions say where they came from. Rename them to something that says what they are for.

Edit, disable and delete

Saving a profile records that a person stands behind its classification, which is what clears the not reviewed marker.

A change that would leave an assigned purpose without a profile that serves it is refused while you are still looking at the screen, rather than allowed and discovered by the service at three in the morning. That covers lowering the ceiling below what an assigned purpose is classified at, narrowing the accepted task types past one, turning on Requires redaction for a service that does not redact, and disabling the profile. The message names the purposes in the way.

Disable parks a profile without losing its classification or the assignments pointing at it — useful while an endpoint is being replaced. Point its purposes elsewhere first.

Delete is refused while any purpose is assigned to the profile, and while it is the default profile and another profile exists. Both answer 409 with AI_PROFILE_IN_USE.

Deleting an LLM gateway, or disabling a model on one, is likewise refused while a profile uses it; the message names the profiles.

How a service gets its profile

At the start of every run, Sentinel asks the platform for a profile once per stage, naming that stage's purpose. The platform checks the profile against the purpose and hands over the gateway's base URL, API key and the profile's model, together with both classifications — what the profile is cleared for and what the purpose is classified at — so the service can log what it is operating under.

Nothing is kept between runs, so a rotated key, a reassigned profile or a lowered ceiling takes effect on the next run without a restart.

When a purpose has no profile assigned, the service falls back to the profile it names in its own configuration, and then to the default profile. When it cannot get one at all — nothing assigned and no default, the service lacks the permission, or the platform API cannot be reached — it skips the run and records why.

A refusal on classification is not a failure to route around. A service that is refused must not fall back to an endpoint of its own; the refusal is the control working.

Permissions

Every action is checked at the platform root, so only roles assigned there grant it; a role assigned on a boundary, Owner included, never does.

Action Allows
kernel/aiProfiles/read Seeing both tabs: the profiles, what each is cleared for, and which purpose uses which
kernel/aiProfiles/write Creating and changing profiles, deciding what each may be given, and assigning and classifying purposes
kernel/aiProfiles/delete Deleting a profile. A role that grants write grants this too
kernel/aiProfiles/resolve Being handed a profile, the gateway's key included, over the platform's internal channel — what services such as Sentinel do

kernel/aiProfiles/write is the action that decides which endpoint receives which classification of the platform's data. Grant it as narrowly as that sentence suggests.

Platform Owner and Platform Contributor hold all four, resolve included. Platform Reader holds read and sees both tabs without their controls. The sidebar shows Platform Settings only to those who can change the e-mail settings, so a Platform Reader opens the page at https://portal.example.com/admin/platform-settings.

The AI Profile Consumer role holds resolve and none of the other three, and can only be assigned at the platform root. The platform's RBAC service grants it there to Sentinel's service account — the Keycloak client stackship-module-sentinel — and grants it again if it is removed; see Installation settings. The role was called LLM Gateway Consumer before profiles and kept its identity, so an existing grant keeps working.

What is recorded

Every change and every hand-out is recorded in the platform's audit log under the resource type aiprofiles, with the profile's slug as the resource name:

Event When
aiProfile.created A profile was created
aiProfile.updated A profile's name, description, gateway, model or handling changed
aiProfile.reclassified A profile's ceiling moved; the entry carries the old value and the new
aiProfile.deleted A profile was deleted
aiProfile.assigned, aiProfile.unassigned A purpose's profile was set or cleared
aiPurpose.classified A purpose's classification was raised or a raise removed
aiProfile.resolved A service was handed a profile; the entry names the caller, the purpose, the model, what the profile is cleared for and what the data is classified at
aiProfile.refused A service asked for a profile and was refused; the entry carries the reason

Widening what an endpoint may be given is a separate event from renaming it, because they are not the same thing to whoever reads the trail.

The API key is never recorded. A resolve that cannot be recorded is refused, so no key is handed out unrecorded; a change that cannot be recorded is still saved.

Installation settings

Setting Set on Default Meaning
ModuleGrantReconciler:AiProfileConsumerClientIds The RBAC module stackship-module-sentinel The Keycloak clients whose service accounts are granted AI Profile Consumer at the root. A list you set replaces the default rather than adding to it

Set it as an environment variable, for example ModuleGrantReconciler__AiProfileConsumerClientIds__0=stackship-module-sentinel. The RBAC module checks these grants when it starts and then every 10 minutes (ModuleGrantReconciler:SweepInterval), and grants again any that is missing. A client that does not exist is skipped.

With the API

The portal uses these routes under https://api.example.com. Every one is checked at the platform root.

Method and path Does Needs
GET /admin/ai-profiles List the profiles, the default first kernel/aiProfiles/read
GET /admin/ai-profiles/{id} Read one profile kernel/aiProfiles/read
GET /admin/ai-profiles/classification-scale The KLASSA aspects and levels, the residency values and the task types kernel/aiProfiles/read
GET /admin/ai-profiles/gateways The LLM gateways a profile can be built on, with their enabled models kernel/aiProfiles/read
GET /admin/ai-profiles/purposes List every purpose, its classification and its profile kernel/aiProfiles/read
PUT /admin/ai-profiles/purposes/{purpose} Assign a purpose, or classify it kernel/aiProfiles/write
POST /admin/ai-profiles Create a profile kernel/aiProfiles/write
PUT /admin/ai-profiles/{id} Change a profile kernel/aiProfiles/write
DELETE /admin/ai-profiles/{id} Delete a profile kernel/aiProfiles/delete
http
POST https://api.example.com/admin/ai-profiles
Content-Type: application/json

{
  "name": "Local Llama (sovereign)",
  "slug": "local-llama",
  "gatewayId": "…",
  "model": "llama-3.3-70b",
  "clearedFor": { "confidentiality": 3, "integrity": 2, "availability": 2 },
  "residency": "on-premises",
  "retainsData": false,
  "requireRedaction": true,
  "allowedTaskTypes": ["operational-data", "source-code"]
}

In a PUT to a profile every field is optional and anything left out is kept; sending clearedFor replaces all three levels at once. An empty allowedTaskTypes means all of them.

A purpose body is { "profileId": "…" }, with { "profileId": null } to clear the assignment and "classification": { … } to raise or reset the classification. Both can be sent together, and the profile is then checked against the classification being asked for.

Invalid input is answered with 400 and a message per field — a ceiling of 4, a level below the platform's own, a model the gateway does not have enabled, or a profile that does not clear the purpose. A conflict is 409 with AI_PROFILE_IN_USE.