RSSAmplifier

Blog

Alessandro Bahgat's Blog

Personal website of Alessandro Bahgat — Software Engineering Leader.

abahgat.comRSS feed ↗20 posts

Latest posts

The nearest hospital to every place on Earth, in a single S2 range query

For every locality on Earth, how far is the nearest hospital? Naively, that's 437 billion great-circle distances. S2 cell indexing reduces it to a single integer range-join: build the index once, and the answer for every place on Earth comes back in seconds. The same primitive also resolves which country, region, and locality each hospital belongs to, in a single pass over one index.

Same Agent, Different Score: The Problem With Testing Non-Deterministic AI

Before building tools for my Zork-playing agents, I needed a benchmark I could trust. I ran five local models through fifty playthroughs and discovered that the same model can score 40 or 0 on the same game. Getting honest numbers required three harness versions, structured telemetry, and a loop detector that learned the difference between stuck and thorough.

Stuck in the Maze: Why AI Agents Can't Hold the Map

I had local AI models play Zork, the 1981 text adventure, to study why agents struggle to navigate connected systems. One started responding in Thai. Most scored zero. All got hopelessly stuck in the maze. What broke says a lot about why agents get lost in microservices too.

Permission Structure

AI tools are trained on extreme goal fulfillment: you ask "build X" and they build X. I've learned that prompting against that grain gets even better results: asking the model to stress-test ideas, not just execute them. It takes a deliberate permission structure to get there.

Fortresses, Pipes, and Brains

Workday's CEO called AI agent startups "parasites." Linear shipped a native AI agent that understands software development workflows. These are two ends of a spectrum, with most of the industry stuck in the middle — exposing data through MCP without embedding any intelligence. The companies that win will be the ones that make AI native to their domain workflow.

Visualizing Ukkonen's Suffix Tree Algorithm

I learned algorithms from textbooks and papers, building mental models from pseudocode and hand-drawn sketches. The hardest part was never reading the algorithm: it was seeing what it was actually doing to the data structure in memory. This post is the tool I wish I had back then.

The Velocity Paradox

AI agents can generate code 100x faster, but for companies stuck in the "Unhappy Middle" — with legacy debt, bespoke frameworks, and zero slack — the bottleneck has shifted from writing code to verifying it. Here's how engineering leaders can cross the chasm by becoming gardeners, not janitors.

The Ghost in the Training Set

LLMs have statistical momentum: even when they know a new standard like Streamable HTTP exists, they often revert to the legacy patterns they saw most in training. Here is how to use "strong anchors" and "zero-prompt pruning" to keep your agentic systems from being haunted by 2024.

Receiving Feedback Is A Skill

Delivering feedback is a critical part of my day job as a manager at Google. However, it took me a while to realize that receiving feedback is one of the skills that helped me grow the most in my career. Here a few things I learned in the process.

Programming Machine Learning

A book written with developers in mind, covering Machine Learning with a hands-on approach. Each new topic is introduced by laying out a real world problem, guiding readers through implementing a working solution based on ML algorithms and then explaining the theoretical foundations in a very accessible way.

The programming puzzle that landed me my job

And how solving it required a truly full-stack solution, covering web development, data structures and memory optimization

What to look for when hiring

A while ago, I found myself in the enviable position of having to rapidly grow my team. Here a list of the most important characteristics I learned to value in anyone I work with, regardless of job function.

Visual and HTML Testing for Static Sites

I set up a CI/CD pipeline to test my website for markup and rendering issues. It proved to be so useful that I can not imagine going back.

Zing LED Smart Night Light

I liked these WiFi enabled, motion-sensing night lights so far, I only wish they had 3 more features.

Migrating From Wordpress to Hugo

After many years of running my site on Wordpress, I just migrated this site to Hugo. The migration was quite simple, this post outlines the main steps and offers a few helpful resources.

What’s wrong with Milan’s Open Data initiative

I spent some time playing with the Open Data published by the City of Milan, aiming to visualize public transport coverage. While I managed to create a heatmap, I was left unsatisfied by the data presentation and format. The initiative is promising but could be dramatically improved by adopting modern standards like GeoJSON instead of Shapefiles and including simple preview capabilities.

Appsterdam Guru Session: Google App Engine for beginners

One of the things I was not expecting when I moved to Amsterdam was its active and vibrant tech community. Appsterdam, a non-profit organization focused around aggregating people with a passion for te...

Presenting Professional Invaders

The story of Professional Invaders, the game we built during TNW Conference's Hack Battle.

What Van Gogh can teach us about persistence

I visited the Van Gogh museum in Amsterdam recently and, to my surprise, I left the exposition having learned something that matters beyond art.

Prettier source code on WordPress.com

Posting source code on WordPress.com is quite simple: the platform already provides an extremely easy to use shortcode called sourcecode, based on a fairly flexible syntax highlighter plugin. By looki...