Inspiration

Hollywood greenlights $300B+ in annual content spend based on gut instinct, pitch meetings, and executive politics. Meanwhile, the data to inform those decisions — viewing telemetry, churn signals, audience overlap, franchise momentum — sits unused in warehouses, disconnected from the people writing the checks.

We asked: what if an AI crew could sit between the data warehouse and the boardroom? Not a chatbot, not a dashboard — a crew of specialized agents that queries real analytics, challenges its own conclusions, and delivers a verdict with a transparent, auditable evidence trail.

The Moneyball analogy became our north star. Billy Beane didn't replace scouts with spreadsheets — he gave scouts spreadsheets. GREENLIGHT OS gives studio executives an AI crew that thinks in evidence.


What it does

GREENLIGHT OS is a 5-agent decision crew that reads entertainment telemetry from ClickHouse, scores projects against a weighted framework, and produces auditable GREENLIGHT / DEVELOP_FURTHER / PASS verdicts.

The crew runs sequentially:

  1. Triage — Classifies the question (renewal, development, or audit) and resolves titles against the warehouse. 100% deterministic, no LLM.
  2. Analyst — Probes 6 ClickHouse tool functions (audience, engagement, churn, momentum, comparables, economics) and returns structured evidence.
  3. Strategist — Scores the four-dimension framework in Python and maps to a verdict via configured bands.
  4. Devil's Advocate — Pokes the weakest dimension, producing structured dissent.
  5. Chief of Staff — Assembles the dossier and writes the decision back into the ClickHouse ledger.

Every number is traceable. Every verdict is reproducible. Every run produces a full markdown report with rationale, dissent, evidence queries, and confidence score.

Live demo:


How we built it

The scoring engine

The Strategist evaluates four dimensions, each backed by ClickHouse queries and computed entirely in Python — never by the LLM:

$$S = w_a \cdot d_a + w_e \cdot d_e + w_c \cdot d_c + w_m \cdot d_m$$

| Dimension | Weight | Source | |----------------------|--------|--------------------------------------------------------| | Audience Depth $d_a$ | 0.30 | Demographics, retention curves, growth rate | | Economics $d_e$ | 0.30 | Revenue per viewer, cost efficiency, subscriber impact | | Comparables $d_c$ | 0.25 | Similar title performance, market gap analysis | | Momentum $d_m$ | 0.15 | Social velocity, press sentiment, trending rank |

Verdict bands:

$$\text{Verdict} = \begin{cases} \text{GREENLIGHT} & S \geq 0.65 \text{DEVELOPFURTHER} & 0.45 \leq S < 0.65 \text{PASS} & S < 0.45 \end{cases}$$

The one rule that makes it defensible

The LLM never writes SQL and never fabricates a number.

Every metric comes from pre-built, parameterized ClickHouse tools. Gemini narrates and interprets — that's it. The weighted score is pure Python arithmetic. If Gemini is unreachable, deterministic fallbacks still produce a truthful, marked-as-degraded verdict.

The ClickHouse integration (deep and bidirectional)

ClickHouse isn't a bolt-on — it's the circulatory system:

  • Reads: The crew queries millions of viewing events through 6 tool functions
  • Writes: Every decision is published to a decisions ledger with full rationale, dissent, and evidence queries
  • State: Pipeline events persist across Cloud Run instances via pipeline_events and pipeline_runs tables

Infrastructure

Two Cloud Run services from one multi-stage Dockerfile — FastAPI serves the pipeline, Streamlit provides a live War Room UI. ClickHouse Cloud for persistence. Gemini 2.5 Flash via Vertex AI for narration. Everything env-var driven, no secrets baked into images.


Challenges we ran into

LLM fabrication was the first thing we killed. Early prototypes let Gemini generate SQL directly. It produced plausible queries with fabricated row counts and invented metric names — exactly the failure mode you can't have when someone is writing a $100M check. The fix was architectural: a hard boundary between "tools that return data" and "an LLM that narrates it."

Cloud Run killed our in-memory event store. Our original pipeline stored progress in Python dicts. Cloud Run recycles containers every few minutes. The UI would poll for events that had vanished between requests. We rewrote the entire event store to persist in ClickHouse — MergeTree for events, ReplacingMergeTree for run status.

Docker 28.x broke Artifact Registry. Pushing manifests to Google Artifact Registry failed with "Missing image name" — a Docker 28.x regression. We pivoted to gcr.io (Container Registry) and rewrote the deploy script.

ClickHouse quirks. Multi-statement SQL fails on ClickHouse Cloud (Multi-statements are not allowed). ALTER UPDATE on ReplacingMergeTree version columns throws errors (Cannot UPDATE key column). clickhouse_connect's command() doesn't bind INSERT VALUES parameters — only client.insert() works. Each required a specific workaround.

Streamlit secrets aren't safe to property-access. st.secrets raises StreamlitSecretNotFoundError on access — even through hasattr or getattr. Fixed with a bare try/except around the entire block.


Accomplishments that we're proud of

The crew produces correct verdicts on every synthetic archetype. Starfall Academy (75% completion, growing) → GREENLIGHT. Neon Dynasty (huge reach, terrible churn) → PASS. Sitcom Central (collapsing filler) → PASS. The deterministic scoring means the same input always produces the same output — no hallucinated numbers, no varying scores.

Every decision has an evidence trail. The ClickHouse decisions ledger stores decision_id, recommendation, weighted score, confidence, rationale, dissent, evidence queries, and the model used. A studio board can audit any past verdict and trace every number back to a source query.

The system degrades gracefully, never crashes. If Gemini is unreachable, the crew completes with template narration. If ClickHouse is slow, cached results carry the pipeline. The demo never hangs — it produces a truthful, marked-as-degraded verdict and moves on.

Full bidirectional ClickHouse integration. We're not just reading data — we're writing decisions back. The decisions table grows with every run, creating an audit ledger. Pipeline events persist in ClickHouse so the War Room UI works correctly across Cloud Run container recycling.

A real M&E workflow, not a toy. The synthetic dataset models actual entertainment metrics: 6 titles across 5 content types, 750K viewing events with demographics, monthly partitions, engagement scores, churn signals. The pipeline asks and answers real studio questions.


What we learned

LLM fabrication is the silent killer of trust. Giving an LLM SQL access is like giving a toddler a loaded spreadsheet — it will produce exactly the answer it wants, not the answer that's true. The architectural fix was a hard boundary: tools return data, Python computes scores, LLM narrates. This single decision made every other part of the system trustworthy.

Degradation is a feature, not a bug. Every agent has a deterministic fallback. Template narration isn't as eloquent as Gemini, but it's always truthful and complete. A system that gracefully degrades is infinitely more useful than one that crashes spectacularly.

ClickHouse ReplacingMergeTree is elegant once you stop fighting it. You can't ALTER UPDATE a version column. The answer is to INSERT again — the engine deduplicates on merge, keeping the latest row by updated_at. It's not a hack; it's the intended pattern for mutable state in an append-only database.

Agentic ≠ autonomous. Our crew doesn't "think for itself" — it executes a deterministic pipeline where each agent has a defined contract, structured inputs, and structured outputs. The LLM narrates. Python decides. ClickHouse stores. That's enough.


What's next for GREENLIGHT OS — Moneyball for Hollywood

Connect to real streaming data. The synthetic dataset proves the architecture. The next step is plugging in real viewership telemetry — The Numbers, Parrot Analytics, or a studio's internal warehouse — to produce decisions against actual market data.

Real-time monitoring. Stream live viewership events into ClickHouse as they arrive. The crew can then trigger proactive reviews: "Neon Dynasty's churn rate spiked 40% this week — should we reconsider renewal?"

Scheduling integration. Connect the crew's verdicts to release calendars, marketing budgets, and slot allocation. A GREENLIGHT recommendation should flow into resource allocation automatically.

Multi-title portfolio optimization. Instead of evaluating titles individually, score them against each other for budget allocation. "We have $500M for next year — which 8 of these 15 projects maximize expected ROI?"

External signal ingestion. Pull social media sentiment, search trends, and box office comps into ClickHouse as additional evidence dimensions. The framework is extensible — adding a fifth dimension is a config change, not an architecture change.

Built With

Share this project:

Updates

Submission history