This article details the architectural decisions and challenges Netflix faced in integrating Large Language Models (LLMs) into their recommendation system for the new AI Discover feature. It introduces an 'intelligence layer' or agent harness designed to combine LLMs with existing recommendation systems to deliver steerable discovery experiences while maintaining Netflix's high standards for speed, reliability, and safety at scale. The design focuses on robust planning, asynchronous execution, and rigorous safety enforcement to overcome LLM limitations.
Read original on Netflix Tech BlogNetflix's AI Discover moves beyond passive recommendations to a 'steerable discovery' experience, allowing members to explore themes. Building this required a new intelligence layer (agent harness) to combine LLMs with existing recommendation systems. This layer is responsible for planning each request, executing it across various systems, serving results, and evaluating performance. The primary challenge was integrating probabilistic LLM outputs into a product demanding governed, reliable, and performant results at Netflix's scale.
When a member selects a theme, the TV app sends the request to the Page Server, which asynchronously hands it to the intelligence layer. This layer comprises two main components:
Key Design Philosophy: Plan-and-Execute Agent
Netflix opted for a 'plan-and-execute' agent model. An LLM can *propose* a plan, but custom code *validates* and *executes* it. This ensures safety, reliability, and predictable performance, contrasting with a flexible but unpredictable 'reason-call-tool-reason' loop. Established plans serve as fallbacks if a new LLM-drafted plan fails validation.
Generative AI can introduce significant latency. To maintain a responsive TV experience, Netflix implemented an asynchronous page generation path. The initial user request returns immediately with an acknowledgment, and the TV app shows a 'thinking' state. The executor processes the LLM-involved plan in the background. Once results are ready, the server notifies the TV, which then fetches the completed page. This decouples user perceived latency from LLM inference time, ensuring a healthy serving path and immediate UI feedback.
Instead of relying on LLM prompts for safety, critical rules are enforced in code. This includes content standards, maturity ratings, and access controls. Generated text undergoes cleanup, and the planner receives a stripped-down request, with member details only provided to validated plan steps. This also protects against prompt injection. Structured request records, detailing plans, step outcomes, and applied rules, enable post-mortem analysis and continuous system improvement.