Skip to content
FAHD MOHAMED
All work

Professional work · Tool-calling agent · WhatsApp · Messenger · Instagram

Omnichannel AI Messaging Agent

A customer-service and lead agent on WhatsApp, Messenger and Instagram, with guardrails, human handoff and an evaluation suite.

eval cases passed; safety gate not yet passed
198/204
eval cases passed; safety gate not yet passed
source: evals/reports/2026-11-02…json
Meta channels
3
Meta channels
source: src/channels/*
agent tools
4
agent tools
source: src/agent/*
safety gates
3
safety gates
source: evals/run.ts
Staff inbox: a conversation where the agent captured a lead

The problem

Customers message at all hours across three Meta channels. A chatbot that invents prices or promises is worse than no chatbot, and staff need to take over the moment a conversation needs a human.

My role

  • Engineered the system: AI agent architecture, LLM integration, guardrails, evaluation suite and staff inbox

Engineered during my role as AI & Software Engineer at Elenor Marketing Agency, Cairo (Jan 2026 – present). Screenshots come from sanitized demo environments: client and business data are replaced with demo data.

What it is

A Fastify service receives signed Meta webhooks, queues each turn in Postgres, and runs an agent that can only search staff-approved knowledge, save leads, request a human or report that it is confused. Replies go through an outbox with retries and dead-letter alerts. Staff get an inbox to take over conversations, approve knowledge, review leads and switch each channel between off, shadow and live, plus an emergency stop.

Key features

  • Meta Graph API webhooks for WhatsApp Cloud, Messenger and Instagram, verified with HMAC signatures
  • Tool-calling agent: search_knowledge, save_lead, request_human, report_confusion
  • Answers only from knowledge a staff member approved, ingested from the website
  • Per-turn tool limits plus per-conversation and per-day spend caps
  • Channel modes off / shadow / live, and an emergency stop
  • Outbox with retries, dead letters and email alerts; data retention and privacy controls
  • Evaluation suite with an LLM judge and safety gates

Architecture

Channels

  • WhatsApp Cloud
  • Messenger
  • Instagram DMs

Ingress

  • Signed webhooks (HMAC)
  • Debounce
  • pg-boss queue

Agent

  • LLM + tools
  • Approved knowledge
  • Spend caps
  • Handoff rules

Egress & staff

  • Outbox + retries
  • Dead letters + alerts
  • Staff inbox
  • Channel modes

AITool-calling agent constrained to approved knowledge

AIExplicit human handoff and self-reported confusion

AIEvals gated on invented facts, cross-customer leaks and missed handoffs

Stack

Runtime

Node 24TypeScriptFastify 5pg-boss queue

Data

PostgreSQL (Neon)Drizzle ORMzod

AI

OpenAI Responses APITool callingLLM-as-judge evals

Ops

pinoPM2vitestESLint

Engineering challenges

01

Measuring “doesn’t make things up”

The eval suite runs 204 scripted customer conversations and grades them with a judge model. The release gate blocks invented facts, cross-customer leaks and missed handoffs. The latest run passed 198 of 204 cases and the gate was still closed on one invented-fact case. That is exactly what the gate is for.

02

Shadow mode before live

Each channel can run in shadow mode, where the agent drafts replies that are logged but not sent, so its answers can be reviewed on real traffic before it ever speaks to a customer.

The service and staff inbox were run from source against a local database. No Meta or OpenAI credentials were used, so the conversations shown are demo data. The eval numbers come from the project’s own latest report file.

Channel modes, emergency stop and metrics
Inbox with handoff flags
Arabic conversation handed to a human · Demo conversation
Knowledge approval queue
Captured leads

Next project

WASSEL