Luna – AI Marketing Agent Platform

An AI agent system named "Luna" that understands business context and converts natural language into ready-to-deploy advertising campaigns — powered by LLMs, RAG, and multi-agent orchestration.

Client
Marketing Agencies & Businesses
Discipline
AI Agent & Marketing Automation
Built with
OpenAI API · LangChain · NestJS · Vector Databases · Meta Graph API · RAG Pipeline

Overview

Marketing Agencies & Businesses

Built an integrated AI system — not just API wrappers. The idea was to create an agent that understands business and converts natural language into ready-to-deploy ad campaigns. Luna is built as a system with orchestration between multiple components: advanced Prompt Engineering to control model reasoning (not a single prompt, but structured prompts with different states based on context), Retrieval-Augmented Generation (RAG) to connect the model to external data (business info, past campaigns, audience insights) instead of relying on general knowledge only, dynamic Prompt Enhancement based on user inputs and conversation context, and specialized Agents responsible for different stages (analysis → planning → execution → publishing).

The challenge

What was not working

Creating effective ad campaigns requires deep understanding of business context, audience targeting, platform-specific requirements, and creative strategy. Existing tools either required significant manual effort or produced generic, low-quality outputs. The challenge was building an AI system that could reason about marketing strategy, access business-specific data, and execute campaigns across platforms — all from a simple natural language conversation.

The solution

What I built

Used LangChain for managing flows between the LLM and different tools. Connected multiple models — primary models for understanding and generation, lightweight or local models for certain tasks to reduce cost and improve speed. The system separates reasoning from execution — the AI thinks first, then executes via APIs like Meta. For RAG: stored campaign data and context in a vector store, implemented intelligent retrieval per request, and used this data to improve output quality instead of generic responses. The full pipeline: User Input → Understanding → Context Retrieval → Strategy Generation → Campaign Structuring → API Execution. The system is designed for extensibility — adding new Agents or tools is straightforward.

Stack

06 parts

What each part of the system does, from the screens the team uses to the services that send messages and reports.

AI serviceOpenAI APIMatches and ranks options for each profile
ToolLangChain
ToolNestJS
ToolVector Databases
ToolMeta Graph API
ToolRAG Pipeline
Next case study · 04 · Full-Stack DevelopmentEthraa – Student Contract Management PlatformOpen case study