Real-time social signals, in under five seconds
For a global media company, we prototyped a streaming pipeline that reads social posts as they’re published, uses an LLM to decide which ones matter, and puts the important ones in front of editors in Slack — with a post-to-alert latency budget of under five seconds.
Case study
The problem
In a newsroom, the first few minutes after something happens decide who owns the story. The signal often appears first on social media — an athlete’s post, a team announcement, a reporter’s scoop — but it is buried in a firehose of noise. Keyword alerts fire on everything; people watching feeds by hand miss things and burn out.
Editors needed a system that understands a post well enough to decide whether it’s news, and tells the right channel fast enough to matter.
Designing for a latency budget
We started from the number, not the model. If an alert arrives after an editor has already seen the post, it has no value, so we set a target of under five seconds from publish to Slack and gave every stage a share of it.
| Stage | What happens | Budget |
|---|---|---|
| Ingest | Persistent connection to the X Filtered Stream API with rules for tracked accounts and topics | < 0.5 s |
| Queue | Each post published to a Pub/Sub topic, decoupling ingest from processing | < 0.2 s |
| Classify | Gemini returns a structured verdict: category, urgency, entities, a one-line summary | 1–2.5 s |
| Route & alert | Rules map verdicts to channels; Slack message with context and a link to the post | < 0.5 s |
Budgets are design targets for the prototype, not production SLAs. The point of the table is that the model gets the biggest share, and everything around it has to be nearly free.
Architecture
- One long-lived consumer, many stateless workers. The Filtered Stream connection is the one thing that must stay up, so it does nothing but receive and publish. Everything downstream can scale, restart or be redeployed without dropping the stream.
- Structured outputs, not prose. The classifier returns a fixed schema, so routing is plain code, alerts are consistent, and every decision can be logged and audited.
- Rules outside the prompt. Which categories alert which channel, and at what urgency, lives in configuration that editors can change without touching the model.
- Humans stay in charge. The system recommends; editors decide what becomes a story.
Why an LLM instead of keyword rules
Keyword rules can’t tell “signing a new contract” from “signing autographs”, or a joke from an announcement. An LLM classifier reads the post the way an editor would — who posted it, what it says, whether it’s new information — and explains its call in one line, which is exactly what an editor needs to decide in a glance.
Start from the latency budget. The model gets the biggest share, so everything around it has to be nearly free.
What production adds
- An evaluation set of labelled posts, so prompt or model changes are measured before they ship.
- Deduplication and clustering, so one event produces one alert rather than fifty.
- Latency and cost dashboards per stage, and alerting on the pipeline itself.
Updated 2026-09-25