Arabic-first agentic generation for public-sector workflows
Sanitized production case studyRole · AI-layer lead — architecture and implementation
Production multi-agent system generating Arabic-first content for government workflows, with deterministic orchestration and an evaluation suite gating every release.
Problem
A large legacy prompt builder had become impossible to test, debug, or evolve. Arabic outputs needed structural guarantees that ad-hoc prompting could not provide, across multiple content types.
My responsibility
Architected the AI layer end-to-end: agent orchestration, a declarative prompt-composition engine, and the evaluation harness. Also contributed retrieval, backend integration, and production debugging.
Key decisions
Replace imperative prompt building with a declarative, state-gated prompt-composition engine — a graph of independently testable sections.
Wrap AutoGen agents in explicit state machines with timeouts, retries, and partial-result handling.
Gate every release with a comprehensive end-to-end suite that uses LLM-as-judge scoring for Arabic outputs.
Stream agent state over WebSockets to keep long-running workflows observable.
Drive multiple content modules (press release, infographic, poster, image, photograph, script, captions) through one orchestrated pipeline.
Architecture
~½
prompt size cut by roughly half in approved states
Graph
large legacy builder refactored into independently testable sections
System architectureA1 · data flowInput enters a WebSocket gateway, routes to an orchestrator wrapping each agent in an explicit state machine. Agents read prompt-engine definitions and a retrieval store, emit structured content, and an LLM-as-judge gates the result before it streams back.From a large legacy builder to a testable graphA2 · refactorOne imperative builder became a declarative graph of independently testable sections, each gated by state and tested in isolation. Sections drop out of REVIEW and APPROVED prompts, cutting prompt size by roughly half without touching the others.
Stack
Python
AutoGen
Azure OpenAI
WebSockets
Playwright
PostgreSQL
Arabic NLP
Outcome
· The prompt engine decomposed the legacy builder into independently testable sections, cutting prompt size by roughly half in approved states.
· Retired the legacy orchestrator behind the regression-gated suite with no observed regressions.
· One orchestrated pipeline now generates across multiple content types — press release, infographic, poster, image, photograph, script, captions.
Known limitations
· Sanitized details only — client-specific architecture and corpora are not public.
· LLM-as-judge requires periodic human calibration to remain trustworthy.
· Client details and specific figures are sanitized and available under NDA during a technical interview.
Sanitized details available during technical interview.