Labs · Docs · Ask
»» Labs · Docs · updated på norsk
Ask
The AI agent on brencel.no. Architecture, API and data handling.
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.
| Property | Value |
|---|---|
| Status | In operation, closed to questions at launch. Until it opens: hello@brencel.no. |
| Channel | Text. Voice is built but switched off. |
| Language | Norwegian (bokmål), on the English pages too. |
| Memory | Off by default. The visitor turns it on. |
| Marking | Generated 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.
- Chat windowSends the question to
POST /api/ask. The conversation follows the visitor between pages. - RouteValidates the request, enforces limits per client, sets the session and stops sensitive information.
- CoreChecks the kill switch and the budget before the run starts.
- Fact lookupRetrieves relevant passages from the content of brencel.no and attaches them to the question.
- Language modelWrites the answer from the facts.
- Output guardChecks every part of the answer before it is sent. On a breach: one more attempt, then a fixed refusal.
- 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.
| Field | Type | Description |
|---|---|---|
sporsmal | string | Required. The question, at most 500 characters. |
husk | boolean | Optional. 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
| Event | Data | Sent |
|---|---|---|
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
| Status | feil | Meaning |
|---|---|---|
400 | validation_error | The request was rejected. |
429 | rate_limited | Too many questions. See Retry-After. |
502 | agent_error | An error at the language model provider. |
503 | ask_utilgjengelig | Ask is closed or switched off. |
Errors before the run starts come as an HTTP status, also when a stream was requested.
Limits
| Limit | Value |
|---|---|
| Question length | 500 characters |
| Questions per hour | 10 per client |
| Conversation memory | 30 minutes without activity |
Memory and session
| Endpoint | Description |
|---|---|
GET /api/ask/minne | The session's stored turns as { ok, turer: [{ sporsmal, svar }] }. Without a session: an empty list. |
POST /api/ask/glem | Deletes 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
| Data | Where | How long |
|---|---|---|
| Questions and answers | Sent to the language model to produce the answer. Not logged by us. | See the privacy policy. |
| Conversation memory | The server's memory, never disk. Only when husk is true. | Until memory is turned off, or 30 minutes without activity. |
| Session | The 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.
- Speech recognitionSpeech becomes text.
- CoreThe same core and the same guards as for text.
- Speech synthesisOnly text that has passed the output guard becomes speech.
7Changes
| Date | Change |
|---|---|
| 7 Nov 2026 | First version. |