Skip to content
John Ndigirigi
WorkAboutWritingResumeContactBook a call (opens in a new tab)
  • Work
  • About
  • Writing
  • Resume
  • Contact
Book a call (opens in a new tab)
John Ndigirigi

Full-stack & AI Engineer · Nairobi, working remotely worldwide.

  • Work
  • About
  • Writing
  • Resume
  • Contact

© 2026 John Ndigirigi

Built with React + Vite + Tailwind

All writing
  • AI
  • WhatsApp
  • Architecture
  • Mobile

WhatsApp as a Production API Surface: Building AI-Native Apps for Low-Bandwidth Markets

14 May 2026 · 6 min read

The assumption baked into most product thinking is that the user interface is a screen, a web app, a mobile app, a dashboard with charts. In much of sub-Saharan Africa, that assumption breaks down. The interface that reaches the most people, with the lowest friction, with the highest daily engagement, is WhatsApp.

This is not a novel observation. What is less explored is what it means architecturally to build AI-native products with WhatsApp as the primary surface, not a notification channel, not a support escalation path, but the actual product interface where users do their real work.

Why WhatsApp Works Where Apps Do Not

Mobile apps require installation, account creation, and onboarding. For users who have never downloaded an app from an app store, or who manage data usage carefully, each of these steps is a real barrier. WhatsApp is already installed, already trusted, and already habitual, the same app people use to coordinate with family, settle debts, and share market news.

The interaction model also matches natural behaviour. Farmers already share voice notes, photos of produce, and price updates with each other over WhatsApp. A system that receives farm data the way a person receives it, "harvested 50kg tomatoes today, Wakulima Market is paying 80 per kilo", asks nothing new of the user. The AI layer is invisible. The operational intelligence it produces is not.

For MavunoStudio, the entire user experience for farmers is WhatsApp. There is no mobile app to install, no website to navigate, no account to create. A farmer sends messages the way they would send them to a knowledgeable contact. The system handles the rest.

Parsing Natural Language into Structured Data

The first technical challenge is extracting structured data from unstructured natural language. "Harvested 50kg tomatoes today, Wakulima is paying 80 per kilo" needs to become a validated record before it can be stored or acted on.

interface HarvestRecord {
  event_type: 'harvest';
  produce: string;
  quantity_kg: number;
  market?: string;
  price_per_kg?: number;
  currency: string;
  date: string; // ISO 8601
}

This is an LLM extraction task, and it works reliably when given a strict JSON schema and clear handling instructions for ambiguity. The specific details that matter in production:

Define the schema first. The target structure should be a Zod schema (TypeScript) or Pydantic model (Python) that serves as both the extraction specification and the runtime validation layer. The model needs to know exactly what it is producing.

Handle ambiguity explicitly rather than silently. "I sold 50 kilos", sold to whom, at what price? The extraction prompt should either request clarification or flag the record as incomplete for human review. Silent defaults are data quality debt that compounds. A crop entry with a null price because the model defaulted quietly is worse than no entry at all.

Validate before storing. LLM output is not always valid structured data. A parse-validate-store pipeline with explicit error handling for extraction failures is not optional. The failure path should return a friendly clarification request, not a 500 error.

Multi-Turn Conversation State

WhatsApp conversations are ongoing. A farmer does not send one message and disappear, they have a continuous relationship with the system across days, weeks, and months. Managing state across sessions is the core infrastructure challenge.

Each WhatsApp number maps to a user. Each user has an active conversation context, what was the last intent, what confirmations are pending, what queries are open. When a message arrives, it is routed against that context: is this a new query, a continuation of a previous one, or a response to something the system asked?

LangGraph's checkpointing layer handles this at the agent level. The agent state is persisted after each node and rehydrated when a new message arrives for the same session. A session boundary (no message for a configurable period) resets the context. The state object explicitly tracks conversation phase, pending confirmations, and open sub-tasks, not just the message history.

The alternative, storing conversation context in a custom database table and threading it manually through API calls, works until it does not. Session edge cases (concurrent messages, network retries, duplicate webhook delivery) are where it breaks. LangGraph handles these at the framework level.

Agent Routing

Not every message needs the same agent. The entry point of the LangGraph graph is a router node that classifies intent and directs to the appropriate sub-graph:

  • Market price queries → market intelligence agent
  • Buyer matching or outreach → buyer engagement agent
  • Farm tracking updates → farm intelligence agent
  • Payment requests → payments agent
  • General questions → general assistance agent

The router runs on every incoming message and should be fast and cheap. A lightweight model with a structured few-shot prompt works well, the classification task is simple and the examples are finite. Using the same model for routing as for the actual agent work is costly and unnecessary. In practice, GPT-4o-mini with five representative examples handles the classification reliably at a fraction of the cost of GPT-4o.

The router also handles the ambiguous case: if a message spans multiple intents ("I harvested 50kg of beans and I need a buyer"), it can either route to the most likely primary intent and note the secondary one in state, or split into parallel sub-graphs if the intents are independent.

What Operators See

The WhatsApp interface is invisible to operators and buyers. They interact through a React dashboard that shows the same data the agents work with: farm inventory levels, price data, buyer-farm relationships, pending orders, and the human escalation queue.

The escalation queue is where messages the agents could not handle surface for human review. An operator can read the context, respond on behalf of the system, and mark the escalation resolved. Escalation rate is a product health metric. If it trends upward, something in the agent layer broke or the input distribution shifted in a way the agents were not trained for.

Fallback Handling

Every production system needs a degradation path. The fallback hierarchy for MavunoStudio:

  1. Agent-level retry with clarification: the agent asks for the missing information in plain language before giving up
  2. Acknowledged-but-pending: the system confirms receipt and flags for human review with an estimated response time
  3. Static helpful response: the system provides the most useful static response it can and logs the full context for analysis

The third tier exists for cases where something breaks unexpectedly, a tool call that returns malformed data, a model that returns a refusal for an innocuous agricultural query, an API timeout during a payment flow. Users should never see an unhandled error. They should always receive a response that tells them what happened and what to do next.

The Property That Makes This Work

A WhatsApp-native AI product inverts the traditional onboarding funnel. Users do not need to understand the system before using it, they just message. The product meets the user where they are, in the interface they already use, in the language they are already comfortable with. The cognitive load is on the system, not the user.

For smallholder farmers tracking harvests and market prices, the interaction surface is indistinguishable from messaging a knowledgeable contact. The AI layer is invisible. The operational intelligence, market price alerts, buyer connections, farm performance tracking, payment settlement, is what matters.

← OlderPre-Rotation: How KERI Commits to Future Keys Before You Need ThemNewer →AI Credit Scoring Without the Black Box: Explainable Loan Risk for Cooperative Finance