Alejandro Alvarado
I engineer AI infrastructure
that closes revenue gaps.
Currently: Architecting SoffIA, an autonomous agent that recovers 40% of lost patients for medical clinics via WhatsApp. Zero human intervention. 24/7.
THIS PAGE IN PRODUCTION
Measured via Vercel Analytics. Updated every deploy.
CASE STUDY 01 — SoffIA Core
Architecture of an autonomous agent
01 — The Problem
Dental and aesthetic clinics operate on a brutal conversion window: a lead unanswered for >8 minutes has a ~80% chance of booking with a competitor.
- —After-hours leads: 100% loss rate. Messages received from 8 PM to 9 AM went cold by morning.
- —Peak-hour bottleneck: 47-minute average WhatsApp response time during busy hours.
- —No-show rate: ~25%. Each no-show cost S/200–400 in blocked chair time.
- —Manual errors: Double-bookings and missing reminders were standard.
02 — The Architecture
03 — Key Decisions
01
Reactive FSM (In-Flight Refresh)
Using Vercel AI SDK's prepareStep to inject tools dynamically mid-reasoning, eliminating deadlocks and hallucinated confirmations.
02
Stateless JIT Reminders (QStash)
No cron, no persistent state. A JIT Guard checks appointment validity before each T-24h/T-2h send, killing race conditions cold.
03
Progressive Tool Gating
The LLM only receives tools relevant to its current gate (Identity vs Booking), guided by strict Zod telemetry. Anti-hallucination by architecture.
04
Non-Negotiable Guardrails
Zero-token Noise Guard for IVRs. Strict regex interventions for Code Red, minors, and trolls — triggering instant human handoff.
04 — The Result
| Metric | Before | After |
|---|---|---|
| Response time | 47 min / ∞ (after hours) | < 8 seconds, 24/7 |
| After-hours leads | 0% (100% loss) | 100% captured |
| No-show rate | ~25% | < 8% |
| Booking deadlocks | Chronic (race conditions) | Zero (Reactive FSM) |
OPEN SOURCE PRIMITIVES
resilient-fetcher
TypeScript utility for Next.js that wraps native fetch with exponential backoff, circuit breaking, and UI fallback states.
— In Developmentssr-auth-pipeline
OAuth2 token lifecycle manager for Next.js. Handles access/refresh token rotation entirely server-side. Zero tokens in client-side storage.
— In DevelopmentEngineering philosophy
Network Asymmetry
External APIs fail. Every fetch in my systems carries exponential backoff, circuit breakers, and graceful degradation. The user never sees a broken spinner.
[Read the Essay →]Server-Centric State
Critical state lives on the server. HttpOnly cookies, server-side sessions, zero client-side token storage. The browser is a rendering surface, not a vault.
[Read the Essay →]Deterministic AI
LLMs are non-deterministic by nature. I wrap every model output with Zod schemas and state machines. If it doesn't validate, it doesn't reach production.
[Read the Essay →]The arsenal
| Layer | Technologies | Approach |
|---|---|---|
| Application Platform | Next.js 15, React 19, Tailwind CSS v4 | App Router, Edge Runtime, Serverless, Base-8 Layout |
| Languages & Types | TypeScript (strict), Node.js, Python | Discriminated Unions, Zod, Strict Typings |
| Data & Infrastructure | Postgres, MongoDB, Drizzle ORM, Upstash Redis | Serverless SQL, Mutex Locks, Row Level Security |
| AI & Automation | DeepSeek V4, Llama 4 Scout, Whisper v3 | Vercel AI SDK, FSM Orchestrator, OCR, Function Calling |
| Integrations & Async | Evolution API (WhatsApp), GCal API, QStash | Stateless JIT Jobs, Webhook Idempotency |
Trust signals
Le pregunté si tenía disponibilidad para mañana y en menos de 5 segundos me dio horarios, me pidió mis datos, me registró y me dijo cuánto tenía que adelantar. Todo por WhatsApp. No tuve que llamar a nadie.
— Beta patient, Valoración de Ortodoncia, May 2026
SYSTEM FACT
The production agent handles multi-patient bookings concurrently. Atomic room locking via PostgreSQL FOR UPDATE SKIP LOCKED, payment voucher OCR validation, and Google Calendar bidirectional sync — all within a single Vercel serverless function (60s budget). Zero cold-start failures.
GitHub Activity
27 repos · 3 followers · Active since 2023
Initiate connection
Available for AI infrastructure projects and senior engineering roles. If you need systems that close revenue gaps instead of creating technical debt, let's talk.
Prefer email? devale.alvarado@gmail.com· Response < 4h