The Problem With Letting the LLM Drive

Every team building an LLM-powered feature hits the same wall: the simplest design is to hand the whole request to a model and let it figure out the steps. It's flexible. It's also a liability.

When every turn ends on a screen in someone's living room, probabilistic output is not an option for governed results. At Netflix scale, even a 0.1% failure rate fires thousands of times a day. A member sees every slow call, every unavailable title, every off-brand line.

Netflix's AI Discover team published how they solved this for their TV recommendation experience. The answer isn't a better prompt or a bigger model. It's an agent harness — a layer that decides how to combine LLMs with existing recommendation systems, then executes that decision under code-enforced constraints.

This is the architectural pattern every team shipping agentic features should study. Let's break it down.

근거자료: Netflix Technology Blog — Engineering AI Discover

AI agent harness architecture diagram showing controller and executor for Netflix AI Discover recommendation system System Abstract Visual

The Core Pattern: Plan First, Execute Second

The familiar way to let an agent use tools is a loop: reason → call tool → read result → reason again. It's flexible, but you can't tell up front how many steps it will take or whether it has gone down a wrong path.

Netflix's harness is a plan-and-execute agent: an LLM can propose the path, but code decides whether it runs.

Two Components, One Contract

ComponentResponsibility
ControllerGathers context, settles on a plan (established or LLM-drafted), validates the graph, retrieves only needed member data, checks the result before serving
ExecutorRuns the plan. Steps pass typed outputs through declared contracts. Independent steps run in parallel with their own deadlines and fallbacks

A Plan Is a Validated Graph of Capabilities

A capability is a named unit of work (retrieval, ranking, generation, packaging) that declares its inputs, outputs, visible context, and failure behavior. A plan is a graph of approved capabilities.

Before execution, the controller validates:

  • Every step is approved
  • Every input has a producer
  • Nothing loops
  • The plan ends in exactly one page
# Simplified capability contract (Python)
from dataclasses import dataclass
from typing import Protocol

@dataclass
class CapabilityContract:
    name: str
    version: str
    inputs: dict[str, type]
    outputs: dict[str, type]
    on_failure: str  # "fallback" | "abort" | "skip"

class Capability(Protocol):
    contract: CapabilityContract
    def run(self, inputs: dict) -> dict: ...

def validate_plan(plan: list[Capability]) -> bool:
    produced = set()
    for step in plan:
        for inp in step.contract.inputs:
            if inp not in produced:
                raise ValueError(f"Unproduced input: {inp}")
        produced.update(step.contract.outputs.keys())
    return True

The key insight: because plans can only use approved capabilities, even a plan drafted on the fly stays grounded in the catalog and member taste. The LLM proposes; the graph validator disposes.

Safety Lives in Code, Not Prompts

Some rules must hold no matter what an LLM writes: content standards, what each step can access, what a member asked not to see. Putting those in a prompt makes them probabilistic.

Netflix enforces them in code:

  • The planner sees a stripped-down request and uses placeholders for parameter values (e.g., {{maturity_rating}}), not literal values. The controller fills them after validation — this also blocks prompt injection.
  • Generated text is cleaned before it reaches the screen.
  • Every request leaves a structured record: plan, each step's outcome, which rules applied. When a page misses, you can tell whether the plan, data, rule, or model was at fault.

Asynchronous by Default

Holding one request open for many seconds across services ties up threads. So generation requests are async: the button press returns immediately with an ack, the TV shows a thinking state, the executor runs the plan in the background, and the server notifies the TV when the result is ready. Slow generation no longer slows anything else.

Server infrastructure running asynchronous multi-step LLM orchestration for TV page generation Software Concept Art

What This Pattern Buys You (And What It Costs)

The Wins

  • Model agnosticism. All LLMs sit behind one common interface. Swapping models is a config change, not a migration. Every candidate is scored on the same tasks by automated checks and LLM judges before a swap.
  • Adaptive planning. Established plans for common requests; LLM-drafted plans for novel ones. A controlled router picks. If the planner is slow or its plan fails validation, fall back to a tested plan.
  • Composability. Capabilities wrap proven systems (search, ranking, catalog metadata). The planner gets building blocks it can mix in new ways with far less manual wiring.
  • Cheap experimentation. Behavior lives in server-side prompts and config. Swap models, tools, and capabilities without new code or a TV app release.

The Costs You Must Accept

  • Design discipline up front. Every capability needs a clear purpose and a semantic interface. Too fine-grained, and the planner has more ways to go wrong. Too coarse, and it loses room to compose richer plans. This is a real design tax.
  • You must build the observability. Structured request records aren't free — they're the foundation of offline evaluation, replay, and root-cause analysis. Without them, you can't tell a model failure from a data failure.
  • Latency is a budget, not a guarantee. LLM calls are the slowest and most expensive part. Tail latencies spike. You need per-step deadlines, fallbacks, and a willingness to serve a degraded page rather than no page.
  • This is not a chatbot. AI Discover deliberately limits input to theme selection and tuning options. No free-text, no open chat. Narrowing the LLM's job by design is what keeps the safety bar reachable.

When NOT to Use This

If your feature is a single LLM call with no tool use, no grounding requirements, and no multi-step orchestration, a harness is overkill. The plan-and-execute pattern pays off when you need governed, grounded, multi-step behavior at scale. Below that threshold, a simple prompt-plus-validation pipeline is cheaper and easier to reason about.

Network flow of plan-and-execute agent with capability graph validation for grounded recommendations Developer Related Image

The Takeaway for Agent Builders

The industry conversation about agents is dominated by loops and frameworks. Netflix's write-up is a useful counterweight: the hard part isn't the reasoning loop, it's the harness around it — the validation, the contracts, the fallbacks, the records.

Three things to steal for your next agentic feature:

  1. Separate planning from execution. Let the LLM propose; let code validate and execute. This gives you the flexibility of agentic planning with the predictability of a compiled pipeline.
  2. Make safety structural, not instructional. Placeholders, typed contracts, and graph validation enforce rules that prompts only suggest.
  3. Treat every request as a record. The structured trace is what turns a black box into a system you can evaluate, replay, and eventually improve automatically.

Netflix's longer-term goal is a system that proposes its own improvements — testing them safely and keeping only what proves better. That's only possible because the harness already produces the records and the validation infrastructure to do it. The harness isn't overhead. It's the foundation.

Further Reading

Next Steps

If you want to apply this pattern, start small: define three capabilities, write a validator, and run one established plan end-to-end before you let an LLM draft anything. The harness earns its complexity only after you've felt the pain of ungoverned execution.

This content was drafted using AI tools based on reliable sources, and has been reviewed by our editorial team before publication. It is not intended to replace professional advice.