Mahdi Bani

I build and operate production LLM systems. Most of my work is the half that breaks at 3am: reliability, cost, and guardrails.

Right now that means two systems in production. A document-AI platform on Azure, where I own the pipeline: 54 document types, 438 tests in CI, inference cost cut 5.7× per document. And a real-estate platform where I am the only engineer, from the WhatsApp and voice agents down to the DNS.

Tunis. Open to AI and backend engineering roles anywhere, remote or on site. I will relocate.

GitHubLinkedInEmail

Selected work

  1. AI engineer

    Classifies and splits scanned German occupational pension paperwork. Multi-tenant, Azure, queue-driven.

    • 54 document types, 438 tests running in CI.
    • Cut inference cost 5.7× per document by designing around a cheaper model instead of buying a better one.
    • Shipped the cheaper pipeline over a more accurate ensemble that cost 40% more and added 170 seconds of latency per document.
    • Contained a DSPy major-version break and a compromised litellm release inside an hour each, before either reached a user.

    Python · DSPy · GPT-4o vision · Azure Functions · FastAPI · PostgreSQL · Docker · GitHub Actions

    Read the writeup

  2. AI technical lead, only engineer

    A CRM, a public listings site, and sales agents that answer on WhatsApp and by voice. I am the entire engineering function.

    • 20 API services and 18 data models, row-level multi-tenant, per-tenant encrypted credentials.
    • Replaced roughly seven manual tools for a company with no other engineers.
    • Migrated a WordPress property database that kept about 90% of every record inside one serialized PHP blob.
    • Moved the live domain, and the Microsoft 365 mail riding on it, between registrars with no downtime.
    • Absorbed a Meta WhatsApp API migration and a voice-stack rewrite without users noticing either one.

    Python · FastAPI · Celery · PostgreSQL · Next.js · Claude tool-use · WhatsApp Business API · Deepgram · ElevenLabs · Microsoft Graph · Docker

    Read the writeup

  3. Personal project

    A retrieval-augmented email assistant that drafts replies from your own past threads.

    • Ran three weeks on random-number embeddings before anyone noticed, because the drafts still read as confident.
    • That failure is the reason the project now asserts on retrieval quality instead of on response shape.

    Python · DSPy · Qdrant · Groq · Llama 3 70B · Gmail API · FastAPI · Next.js

    Read the writeup

  4. Open source

    2026

    Fixes to projects I run myself, which is the only reason I found the bugs.

    • Chutes: passing a Pydantic model class as an output schema stored the class object itself, so deploying crashed on JSON serialization. Converted at construction, with a fallback handler behind it. Merged.
    • Macrocosmos data-universe: miners could inflate their job coverage rate by uploading parquet files with zero rows, because coverage counted file paths rather than content. Coverage now requires at least one row. Open.

    Python

    chutesai/chutes #67macrocosm-os/data-universe #803

More on each of these

Found in production

  • A CI job that failed 25 times in a row while printing "Tests completed successfully".

  • Three weeks of a retrieval pipeline running on random-number embeddings. The answers still came back confident.

  • A publish button, validated and role-gated, POSTing to a WordPress API that had been gone for a year. It failed silently every time.

  • One stale row in a denormalized JSONB column conjured a whole filter category on a public site. The edit form labelled it "current", so it read as something a person had done on purpose.

  • A vision model that found 61 document boundaries on one run and 90 on the next. Same document, same prompt, temperature zero.

Every one of these cost me a day I did not plan for. They are also the reason I write guardrails before I write features.

Writing

All writing

Contact

Email reaches me fastest. If you want to talk about a role, tell me what breaks in your system today and I will tell you whether I have fixed that before.

bani.mahdi666@gmail.com