iHorizons · 2025 - Present
Khateeb Assistant
A grounded Arabic sermon-generation assistant for Khateebs, using retrieval, specialist agents, moderation, and review loops to support Friday sermon preparation while preserving human accountability.
- Role
- AI Engineer
- Client
- Qatar Ministry of Awqaf and Islamic Affairs
- Scale
- Intended to support Khateebs across 1,000+ Qatar mosques
- Focus
- Multi-agent workflows · Religious text moderation · Human review
Project summary
Support Friday sermon preparation through a grounded multi-agent workflow that extracts requirements, retrieves trusted Islamic references, drafts Arabic sermon content, evaluates religious and structural constraints, applies revisions, and prepares a final draft for human review.
Context
The Khateeb Assistant is being developed for the Qatar Ministry of Awqaf and Islamic Affairs, with the intended scope of assisting Khateebs serving more than 1,000 mosques across Qatar. This is a target support scope rather than a claim of completed deployment or current adoption.
The assistant supports sermon preparation. It is not presented as replacing Khateebs, and final human accountability remains essential.
I also built hadith-detector, an open-source offline Python library for identifying Hadith passages and retrieving supporting records from Sahih al-Bukhari and Sahih Muslim. It supports the wording-verification and citation needs of sermon-preparation workflows, with source context retained for human review.
Religious Arabic text generation is sensitive. A useful system must understand the speaker’s requirements, ground its output in trusted references, handle references carefully, organize a coherent sermon, and apply moderation before a draft reaches human review.
The solution was designed as a collaborative multi-agent workflow rather than a single prompt. Specialist agents handle requirement extraction, reference retrieval, outlining, sermon drafting, moderation, revision, word-count adjustment, and finalization.
Constraints
- Source material spans Quranic verses, Hadith, and Arabic Islamic books.
- Generated text must remain grounded in trusted references.
- Requirements vary by topic, audience, length, and intended message.
- Quality cannot be judged by fluency alone; religious grounding, structure, references, and moderation all matter.
- Drafts may need modification, summarization, or extension before they are ready for review.
- Human accountability remains essential for final use.
My role
I built the original POC workflow in n8n, prepared trusted references for retrieval through Google RAG Engine, and implemented collaborating agents for requirement extraction, retrieval, drafting, moderation, revision, summarization, extension, and evaluation.
For production readiness and security reasons, the deployment moved from the n8n POC into Google ADK and Agent Engine. I also developed the evaluation layer used to assess whether a draft satisfies the Khateeb’s requirements, religious constraints, and structural rules.
Agent and retrieval design
The workflow begins by turning open-ended user requirements into structured sermon requirements. Retrieval then supplies trusted references from Quran, Hadith, and Arabic Islamic books. An outline agent plans the sermon structure before a generation agent drafts Arabic sermon content.
Generation is separated from moderation and evaluation. A moderator/evaluator agent reviews the draft against religious, structural, and requirement-based constraints. If issues are found, a modifier agent revises the draft and returns it to the moderation stage.
The workflow also checks word count. If the draft is too long, a summarization agent condenses it; if it is too short, an extension agent expands it. The adjusted draft returns to the word-count check before finalization.
The agents exchange bounded artifacts rather than relying on an unstructured conversation. This makes responsibilities easier to inspect and reduces the chance that one model call silently performs incompatible tasks.
Evaluation and safeguards
The evaluation layer is separate from generation. It checks the draft against extracted requirements, trusted references, moderation rules, structural constraints, and word-count requirements. This separation reduces self-approval bias and makes failures easier to diagnose.
Feedback loops are intentional. A draft can be modified, summarized, or extended before it becomes a final candidate. These automated checks are quality controls, not substitutes for accountable human review.
Internal prompts, exact rubrics, thresholds, source configuration, and service details remain confidential.
Production deployment
The POC was originally built in n8n because it made the agent workflow easy to prototype, inspect, and revise. For production deployment, the workflow moved to Google ADK and Agent Engine to support stronger security, production-readiness, and managed agent execution.
Google RAG Engine supplies retrieval over trusted references, while Vertex AI and Gemini support the model workloads. The public description intentionally avoids internal node-level details.
Results and lessons
The result is a grounded multi-agent assistant designed to support Khateebs across an intended scope of more than 1,000 Qatar mosques. Its main engineering value is the separation of concerns: requirements, evidence, outlining, generation, moderation, revision, word-count adjustment, finalization, and human review remain explicit.
The strongest lesson was that additional agents only help when their contracts are clear. Agent count is not sophistication; inspectable responsibilities, feedback loops, and human accountability are.