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.
Foundation
Nx monorepo, FastAPI backend with DDD layering, Alembic-managed Postgres, Pinecone per-campaign namespacing, GCS for binary assets, magic-link + Google OAuth, GitHub Actions CI/CD
BI Workflow
Built the 5-node LangGraph pipeline with typed GraphState, output parsers, RAG caching, recommendation versioning. Tavily for NZ-specific area enrichment.
Conversation Agent
WebSocket lifecycle, tool-binding contract, recommendation-version-grounded session start. Postgres checkpointer for resumable conversations.
Hardening & Launch
Failure-mode testing, latency optimization, parallel run with manual workflow before full handover. Delivery method: Agile Scrum, 2-week sprints, sprint demos, UAT readiness.
Performance Optimization
Continuously monitored and optimized the app’s performance to ensure a seamless user experience.
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.
More Case Studies
AI Engineering · IndiaAccurex - AI Workflows for Field Sales Attendance and Call Evaluation
Medical DevicesTwo automated workflows. One checks field sales attendance. The other turns tele-caller audio files into transcripts, with speakers identified and non-English conversations translated into English.Read the Full Case Study
AI Engineering · IndiaPolicyBoss - A Voice AI Agent for Motor Insurance Policy Verification
Insurance / InsurTechA voice AI agent that supports policy verification calls alongside live agents, retries unfinished verifications, and follows up on WhatsApp after every attempt.Read the Full Case Study
Software Engineering · IndiaJio Media Stack
Jio · Digital CommunicationWe developed a bespoke Video Calling SDK for a leading communication technology client, eliminating third-party dependencies and enhancing control over their infrastructure in the digital communication industry.Read the Full Case Study
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.