AnatomyThree layers, one nerve cord
Shaped like an insect, not a brain
A brain is one large thing that must always be present. An insect's nervous system is a chain of small ganglia that keep working when you take the head off. Bela is built the second way — on purpose.
Deterministic reflexes handle the overwhelming majority of real commands. The self-trained network catches the paraphrases nobody wrote down. Behind both sits a socket, not a dependency: the interface the neural fallback plugs into is the same one an LLM adapter will plug into. Cut the head off and the insect keeps walking.
The knowledge base is a periodic pull: every entity you declare has a resolve() that returns its current rows — a Prisma query, a SQL call, an API fetch, your code. A sync failure keeps the last good snapshot rather than degrading the agent.
export default defineAgent({
entities: {
Room: { resolve: () => prisma.room.findMany(), match: ["number"] },
MenuItem: { resolve: () => prisma.menuItem.findMany(), match: ["name", "aliases"] },
},
tools: [
tool("orderFood", {
params: { qty: number({ default: 1 }), item: entity("MenuItem"), room: entity("Room") },
utterances: ["order {qty} {item} for room {room}", "{item} for room {room}"],
run: ({ item, room, qty }) => api.post("/api/orders", { itemId: item.id, roomId: room.id, qty }),
}),
tool("cancelBooking", {
params: { guest: entity("Guest") },
utterances: ["cancel {guest} booking"],
confirm: true, // never runs on a fresh match
roles: ["manager"], // anyone else gets `denied`
run: ({ guest }) => bookings.cancel(guest.id),
}),
],
})
bela train prints intentAcc / slotExact / testCount and refuses to save the artifact if it misses the quality gate. A config change that quietly wrecks model quality cannot ship.