The End of the AI Framework Hype: Deterministic Architecture and 0-OPEX with Function Calling
How I built a deterministic, secure chatbot for my technical dossier with $0 operating cost using Mistral AI's native function calling — no LangChain required.
Software development today is suffering a new gold rush: cramming AI into everything, whatever the cost.
As engineers, we got addicted to abstraction. We watch a tutorial, install a heavy framework with hundreds of “magic” dependencies (yes, I’m looking at you, LangChain/LangGraph), and suddenly we have a chatbot running locally. But in production the illusion collapses: sky-high latency, costs that explode from token abuse, uncontrollable hallucinations, and security holes.
I recently redesigned my technical dossier. I wanted an assistant that could guide recruiters through my experience and surface my verifiable certifications. I could have reached for the “hype” stack. Instead, I applied classic software engineering: a predictable, secure system with $0 operating cost (0-OPEX) using Mistral AI.
Here are the three principles, with no marketing gloss.
1. Control lives in the code, not in the prompt
The common mistake is letting the LLM make infrastructure decisions. I did the opposite: the LLM orchestrates nothing. The logic lives in a typed TypeScript Cloud Function, organized by single responsibility at the module level, not as “agents”:
handler.ts— request orchestration and streaming.prompt-builder.ts— assembles the context (profile, experience, FAQ).cert-tools.ts— defines the data functions and executes them.rate-limiter.ts— per-IP limiting.
So where does the LLM come in? In one narrowly scoped place: translating natural language into a function call (Mistral’s native function calling, no intermediary frameworks). The model doesn’t decide how to access the data; it only proposes which function to call. The real access is owned by rigid, typed code.
2. Security by design: the LLM is blind to the infrastructure
The AI has no access to the database or the filesystem. When someone asks “do you have a frontend certificate?”, the flow is:
The LLM never queries files or invents access logic: it only picks a function. The real access is owned by cert-tools.ts. And the last mile —painting the certificate card— happens in the client, which sanitizes every URL before rendering it. The prompt’s attack surface never touches your data: at most, it touches a function selector.
Engineer’s honesty: the final answer is still written by the model, so the rigor isn’t “infallible magic” but defense in depth —deterministic tools + client-side sanitization—. That’s engineering, not faith in a prompt.
3. The 0-OPEX philosophy: efficiency measured in tokens
Integrating AI doesn’t have to break your wallet. Three decisions make it work:
- An efficient frontier model (
mistral-small-latest) on the free tier. - Tools that return only the data needed instead of dumping the entire context every turn.
- Rendering delegated to the client: the LLM doesn’t describe things visually in plain text; it emits a compact marker and the front end turns it into a component. The heavy load goes back to the browser and the API only processes micro-payloads.
It all runs on a static site (Astro) + Firebase Functions: no servers idling, no OPEX.
Conclusion: less magic, more engineering
The value of an AI / Forward Deployment Engineer isn’t knowing which library to install tomorrow. It’s taking probabilistic models and embedding them in deterministic-by-design architectures: the LLM as an intent translator, typed code as the owner of truth.
Next time you wire an LLM into production, take a step back: am I solving this with software architecture, or am I just praying to a prompt that it won’t fail?
Want to see it live? Visit resume.gerardo-reyes.site, open the chat, and ask for my certificates in real time: the AI translates your question into a function, the code returns the data, and the front end paints it.
Architecture diagrams
Component / deployment view
Why it is NOT multi-agent
“Intent routing” is Mistral’s automatic function calling inside a single function, not an orchestrator with sub-agents.
Appendix: verification against the code
Every claim in this document is verifiable in the repository:
| Claim | Evidence |
|---|---|
Mistral AI, model mistral-small-latest | functions/src/chatbot/handler.ts:130,150; functions/package.json (@mistralai/mistralai) |
| A single function, no multi-agent router | handler.ts:79-231 (one chat.complete + toolChoice: 'auto') |
| Native function calling, 4 tools in TS | cert-tools.ts (certificationTools, executeToolCall) |
[CERT:] marker emitted by the LLM + client-side sanitization | prompt-builder.ts:173-188; ChatWidget.astro (CERT_RE, safeUrl) |
| No LangChain / LangGraph | Absent from both package.json files |
| Static site | astro.config.mjs (output: 'static') |
| CV data from Firestore; certificates from JSON | handler.ts:30-74 (getVitaeData); functions/src/data/faq.json |
Comments