Agency Agentic System
Back to AI Automation
AI AGENTS & ORCHESTRATION

Agency Agentic System

Multi-agent AI platform with n8n orchestration, LangGraph reasoning, and real-time dashboard

A production-grade agentic system combining n8n workflows with LangGraph StateGraphs for AI reasoning. 6 specialized agents handle content creation, lead generation, SEO, design, and security monitoring — all unified through a Next.js dashboard with approval workflows and analytics.

THE PROBLEM

Manual content creation across social channels was inconsistent and time-consuming

Lead generation and CRM lived in scattered spreadsheets

No approval gates for AI-generated content before publishing

Zero security monitoring or threat analysis

No unified dashboard for analytics and operations

THE SOLUTION

  • Hybrid n8n + LangGraph architecture — n8n handles integrations, LangGraph powers AI reasoning
  • 6 specialized AI agents with PostgreSQL memory and quality gates
  • Next.js 15 dashboard with real-time status, approvals, and analytics
  • Dedicated security agent with prompt injection defense and audit logging

SYSTEM ARCHITECTURE

5 Components
  • Webhook POST trigger with idempotency key support
  • Feature-flagged routing: n8n LLM path or LangGraph StateGraph path (zero-downtime migration)
  • LangGraph Router agent: task decomposition → plan parsing → safety nets → validation → keyword fallback
  • Multi-agent pipeline with conditional IF gates dispatching to 6+ agent workflows
  • Standard response envelope aggregation from all executed agents

SYSTEM VISUALS

Agency Dashboard Overview
Dashboard overview showing agent status cards, recent activity feed, media bento grid, and weekly targets
Agent Detail Page
Agent detail page with animated avatar states (idle, working, success, error) and run history
Media Gallery
Media gallery with bento grid layout, approval actions, and Supabase-hosted image previews
Design Systems Page
Design systems page showing web components, color palettes, page layouts

AGENT ARCHITECTURE

AuraContent

Content Creator
  • LangGraph StateGraph with session memory — tracks generated topics/hooks across requests to prevent repeats
  • Generates content for 6 platforms: IG, FB, WEB, LinkedIn, YouTube, Newsletter
  • NovaOps quality review gate with automatic retry on compliance failures
  • Reads 30-day content memory + deduplicates via content fingerprint (topic + hook + platform hash)
  • 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
  • LangGraph StateGraph with three-pass pipeline: ReAct Research Agent (Google Search tool) → Content Generation (gpt-4.1) → Content Scoring → NovaOps Quality Gate
  • Quality gate retry loop — if score < 60 or NovaOps compliance fails, regenerates with targeted feedback (max 2 retries)
  • 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
  • Generates full SEO/AEO content with JSON-LD schema, delivered as Google Docs via automated pipeline

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

Webhookn8n RouterSecurity ...LangGraphAuraConte...LocalSparkRankRitualGFXDesign...PaladinNovaOps G...AggregateDashboard

IMPLEMENTATION STEPS

  1. 1.Designed PostgreSQL schema with 12+ tables for idempotency and memory
  2. 2.Built Agency Router — webhook trigger, LLM planning, multi-agent dispatch
  3. 3.Implemented AuraContent agent with 30-day memory and 6-platform support
  4. 4.Created LocalSpark lead generation with Google Places API and CRM upserts
  5. 5.Built RankRitual SEO agent as LangGraph StateGraph with quality gates
  6. 6.Developed GFXDesigner for AI image generation and video rendering
  7. 7.Added Paladin security agent with prompt injection scanning
  8. 8.Deployed Next.js dashboard with 10 pages and real-time agent tracking

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

  • Hybrid n8n + LangGraph architecture — n8n for integrations, LangGraph for stateful AI reasoning
  • Python FastAPI service deployed on Railway with feature-flagged rollout for zero-downtime migration
  • LangGraph StateGraphs with ReAct tool use, conditional retry loops, and NovaOps quality gates
  • 21+ n8n workflows orchestrated through a Router with LLM-based multi-agent planning
  • PostgreSQL memory layer with UPSERT deduplication, 30-day context windows, and session-level topic tracking

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