AI Copilot
A multi-agent AI copilot embedded across web and WhatsApp — GPT-4o, Claude and Groq with RAG, function calling and real-time streaming.
- Vercel AI SDK
- OpenAI GPT-4o
- Anthropic Claude
- Groq / Llama
- pgvector
- TypeScript
- Next.js
- PostgreSQL

Challenge
Support and operations teams across 100+ organizations were drowning in repetitive questions and manual lookups spread across billing, scheduling and CRM data. They needed answers grounded in their own tenant data — not a generic chatbot — available where they already worked: the web app and WhatsApp.
Solution
I built a provider-agnostic, multi-agent copilot on the Vercel AI SDK. A router agent picks specialist agents and tools via function calling, retrieves grounded context with RAG over pgvector, and streams responses token-by-token to both web and WhatsApp. Model choice (GPT-4o, Claude, Groq/Llama) is abstracted behind one interface so we route by cost, latency and capability.
Overview
The AI Copilot is a production feature embedded in a multi-tenant SaaS, giving each organization a grounded assistant over its own data. It runs across the web application and WhatsApp, sharing one backend and one agent runtime.
Architecture
- Router + specialist agents — a lightweight router classifies intent and delegates to specialist agents, each exposing a focused set of tools via function calling.
- Grounded retrieval — a RAG pipeline over pgvector injects per-tenant context (documents, records, settings) with strict row-level isolation, so answers never leak across organizations.
- Provider-agnostic models — GPT-4o, Claude and Groq/Llama sit behind a single interface; the router picks a model by cost, latency and capability, with automatic fallback.
- Streaming everywhere — responses stream token-by-token to the web UI and are chunked for WhatsApp delivery, keeping perceived latency low.
Engineering focus
The hard parts were reliability and safety, not the demo: tool schemas that the model calls correctly, tenant isolation in retrieval, deterministic fallbacks when a provider degrades, and full observability (traces, costs, error tracking) so the feature could be trusted in production.
Impact
- Deployed across web and WhatsApp for 100+ organizations
- Function calling over real tenant tools (billing, scheduling, CRM)
- RAG with pgvector for grounded, per-tenant answers
- Provider-agnostic routing across GPT-4o, Claude and Groq
- Real-time streaming UX with graceful fallback and observability
More work

Billing Engine
A provider-agnostic payments and billing engine handling charges, subscriptions, splits and automated Brazilian tax invoices across Asaas, Stripe and Starkbank.

WhatsApp Automation
Transactional notifications, cadence engines and conversational scheduling over the WhatsApp Business API — cutting manual follow-ups by 80%+.