Full Stack Developer & AI Engineer
AgentePro
AI WhatsApp sales agent for Brazilian clinics — state machine-driven lead qualification, objection handling, and Google Calendar booking in under 5 seconds

Overview
AgentePro is a multi-tenant SaaS platform that gives Brazilian clinics an AI sales agent on WhatsApp. When a potential patient messages a clinic's number, the agent responds in under 5 seconds — not with a generic greeting, but with a strategically designed conversation flow that qualifies the lead, builds value, handles objections, and books the appointment directly into Google Calendar. The platform ships with two portals: a Platform Admin dashboard for monitoring all clinics, revenue, and system health; and a Clinic Admin dashboard giving each clinic full control over leads, bookings, knowledge base, services, professionals, and agent personality.
The Challenge
Brazilian clinics were losing the majority of their inbound WhatsApp leads simply because staff couldn't respond fast enough — by the time someone replied hours later, the lead had already contacted a competitor. The solution couldn't just be a chatbot that forwards messages to GPT and hopes for the best: it needed to follow a psychologically designed conversion flow, stay on-script, never hallucinate prices or services, and work 24/7 without human intervention across multiple completely isolated clinic environments.
How We Solved It
State Machine Conversation Engine
A rigid state machine — not free-form AI — controls every conversation. Explicit nodes (New Lead → Qualification → Value Building → Objection Handling → Booking → Confirmation → Reminder → Survey) with defined valid transitions mean the bot literally cannot go off-script. GPT-4 only decides how to phrase each response, never what to do next. Every AI response is validated before sending: price checked against clinic config, scope enforced per state, length limited for WhatsApp.
Multi-Tenant Architecture with Full Isolation
PostgreSQL Row-Level Security policies on every table mean each clinic's leads, conversations, bookings, and settings are completely invisible to other tenants — enforced at the database level, not just application code. Each clinic gets its own WhatsApp number, Google Calendar, bot personality, service catalog, and professional team. Adding a new clinic is a configuration form, not custom development.
Real-Time Google Calendar Booking
The booking service checks live Google Calendar availability per clinic, filters by doctor schedules and business hours, excludes blocked days, and creates calendar events with slot conflict protection via Redis TTL reservation. Confirmation messages include the full appointment details. A Celery job fires a 1-hour reminder to reduce no-shows.
Knowledge Base & Agent Personality
Each clinic uploads documents (PDFs, DOCX, TXT) to a knowledge base that gets chunked and indexed for semantic search — the agent answers questions about services, pricing, and policies from this indexed content. Agent personality is fully configurable per clinic: name, tone/style, greeting message, and fallback message, with a live WhatsApp preview in the dashboard.
Platform Admin & Clinic Admin Portals
The Platform Admin portal gives the SaaS operator a full view across all clinics: total clinics, leads today, platform-wide booking rate, total estimated revenue, conversation volume chart, per-clinic health status, and system health monitoring (Supabase, OpenAI, Twilio, Redis — all with real-time operational status). The Clinic Admin portal gives each clinic their own dashboard: leads with AI scoring, bookings by service, estimated revenue, conversion rate, and a logs viewer for operational errors.
Follow-Up Automation & Satisfaction Surveys
Celery workers manage automated follow-up sequences at 24h, 3d, and 7d for leads that don't book. Post-appointment satisfaction surveys collect 1–5 ratings stored against bookings and surfaced on the dashboard. No-show tagging marks missed appointments for future re-engagement campaigns. Human handoff detection flags leads showing frustration or asking out-of-scope questions directly in the dashboard.
Landing & Authentication
Platform Admin — Overview & Clinics
Platform Admin — Users & System Health
Clinic Admin — Dashboard & Leads
Clinic Admin — Knowledge Base & Settings
Agent Personality, Users & Logs
Results & Impact
< 5s Response Time
From inbound WhatsApp message to AI-generated reply delivered — under 5 seconds at p95, beating every human staff response time.
50% Lead-to-Booking Conversion
Platform-wide booking rate across 6 live beta clinics — tracked in real time on both the platform and clinic dashboards.
R$ 2,550 Estimated Revenue Tracked
Cumulative estimated revenue calculated from bookings × configured service prices, visible to both platform admin and each clinic.
6 Live Beta Clinics Onboarded
Multi-tenant architecture handling 6 fully isolated clinic environments, each with their own WhatsApp number, calendar, services, and agent.
Zero Cross-Tenant Data Leakage
PostgreSQL RLS policies enforced at database level — even a buggy query cannot surface another clinic's data.
Full System Observability
Real-time system health monitoring across Supabase, OpenAI, Twilio, and Redis with recent error logs visible to the platform operator.
Technical Architecture
Have a similar project?
I'm open to freelance projects and full-time roles. Let's build something great together.