
https://miyai.ai is our own product, built end to end by the Adaptive Media team. It is used by businesses to answer customers on the web, over messaging and on the phone — every answer grounded in their own content. Because we own the platform, the architecture below is not theory: it is running in production, under real traffic, today.
The brief
Most "AI chatbots" are a thin wrapper over a language model. They hallucinate, they cannot take actions, and they fall over the moment a business needs multi-tenancy, auditability or a phone line. We set out to build the opposite: an AI-native platform where retrieval, tool use, guardrails and evaluation are core primitives of the system rather than features added later.
- Answers must be grounded in customer content, with citations.
- One knowledge layer must serve chat, voice and API equally.
- Voice must feel human — sub-second, interruptible, natural.
- Every tenant's data must be isolated and every action auditable.
- Deployment must take minutes, not an integration project.
1. The backend: multi-tenant and event-driven
The core is a TypeScript service layer over Postgres, designed for strict tenant isolation from the first migration. Every table carries a workspace key enforced at the database level, so retrieval, logs and analytics can never leak across accounts. Long-running work — document ingestion, embedding, transcript processing, CRM sync — runs on queued workers so the request path stays fast and failures retry safely.
- Storage: Postgres for relational data and
pgvectorfor embeddings, object storage for source documents and call recordings. - Streaming: WebSocket and server-sent-event transports so tokens render as they are generated in both chat and voice.
- Model routing: a provider-agnostic layer that picks the right model per task and fails over automatically when an upstream provider degrades.
- Observability: every request traced with latency, token cost, retrieved sources and tool calls attached.
2. The RAG engine: grounded answers, not guesses
Retrieval-augmented generation is the heart of Miyai. Customer content — websites, PDFs, help centres, price lists, policy documents — is crawled or uploaded, then passed through an ingestion pipeline that normalises, semantically chunks and embeds it. At query time we run hybrid search (vector similarity plus keyword matching), re-rank the candidates, and only then hand a tight, relevant context window to the model.
- Semantic chunking that preserves headings and table structure.
- Hybrid vector + BM25 retrieval with a cross-encoder re-rank pass.
- Citations returned with every answer so claims are checkable.
- Confidence thresholds — below them the agent says it does not know and hands off, instead of inventing an answer.
- Continuous re-crawl so the knowledge base tracks the customer's live content.
3. AI chat agents in production
The chat layer is a streaming agent with tool calling. It can look up knowledge, qualify a lead, create a CRM record, check availability, book a meeting or escalate to a human — all inside one conversation. Deployment is a single embed script, and the same agent runs across website, WhatsApp, Messenger and Instagram without rebuilding logic per channel. Read more about how we deploy these for clients on our AI chat agents page.
4. Production-grade AI voice
Voice is where most AI products break. Miyai runs a streaming speech-to-speech loop: audio is transcribed incrementally, the agent begins reasoning before the caller finishes, retrieval hits the same RAG index used by chat, and speech is synthesised in chunks so the reply starts almost immediately. Barge-in lets callers interrupt, and warm transfer hands the call to a human with full context. Every call produces a transcript, a summary and structured outcomes written back to the CRM. This is the same stack behind our AI voice agents and AI receptionist services.
5. Guardrails, evaluation and reliability
Shipping AI to real customers means treating prompts like code. Every prompt or retrieval change runs against a golden set of question and answer pairs before release, with regressions blocking the deploy. Prompt-injection filters strip hostile instructions out of retrieved content, tool permissions are scoped per workspace, and PII is redacted from logs. Rate limits, circuit breakers and provider failover keep the platform up when an upstream model does not.
Results
- A single AI platform serving chat, voice and API from one knowledge layer.
- Sub-second first-token responses on chat and near-human turn latency on voice.
- Grounded, cited answers that materially reduce hallucination.
- Minutes-to-deploy onboarding instead of an integration project.
- A repeatable architecture we now apply to client platforms.
What we can reuse for you
Miyai gave us a battle-tested blueprint for AI-native software: ingestion and RAG, streaming agents, voice pipelines, evaluation harnesses and the boring-but-critical operational layer around them. If you are planning an AI product — or adding a real AI layer over existing systems — see our AI consulting, custom software development and AI agents services, or explore the platform at https://miyai.ai.
Production backend
Multi-tenant Postgres schema with row-level isolation, queue-driven workers, webhooks, rate limiting and full audit logging of every AI interaction.
RAG knowledge engine
Semantic chunking, pgvector embeddings, hybrid search with re-ranking and cited, grounded answers that stay current as source content changes.
AI chat agents
Streaming website and messaging agents with tool calling, lead capture, human handoff and per-brand tone control — deployed by a single embed script.
AI voice agents
Sub-second speech-to-speech loop with barge-in, call transfer, booking actions and transcripts written straight back into the CRM.
Guardrails & security
Prompt-injection defences, PII redaction, scoped tool permissions, tenant-scoped retrieval and encrypted storage of documents and recordings.
Evaluation & observability
Golden-set regression tests on every prompt change, latency and cost tracing per request, and dashboards that surface failed or low-confidence answers.
Stack at a glance
- TypeScript / Node service layer
- Postgres + pgvector hybrid retrieval
- Queue-based ingestion & embedding workers
- Streaming chat over WebSockets
- Realtime STT → LLM → TTS voice pipeline
- Tenant isolation, PII redaction, audit logs
