NewSumm reads news from hundreds of outlets, groups articles about the same event into one story, and writes a short summary of what the outlets agree on and where they differ. On a normal day that is tens of thousands of articles.
The whole pipeline runs on the Laravel AI SDK ( laravel/ai ): embeddings for every article, and agents that summarise stories, describe each outlet's angle and extract the people and places a story is about. This post is about the Laravel side: how the code is organised, what the SDK gives you for free, and the three failures that cost us real time because no test could see them.
If you want the maths behind the grouping (embeddings, running centroids, how the clusters are distributed), that is in Clustering the news with cheap models . Here we stay in PHP.
The code below is simplified from our real classes. The prompts, models and thresholds are left out on purpose; the structure is what transfers.
1.…