Skip to contentNO
Labs · Docs · Ask

»» Labs · Docs · updated på norsk

Ask

The AI agent on brencel.no. Architecture, API and data handling.

  1. 1Overview
  2. 2Architecture
  3. 3API
  4. 4Guards
  5. 5Data
  6. 6Voice
  7. 7Changes

1Overview

Ask is a text agent built by Brencel. It answers questions about Brencel from the content of brencel.no, and every use of the language model goes through a sealed agent core with guards before and after the model.

PropertyValue
StatusIn operation, closed to questions at launch. Until it opens: hello@brencel.no.
ChannelText. Voice is built but switched off.
LanguageNorwegian (bokmål), on the English pages too.
MemoryOff by default. The visitor turns it on.
MarkingGenerated answers are marked ki-generert.

2Architecture

Ask consists of a chat window in the browser, an API route on the server and the agent core. The route handles everything HTTP. Everything that concerns the model happens in the core.

  1. Chat windowSends the question to POST /api/ask. The conversation follows the visitor between pages.
  2. RouteValidates the request, enforces limits per client, sets the session and stops sensitive information.
  3. CoreChecks the kill switch and the budget before the run starts.
  4. Fact lookupRetrieves relevant passages from the content of brencel.no and attaches them to the question.
  5. Language modelWrites the answer from the facts.
  6. Output guardChecks every part of the answer before it is sent. On a breach: one more attempt, then a fixed refusal.
  7. ResponseStreamed back, marked as AI generated.

The language model can be swapped and is chosen per setup. The provider is listed in the privacy policy.

3API

The chat window uses the same API described here. The contract is also published in machine-readable form at /api/v1/services.json.

POST /api/ask

Sends one question. The answer comes back as JSON, or as a stream when the request carries Accept: text/event-stream.

FieldTypeDescription
sporsmalstringRequired. The question, at most 500 characters.
huskbooleanOptional. true reads and writes the session's conversation memory, false deletes it. Without the field, no memory is used.
curl https://brencel.no/api/ask \
  -H "Content-Type: application/json" \
  -H "Origin: https://brencel.no" \
  -d '{ "sporsmal": "Hva gjør Brencel?" }'

Response

{
  "ok": true,
  "svar": "Brencel er et teknologistudio …",
  "opphav": "ki-generert"
}

Every response carries the field opphav and the header x-brencel-opphav: ki-generert for answers from the model, fast-tekst for fixed answers written by us.

Stream

EventDataSent
steg{ steg }When the run reaches a new stage: sjekket, fakta or skriver.
del{ tekst, opphav }For each part of the answer that has passed the output guard.
svar{ svar, opphav }Last, with the whole answer.
feil{ feil }If the run fails after the stream has started.
event: steg
data: {"steg":"sjekket"}

event: steg
data: {"steg":"fakta"}

event: steg
data: {"steg":"skriver"}

event: del
data: {"tekst":"Brencel er et teknologistudio …","opphav":"ki-generert"}

event: svar
data: {"svar":"Brencel er et teknologistudio …","opphav":"ki-generert"}

Errors

StatusfeilMeaning
400validation_errorThe request was rejected.
429rate_limitedToo many questions. See Retry-After.
502agent_errorAn error at the language model provider.
503ask_utilgjengeligAsk is closed or switched off.

Errors before the run starts come as an HTTP status, also when a stream was requested.

Limits

LimitValue
Question length500 characters
Questions per hour10 per client
Conversation memory30 minutes without activity

Memory and session

EndpointDescription
GET /api/ask/minneThe session's stored turns as { ok, turer: [{ sporsmal, svar }] }. Without a session: an empty list.
POST /api/ask/glemDeletes the session's memory. Answers 204.

The session follows the cookie brencel_ask_sid: HttpOnly, SameSite=Lax, valid for 24 hours.

4Guards

  • Kill switch: stops every run. The route then answers 503.
  • Budget: caps use per session and per day.
  • Sensitive information: when visitors tell about their own health, faith, politics or the like, it never reaches the model or the memory. The answer is fixed and marked fast-tekst.
  • Output guard: fixed rules are checked on every part of the answer as it is written. On a breach Ask makes one more attempt, then a fixed refusal follows.
  • Links: answers link only to the pages of brencel.no, email and phone.

The guards' rules are not published.

5Data

DataWhereHow long
Questions and answersSent to the language model to produce the answer. Not logged by us.See the privacy policy.
Conversation memoryThe server's memory, never disk. Only when husk is true.Until memory is turned off, or 30 minutes without activity.
SessionThe cookie brencel_ask_sid.24 hours.

Instrumentation records times and fixed categories, never the content of questions or answers. The language model provider and the basis for the transfer are set out in the privacy policy.

6Voice

Voice is built but switched off until the data processing agreement with the speech recognition provider is signed.

  1. Speech recognitionSpeech becomes text.
  2. CoreThe same core and the same guards as for text.
  3. Speech synthesisOnly text that has passed the output guard becomes speech.

7Changes

DateChange
7 Nov 2026First version.