Inspiration

Streaming platforms with millions of viewers generate a constant firehose of data — what's trending, where video is buffering, what's erroring out, region by region. Today, turning that into a decision takes a room full of analysts and hours: the "dailies" meeting. We wanted to see what happens when that meeting runs continuously instead of once a day, with agents doing the triage instead of humans — but governed agents, not a chatbot with database access.

What it does

StudioPulse is an autonomous "control room" for streaming operations. Five agents run a continuous cycle over live viewer telemetry in ClickHouse:

  • Director — orchestrates the cycle and compiles a "Dailies Report"
  • Analyst — the only agent with ClickHouse access; returns validated structured findings, never invented numbers
  • Content Strategist — ranks recommended actions (promote a trending title, pull an underperforming one, flag a region for QoE issues)
  • Ops/Anomaly — runs on an independent, faster loop watching for buffering/error spikes
  • Governance — checks IAM-style role permissions and spend thresholds, blocks anything high-impact until a human approves it, and writes every decision to an immutable audit log

The whole thing is a deterministic workflow graph, not a freeform agent loop — the LLM makes judgment calls (ranking, summarizing), but every number that drives a decision comes from a real ClickHouse query.

How we built it

We picked the ClickHouse track deliberately: "useful for millions of viewers" is ClickHouse's actual use case, not a stretch. The data layer is a MergeTree table for raw viewer events, partitioned by day, with three materialized views (trending titles, QoE by region, error rate by CDN edge) that keep dashboard and agent queries fast regardless of raw ingest volume. A synthetic telemetry generator simulates realistic streaming traffic — Zipf-distributed title popularity, five regions, six CDN edges — with the ability to inject an anomaly burst so the Ops Agent has something real to catch.

On top of that: a set of guarded MCP tools (typed, SELECT-only where ad-hoc, with a SQL-injection guard) that agents call instead of writing raw SQL directly. The agents themselves run inside an explicit state machine — COLLECT → ANALYZE → STRATEGIZE → GOVERN → EXECUTE/ESCALATE → LOG — with Gemini used specifically for ranking and summarization, never for arithmetic. A FastAPI backend exposes the cycle trigger, metrics, and an approval endpoint, with a WebSocket live feed. The frontend is a dark, cinematic "Control Room" dashboard: a live agent activity feed styled like a shooting script, trending/QoE charts, an incident feed, and an approval queue for anything Governance is holding for human sign-off.

Challenges we ran into

The most interesting bug wasn't a typo — it was a ClickHouse query that aliased an aggregated column to the same name as its source column (countMerge(total_events) AS total_events), which caused ClickHouse to silently misresolve the alias elsewhere in the same SELECT list and throw a type error. It only surfaced when we actually ran the query against a real engine, not from reading the SQL. We also found a ClickHouse client with no connection timeout (it would hang indefinitely instead of failing fast against an unreachable host) and a deprecated FastAPI startup hook. All three are the kind of bug that only shows up when you actually execute code instead of trusting that it looks right.

Accomplishments we're proud of

Getting real verification without a full cloud environment: we used chdb, an embedded, pip-installable ClickHouse engine, to run our actual schema, materialized views, and MCP tool functions against a genuine ClickHouse query engine — and then built that into a permanent pytest fixture so our full test suite (15 tests, including a complete API-level approval-flow test) runs against real ClickHouse behavior with zero Docker required.

What we learned

Deterministic structure beats a clever prompt. The reason this system is trustworthy enough to hand real spend/content decisions to is that the LLM's role is narrowly scoped to judgment calls, while every transition in the workflow is driven by validated, typed data — and that discipline is what makes the audit trail actually meaningful.

What's next

Real IAM integration (the current role/permission mapping is a documented stub), a live ClickHouse Cloud deployment at real scale, and wiring the Content Strategist's impact estimates to an actual pricing/budget model instead of the current deterministic placeholder.

Built With

  • agentic-ai
  • apscheduler
  • chdb
  • clickhouse
  • clickhouse-connect
  • cloud-run
  • docker
  • fastapi
  • gemini
  • google-cloud
  • google-cloud-agent-builder
  • iam
  • mcp
  • model-context-protocol
  • multi-agent-systems
  • pytest
  • python
  • react
  • recharts
  • streaming-analyticsgemini
  • tailwindcss
  • uvicorn
  • vertex-ai
  • vite
  • websockets
Share this project:

Updates

Submission history