
Agency Agentic System
Multi-agent AI orchestration platform with real-time dashboard, security monitoring, and automated content-to-publishing pipeline
A production-grade agentic system built on n8n with 6 specialized AI agents, a centralized Router workflow, PostgreSQL memory layer, and a Next.js 15 dashboard — handling everything from content creation and lead generation to SEO analytics, visual design, video rendering, and security monitoring.
THE PROBLEM
Content creation across social and web channels was entirely manual and inconsistent
Lead generation, scoring, and outreach lived in scattered spreadsheets with no CRM logic
No approval gates meant AI-generated content could publish without human review
Zero security monitoring — no prompt injection defense, audit logging, or threat analysis
Analytics, cost tracking, and operational health were invisible with no unified dashboard
THE SOLUTION
- Built a Router-based orchestration layer that uses an LLM to classify requests and dispatch to the right agent pipeline
- Created 6 specialized agents — each with memory read-before-write, dedupe/idempotency, and standard response envelopes
- Deployed a Next.js 15 dashboard with real-time SWR polling, animated agent status, approval workflows, and Recharts analytics
- Added a dedicated Paladin security agent with prompt injection scanning, indirect injection defense on external content, audit middleware, and Zod validation on all API routes
SYSTEM ARCHITECTURE
- Webhook POST trigger with idempotency key support
- LLM-based plan generation (parses intent → target agents + capabilities needed)
- Multi-agent pipeline with conditional IF gates (Run Content → Run Leads → Run SEO → Run Design → Run Video → Run Security → Run Ops)
- Standard response envelope aggregation from all executed agents
SYSTEM VISUALS




AGENT ARCHITECTURE
AuraContent
Content Creator- Generates social media content (IG/FB) and web pages for meditation, reiki, and wellness niches
- Reads 30-day content memory to avoid topic repetition and stale hooks
- Deduplicates via content fingerprint (hash of topic + hook + platform)
- Stores all output as drafts gated behind human approval
LocalSpark
Lead Generator- Discovers local businesses via Google Places API with radius-based search
- Scores leads on 1-10 scale and upserts into CRM with website-or-name+city deduplication
- Generates personalized outreach drafts (DM and email) stored as unsent templates
- Tracks follow-up cadence with next_follow_up_at scheduling
RankRitual
SEO Strategist- Generates full SEO/AEO page content — meta tags, outlines, FAQ blocks, CTA blocks, internal links
- Fetches and analyzes live web pages with indirect prompt injection scanning on scraped HTML
- Integrates GA4 site analytics with self-healing health checks and freshness-aware reporting
- Maintains reusable SEO asset banks (keywords, FAQs, CTAs) in PostgreSQL
NovaOps
Operations Manager- Generates weekly operational plans with max 3 blocks/day and clear targets
- Reads cross-agent run history, unapproved drafts, and leads needing follow-up
- Provides freshness-aware analytics context (flags stale GA4 data instead of reporting zeros)
- Powers the cost analytics estimation layer on the dashboard
GFXDesigner
Visual Designer- Generates AI images via DALL-E 3 with multi-image batch support (1-5 per request)
- Runs a design system sub-workflow that can scrape reference URLs for style extraction
- Supports reference image analysis via GPT-4o Vision for creative direction matching
- Uploads assets to Supabase Storage and renders video reels from generated images
Paladin
Security Guardian- Scans all inbound requests with weighted regex prompt injection scoring (threshold 8, blocks at match)
- Defends against indirect prompt injection in scraped HTML and Google Search results
- Maintains audit logs via Next.js middleware on all API routes with Zod schema validation
- Computes weekly security scores, tracks threat trends, and escalates critical findings to Discord
WORKFLOW FLOW
IMPLEMENTATION STEPS
- 1.Designed PostgreSQL schema with 12+ tables, unique constraints, and UPSERT patterns for idempotency
- 2.Built the Agency Router workflow — webhook trigger, LLM-based plan generation, multi-agent pipeline dispatch via Execute Workflow nodes
- 3.Implemented AuraContent agent with 30-day memory context, content fingerprint deduplication, and WEB platform support
- 4.Built LocalSpark lead generation with Google Places API integration, lead scoring, CRM upserts, and outreach draft templates
- 5.Created RankRitual SEO/AEO agent with page analysis, Google Search tool, and GA4 site analytics integration
- 6.Developed GFXDesigner pipeline — AI image generation (DALL-E 3), design system sub-workflow, reference image analysis (GPT-4o Vision), and Supabase Storage uploads
- 7.Added GFXDesigner_RenderReel video pipeline for automated reel creation from generated images
- 8.Built Publisher_PostToMeta for Instagram/Facebook publishing with video support (IG Reels + FB Video)
- 9.Implemented Paladin security agent with weighted regex prompt injection scoring, indirect injection defense on scraped HTML and search results, and centralized audit logging
- 10.Deployed Next.js 15 dashboard with 10 pages, 13 API routes, 6 animated agent avatars, media bento grid, cost analytics, and security monitoring
IMPACT & RESULTS
Operational
- Eliminated manual content creation — AI drafts gated behind approval workflows
- Automated lead discovery, scoring, and outreach template generation
- Weekly operational plans generated automatically from cross-agent activity data
- Centralized error handling with ErrorLogger → Google Sheets + Discord alerts
System Architecture
- 21 n8n workflows orchestrated through a single Router with LLM-based planning
- Standard response envelope and agent_runs logging across all workflows
- PostgreSQL memory layer with UPSERT deduplication and 30-day context windows
- Self-healing patterns: onError continuations, health checks, stale run cleanup via SystemMaintenance
Security & Compliance
- Multi-layer prompt injection defense (direct + indirect on external content)
- Full audit trail on every API call with Zod schema validation
- Per-agent permission enforcement with blocked content patterns and rate limits
- Dedicated Paladin agent computing security scores with Discord escalation for critical threats