Inspiration
Streaming platforms like Netflix spend millions on data science teams to analyze viewer retention. But indie filmmakers, regional OTT platforms, and small content creators have zero visibility into why audiences drop off mid‑season. They can't afford enterprise analytics tools or dedicated data teams.
We built CineLens Autopilot to democratize studio analytics – giving every creator an autonomous AI director that monitors performance, detects churn, and suggests creative fixes, all without hiring a single data analyst.
What it does
CineLens Autopilot is an autonomous agentic AI that:
- Queries ClickHouse (chDB) in real‑time to identify shows with completion rates below a user‑set threshold.
- Drills down to the exact episode where viewers drop off, using ClickHouse aggregations.
- Generates an executive alert with a specific, actionable creative fix (e.g., "Move the plot twist to Episode 3").
- Works in two modes:
- Live Mode – uses Google Gemini with function calling for dynamic reasoning.
- Demo Mode – simulates the full agentic pipeline without any API calls, using the same ClickHouse data. This guarantees a flawless hackathon demo every time.
## How we built it
| Component | Technology |
| :--- | :--- |
| Frontend | Streamlit – for a fast, interactive dashboard |
| Database | ClickHouse (via chDB) – embedded, serverless SQL engine for analytics |
| AI Orchestrator | Google Gemini 2.0 (
google-genaiSDK) – handles tool calling and reasoning | | Data Generation | Faker & Pandas – synthetic viewership data mimicking a real OTT platform | | Deployment | Streamlit Cloud – one‑click hosting for live judging | Key Architecture:
- The agent receives a user goal (e.g., "Find my worst‑performing shows").
- It calls ClickHouse via chDB to fetch underperformers.
- It drills down into episode‑level completion trends.
- It formulates a creative recommendation and simulates a studio alert.
- We built function declarations using
google.genai.typesfor proper Gemini tool calling.
Challenges we ran into
- Gemini SDK Migration – The new
google-genaiSDK requirestypes.Toolandtypes.FunctionDeclarationobjects, not plain dictionaries. We refactored our tool definitions to match the strict schema. - Model Availability – Some Gemini model versions (
gemini-2.5-flash) are deprecated or region‑locked. We implemented a multi‑model fallback that triesgemini-1.5-flash,gemini-1.5-pro, andgemini-1.0-prodynamically, skipping broken versions. - API Key Reliability – Since hackathon judges may test without a valid key, we built Demo Mode – a fully functional offline simulation that generates data‑driven recommendations using real ClickHouse queries. This makes our submission robust and judge‑proof.
- Indentation & Python Packaging – Ensuring clean indentation across a large Streamlit file and managing chDB's installation on Streamlit Cloud required careful testing. ## Accomplishments that we're proud of
A truly resilient agentic system We built CineLens with two modes – Live (Gemini) and Demo – so it never fails. The Demo Mode generates data‑driven, realistic studio alerts using real ClickHouse queries, even without an API key. This makes our project judge‑proof and production‑ready.
Deep integration with ClickHouse (chDB) We executed complex SQL aggregations directly in memory using embedded ClickHouse – ranking shows by completion rates and pinpointing episode‑level drop‑offs in milliseconds. The seamless chDB integration proves we deeply understood the partner track.
Mastering the new Gemini SDK We successfully migrated to the google-genai SDK, using types.Tool, types.FunctionDeclaration, and types.Schema to define strict function calling. We also implemented a multi‑model fallback that gracefully handles deprecated or region‑locked models.
Turning raw data into creative action Our agent doesn't just show charts – it generates specific, actionable creative fixes (e.g., "Move the plot twist to Episode 3"). We bridged the gap between data analytics and real studio decision‑making.
A polished, cinematic UI under time pressure We built a dark‑themed, responsive Streamlit dashboard with live metrics, chain‑of‑thought expanders, and interactive visualizations – all in a single app.py file. The UI feels like a real studio control room.
Zero‑dependency resilience Despite API key issues, region restrictions, and SDK changes, we pivoted quickly and built a fully functional offline mode. This taught us that resilience is a feature, not a fallback.
What we learned
ClickHouse (even embedded via chDB) is blazing fast – queries over 960 rows complete in milliseconds.
Gemini function calling is powerful but requires strict schema definitions – we now deeply understand the
google.genaitype system.Resilience is a feature – building a fallback mode made our application production‑ready, not just a hackathon demo.
Streaming analytics is a massive, underserved market – tools like CineLens can save indie creators thousands in lost revenue.
What's next for CineLens Autopilot – Studio Performance Agent
Connect to real OTT APIs (e.g., YouTube Analytics, Vimeo) for live data ingestion.
- Add multi‑agent collaboration – one agent for data, one for creative, one for distribution strategy.
- Integrate Grafana for real‑time observability dashboards.
- Deploy on Google Cloud Run with a fully managed ClickHouse cluster for production scale.
Built With
- python
- streamlit


Log in or sign up for Devpost to join the conversation.