Multi-Agent Architecture for Automated Advertising Media Planning

spotify · Media & Entertainment · 2026 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Advertising media planning

Spotify needed to replace fragmented, channel-specific advertising workflow logic with a unified conversational media-planning system that could produce grounded plans quickly.

Constraints:

Architecture

Spotify built Ads AI with Google ADK 0.2.0, Vertex AI Gemini 2.5 Pro, gRPC, Google Cloud session storage, PostgreSQL plus in-memory cache, and Spotify Apollo. A RouterAgent inspects user messages, conditionally invokes resolver agents for goals, audience, budget, and schedule, then passes resolved constraints to a MediaPlannerAgent that uses historical campaign data and heuristics to generate ad-set recommendations.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  conversational-interface["Conversational Interface"] --> routeragent["RouterAgent"]
  routeragent --> goalresolveragent["GoalResolverAgent"]
  routeragent --> audienceresolveragent["AudienceResolverAgent"]
  routeragent --> budgetagent["BudgetAgent"]
  routeragent --> scheduleagent["ScheduleAgent"]
  routeragent --> session-store["Session Store"]
  goalresolveragent --> tool-layer["Tool Layer"]
  audienceresolveragent --> tool-layer
  tool-layer --> historical-performance-store["Historical Performance Store"]
  historical-performance-store --> mediaplanneragent["MediaPlannerAgent"]
  goalresolveragent --> mediaplanneragent
  audienceresolveragent --> mediaplanneragent
  budgetagent --> mediaplanneragent
  scheduleagent --> mediaplanneragent
  mediaplanneragent --> structured-output-parser["Structured Output Parser"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Conversational Interface Accepts natural-language media-planning requests from advertising users. RouterAgent
RouterAgent Triages messages and decides which specialized agents are needed. GoalResolverAgent, AudienceResolverAgent, BudgetAgent, ScheduleAgent, Session Store
GoalResolverAgent Maps user intent to campaign objectives and ad categories. MediaPlannerAgent, Tool Layer
AudienceResolverAgent Extracts targeting criteria from a predefined taxonomy. MediaPlannerAgent, Tool Layer
BudgetAgent Parses currency formats and converts budgets to internal units. MediaPlannerAgent
ScheduleAgent Parses date ranges and relative date expressions. MediaPlannerAgent
Tool Layer Exposes Google ADK FunctionTools for geo targets, ad categories, and performance retrieval. Historical Performance Store
Historical Performance Store PostgreSQL and in-memory cache storing campaign-performance data. MediaPlannerAgent
MediaPlannerAgent Optimizes recommendations with historical data, delivery heuristics, and budget rules. Structured Output Parser
Structured Output Parser Applies guardrails and parseable contracts before downstream use. —
Session Store Persists context across multi-turn planning sessions. RouterAgent

Data flow

An advertiser supplies one to three natural-language messages. The RouterAgent checks which information is present, conditional resolver agents fill in missing goal, audience, budget, and schedule fields, tool calls retrieve taxonomies and historical campaign performance, and the MediaPlannerAgent scores and returns budget-aware recommendations. Session storage preserves context across the conversation while structured outputs feed downstream ads systems.

“The agent hierarchy includes a RouterAgent that performs initial triage of incoming messages to determine what information is present (goals, audience criteria, budget, schedule).”summary, stated
“The MediaPlannerAgent serves as the optimization core, taking all resolved information and generating ad set recommendations using a heuristics-based engine backed by historical performance data.”summary, stated

Why this architecture

Spotify chose specialized parallel agents because media planning has separable but interdependent fields, and conditional execution avoids unnecessary LLM calls. Historical performance tools and structured outputs keep the planner grounded in real advertising data rather than free-form model recommendations.

“This routing step is explicitly designed to prevent unnecessary LLM calls by enabling conditional agent execution—only the agents needed for missing or incomplete information are invoked.”summary, stated
“Rather than allowing the LLM to hallucinate recommendations, the MediaPlannerAgent uses real performance data from thousands of past campaigns to inform its suggestions.”summary, stated

Models used: Gemini 2.5 Pro

Scale

Alternatives considered (roads not taken)

Build another deterministic state-machine service

Rejected because: Advertising decisions were too combinatorial and context-dependent for a new hard-coded workflow.

“The traditional approach of building a new service with deterministic state machines didn't fit the combinatorial nature of advertising workflows”summary, stated

Run every resolver for every user message

Rejected because: Router-driven conditional execution reduces unnecessary LLM calls when information is already present.

“only the agents needed for missing or incomplete information are invoked.”summary, stated

Let the model invent recommendations from prompt context

Rejected because: Spotify grounded recommendations in real historical performance data to avoid hallucinated plans.

“Rather than allowing the LLM to hallucinate recommendations, the MediaPlannerAgent uses real performance data from thousands of past campaigns”summary, stated

Query historical data directly for every recommendation without caching

Rejected because: The team accepted higher memory usage to minimize latency through an in-memory cache.

“The team made a deliberate architectural choice to use an in-memory cache for this data to minimize latency, accepting the tradeoff of increased memory usage”summary, stated

Patterns

multi-agent-orchestration (architecture)

Spotify decomposed planning into router, resolver, and media-planning agents with parallel execution where dependencies allowed.

“The architecture decomposes media planning into specialized agents, each with focused responsibilities, optimized prompts, and the ability to execute in parallel where dependencies permit.”summary, stated

tool-use-orchestration (architecture)

Agents used Google ADK FunctionTool calls to retrieve geo targets, ad categories, and historical performance data.

“They leverage Google ADK's FunctionTool to give agents access to actual advertising data through tools like search_geo_targets, search_ad_categories”summary, stated

structured-output-contract (reliability)

Prompts and parsing guardrails required consistent, parseable media-plan outputs.

“The prompt engineering for the MediaPlannerAgent specifically includes strict guardrails to ensure consistent, parseable output.”summary, stated

latency-optimization (performance)

Conditional agent execution and in-memory cached historical performance data reduced latency.

“The team made a deliberate architectural choice to use an in-memory cache for this data to minimize latency”summary, stated

eval-driven-development (quality)

Spotify added behavioral evaluation of agent decisions and tested specialized agents in isolation.

“they've added a layer of behavioral evaluation—assessing what the agent decided and why, rather than just whether code paths execute correctly.”summary, stated

Tradeoffs

Use a multi-agent planner

Chose Specialized ADK agents for routing, resolving, and planning over A deterministic state-machine planning service.

Rationale: Agent specialization fit the combinatorial media-planning workflow better than hard-coded surface-specific logic.

“The traditional approach of building a new service with deterministic state machines didn't fit the combinatorial nature of advertising workflows”summary, stated

Cache campaign-performance data in memory

Chose In-memory cache backed by PostgreSQL over Lower-memory direct lookup for every planning request.

Rationale: The team accepted memory cost to hit response-latency goals.

“accepting the tradeoff of increased memory usage in exchange for faster response times.”summary, stated

Invoke only needed agents

Chose RouterAgent conditional execution over Running the full agent suite for every message.

Rationale: Conditional execution reduced unnecessary LLM calls and kept the interaction efficient.

“This routing step is explicitly designed to prevent unnecessary LLM calls by enabling conditional agent execution”summary, stated

Gotchas (what bit them)

Consolidated backend services did not eliminate workflow-logic drift.

Root cause: Multiple buying channels and surfaces encoded similar advertising decisions in slightly different ways.

Resolution: Ads AI centralized the planning logic in a shared multi-agent service with common resolver and planner components.

“Each implementation encoded similar decisions about budget allocation, inventory selection, and campaign optimization in slightly different ways, leading to drift over time and maintenance burden.”summary, stated

LLM recommendations can hallucinate if not grounded in real advertising data.

Root cause: A planner that only reasons from prompt context could produce unsupported recommendations.

Resolution: The MediaPlannerAgent uses historical performance data and heuristics for cost, delivery, budget, and diversity.

“Rather than allowing the LLM to hallucinate recommendations, the MediaPlannerAgent uses real performance data from thousands of past campaigns to inform its suggestions.”summary, stated

Small prompt changes caused output-consistency problems.

Root cause: Structured LLM responses were sensitive to prompt wording.

Resolution: Spotify treated prompt engineering as software engineering with explicit output requirements, examples, and parser guardrails.

“They discovered that small changes in prompt wording can dramatically affect output consistency, leading them to adopt several practices”summary, stated

Evaluation

Spotify combined traditional tests with behavioral evaluation of what agents decided and why; the public writeup does not disclose detailed metrics beyond latency and workflow compression.

Metrics: 5-10 second planning response · 1-3 natural-language messages instead of 20+ form fields · 15-30 minute manual baseline

“Traditional unit and integration tests remain important, but they've added a layer of behavioral evaluation—assessing what the agent decided and why”summary, stated
“the specific testing methodologies and metrics aren't detailed in the source material.”summary, stated

Outcomes

The report cites thousands of historical campaigns and budget-conditioned recommendation ranges; it does not disclose live usage volumes.

“transforms media planning from a manual 15-30 minute process requiring 20+ form fields into a conversational interface that generates optimized, data-driven media plans in 5-10 seconds”summary, stated
“The technology stack integrates several components: Google ADK 0.2.0 provides agent orchestration, session management, and tool integration”summary, implied