Case study

In production · July 2026

Giving a production hotel system its own mind

Tabarak is a hotel & restaurant management platform (Next.js 15, Prisma, SQLite, WhatsApp via Baileys) running a real property in Pakistan: bookings and check-ins, room-service POS with kitchen tokens, housekeeping board, folios and expenses, compliance dispatch. This is the story of integrating Bela into it — from zero to a production agent handling Roman-Urdu staff commands — in roughly one working day.

25 tools+ 5 entities
9/16 → 15/16human test set
~6 sretrain, one CPU core

What was integrated

Bela lives inside the app as three small pieces, none of which touched existing code:

PieceFileWhat it is
The contractweb/bela/agent.tools.ts25 tools + 5 entities wired to the app's real server actions and queries
The doorwayweb/app/api/bela/route.tsOne POST route: session in, outcome out
The faceweb/app/bela/page.tsxA chat page with confirm buttons

Plus the self-training loop: bela/train.mjs (retrain from config + corrections + memory), bela/bela-memory.md (the hotel's own editable memory), and bela/golden.mjs (replay real staff phrases before every deploy).

The 25 tools

Everything a signed-in user can do through the app's own permission system, Bela can do — that is the integration rule, enforced by deriving Bela's role gates from the app's can(role, action) table so they can never drift.

What the safety model did in practice

What the learning loop measurably did

  1. Distillation: a locally-hosted Qwen3-4B (llama.cpp, CPU) generated 224 realistic staff phrasings across the tools in 69.5 seconds — one time. They became permanent training data. No cloud, no API keys, no runtime LLM.
  2. Memory: bela-memory.md — a plain markdown file the hotel owns — taught phrases ("wich rooms are occupied and by whome") and vocabulary: an ## Aliases section maps "chai"/"tea" to the POS's actual "Doodh Patti (per cup)" row, feeding the entity resolver directly.
  3. Result: a 16-phrase human test set (Roman-Urdu, typos, phrasings no template covers) went 9/16 → 15/16. Retraining takes ~6 seconds on one CPU core; the model artifact is ~8 MB.

Deployment notes (the honest part)

What it proved

A production business app gained a natural-language operator — bilingual, safe, auditable, self-improving — for the cost of one config file, on hardware it already had. Latency is milliseconds because nothing leaves the box; vocabulary keeps growing because corrections are one file-edit away; and if every network beyond the VPS died, Bela would not notice.


Numbers in this document are from the integration test bed and live deployment, July 2026. See the whitepaper for the engine itself.