Skip to content

AI Engineering · New Zealand

Building an AI Agent for advertisement Targeting & Campaign Planning

We built a system that combines a fast 5-step LangGraph pipeline with a real-time conversational agent to turn raw inputs into structured, cached recommendations and let users refine them via chat. It uses layered memory, tool-driven updates, and strong validation with caching to ensure reliable, efficient results.

Client Overview

About Our Client

A New Zealand-based platform serving marketing, print, and distribution teams. The client supports both offline and digital marketing campaigns, with a domain expert team responsible for translating customer briefs into targeting recommendations, area selection, and channel mix.

Industry
Advertisement
App Type
AI powered Web application
Services
User Onboarding, Census based Catchment analysis, Target Audience AI Recommendation engine & more

Tech Stack

  • Terraform HCL
  • Python 3.12+
  • SQL
  • Terraform HCL
  • & more

Requirement

An AI quoting engine that ingests a website, campaign brief, and supporting PDFs and produces structured advertising targeting in minutes. Geospatial recommendations specific to New Zealand with confidence scores and audience filtering. A hybrid user journey — both an AI conversational agent and a structured form-based workflow. A real-time conversation surface that lets users refine recommendations without losing context. Production-grade reliability: deterministic outputs, audit-ready persistence, no schema drift, graceful degradation under partial failure. Integration with existing systems — Liberty (CRM/ERP) and HubSpot — for seamless lead handoff.

Results

  • 30–32 seconds end-to-end from “click generate” to a complete recommendation set.

  • Idempotent recompute via hash lookup; repeat-quote latency in single-digit seconds.

  • Zero free-form chat hallucination incidents for state mutations.

  • Audit-ready: every recommendation an immutable Postgres row; every conversation replayable from checkpoint.

  • Hybrid grounding (Pinecone proprietary + Tavily web + Gemini structured output) works in production.

  • Scales with adoption, not concurrency: Pinecone namespaces isolate per-campaign vectors; recompute is opt-in.

  • Domain experts now use AI as a starting point, not a competitor — they refine via Becky and ship.

Our Process

Discovery & Architecture

Mapped the manual workflow with domain experts, evaluated three architecture options, selected LangChain on workload-fit + structured-output + observability axes.

Core Solution

  • The Business Intelligence Workflow

    A LangGraph 5-node sequential pipeline that turns business inputs into a structured recommendation set in 30–32 seconds: Input/Scrape → Knowledge Builder → Merge/Retrieval Cache → Advertising Targeting Agent → Recommendation Agent. Final output persisted as an immutable Postgres row keyed by (campaign_id, filter_hash).

  • The Conversation Agent (Becky)

    Single-node tool-augmented chat loop. WebSocket-based, token-streamed, grounded in the latest BI recommendation version at session start. Three bound tools (update_filters, remove_area, update_area_channels) translate natural language into deterministic, server-validated state mutations.

  • Memory partitioned by lifetime

    Short-term in LangGraph Postgres checkpoints, durable transcript mirror in a separate table, long-term recommendation context append-only and hashed, vector retrieval namespaced per campaign in Pinecone

  • Reliability patterns

    Structured-output validation around every LLM call. Deterministic fallback structures for malformed responses. Bounded radius and confidence normalization. Hash-keyed recommendation lookup short-circuits the full LangGraph run when an identical input + filter set has already been computed.

Let’s Explore How We Can Build Together

Whether you’re building a new product or modernizing an existing one, get insights from our product, engineering, and AI experts.