Did AI Agents Find a Maya Site? What to Do With Bun
A developer set AI agents loose on public terrain data and came back with a question in the title: "did my agents find an unmapped Maya site?". The post is by Pietro Miotti. Notice that he ended the title with a question mark. That says a lot. It's a good case for talking about AI agents that work with real data, where mistakes are expensive. And about how I'd build a flow like this with Bun without fooling myself along the way.
What happened, without the hype
The idea is simple to explain. There's open elevation data, satellite imagery and terrain models covering a big part of Central America. Under the forest, ancient structures leave marks on the ground: rectangular platforms, aligned mounds, terraces. A trained archaeologist recognizes these patterns. The question is whether a set of agents can do the screening first.
Going by the title, the result was a candidate. Not a confirmed discovery. More of a "look at this". And that difference is the real news. An agent that points to a candidate is useful. An agent that declares a discovery is a problem.
I won't repeat the details of the experiment. The original is worth reading. What interests me here is the pattern behind it, because it works for a lot more than archaeology.
Why AI agents are good for this kind of search
Some problems are a needle in a haystack. You have thousands of square kilometers of data. Almost all of it is noise and a tiny piece matters. People don't scale for that. A script with fixed rules does scale, but it's blind to anything it wasn't programmed to see.
The agent sits in the middle. It reads the tile, describes what it sees, compares it to what it knows about settlement patterns and decides if it goes on the "worth a look" pile. What it does is triage, not science.
This same shape shows up in everyday programming work:
- Scanning thousands of logs for an attack pattern that doesn't have a signature yet.
- Reviewing contracts or invoices looking for the anomaly no rule catches.
- Looking at visual test screenshots and separating real regressions from rendering noise.
In all these cases the value is in cutting 10,000 items down to 30. A person still decides on those 30.
A good agent doesn't discover anything. It shrinks the area you need to search.
How to build this pipeline with Bun
This is where Bun comes in, and it's not hype. A pipeline like this is basically I/O: download a file, cut it into pieces, call an API, save the result, repeat. Bun handles that with few dependencies. It has native fetch, Bun.file and Bun.write for files, built-in SQLite and TypeScript running directly, no build step.
The skeleton I'd use fits on one screen:
import { Database } from "bun:sqlite";
const db = new Database("triage.db");
db.run(`create table if not exists tiles (
id text primary key,
status text,
score real,
reason text
)`);
const pending = db
.query("select id from tiles where status = 'pending' limit 50")
.all() as { id: string }[];
for (const { id } of pending) {
const img = await Bun.file(`tiles/${id}.png`).arrayBuffer();
const r = await analyze(img); // model call
db.run("update tiles set status = ?, score = ?, reason = ? where id = ?", [
r.score > 0.8 ? "candidate" : "discarded",
r.score,
r.reason,
id,
]);
}
Three decisions in there matter more than they seem.
State in SQLite, not in memory. The pipeline will crash. The API will return 429, your internet will blink, you'll hit Ctrl+C by accident. With status saved per tile, running it again picks up where it stopped. This has already saved me from burning API credits twice.
Small batches. The limit 50 is there so you can look at the results before releasing the rest. Running 10,000 calls at once without validating the first 50 is the fastest way to pay a lot for garbage.
The reason goes with the score. A score alone explains nothing. When the agent writes "three mounds aligned north-south with a central platform", you can check it. When it just returns 0.93, you're trusting it in the dark.
If you want to parallelize, Promise.all with a simple concurrency limiter does the job. You don't need a distributed queue to process a few thousand files on your laptop.
The false positive problem
Now the part almost nobody puts in the announcement post. A vision model looking at terrain will see patterns where there are none. An abandoned farm looks like a platform. A dirt road looks like an ancient causeway. An eroded hill can look like a pyramid if you really want it to.
It's pareidolia, just with a credit card. Humans see faces in power outlets. Models see temples in pastures.
Some defenses that work:
- Test on what's already known. Before searching for the unknown, run the pipeline on areas with mapped sites and on areas you know have nothing. If it doesn't find the known ones, or finds a temple in the middle of a soybean field, you already know the result isn't worth much.
- A second, skeptical agent. One agent flags, another gets the same tile with instructions to find the most boring explanation. Only what passes both moves up.
- Cross-check with an external source. If the candidate sits on top of a road that's already in OpenStreetMap, it's out.
In code, the first item is just a metric:
const known = db
.query("select count(*) as n from tiles where ground_truth = 1 and status = 'candidate'")
.get() as { n: number };
console.log(`recall on known sites: ${known.n}/${totalKnown}`);
If you don't have this number, you don't have a detection system. You have a generator of interesting images.
What this changes in your workflow
My strong opinion: the most valuable thing in Miotti's post is the question mark. A lot of AI agent projects die because someone treats the model's output as fact. The title already admits it needs someone from the field to confirm. That's the right mental model.
In practice, as a dev, I take three habits from this:
- Every agent pipeline needs ground truth. It can be small. Around 20 hand-labeled samples already change everything.
- The agent's output is a review queue, not a final report. Design the interface for whoever is going to review it.
- Bun and SQLite cover 90% of the plumbing. The real complexity is in evaluation, not infrastructure.
There's also an ethical point worth remembering. Publishing coordinates of a possible archaeological site can attract looters before it attracts researchers. If your agent finds something sensitive, the decision to publish isn't a technical one.
Is it worth trying?
Yes, as long as you go in knowing what you're building. An agent that sorts out candidates is an excellent tool and cheap to build. An agent that "discovers" things on its own is an expensive way to generate headlines.
I like this kind of experiment precisely because it forces you to measure. If you want to see how I take this same idea of a lean Bun pipeline into real projects, take a look at my projects.
LinkedIn summary
Did my agents find a Maya temple? No. And that's exactly why this experiment is good. Pietro Miotti set AI agents loose on public terrain data and came back with a candidate. Not a discovery. And that difference changes everything. A good agent doesn't discover anything. It shrinks the area you need to search. It turns 10,000 items into 30, and a person still makes the call on those 30. If I built this with Bun: state in SQLite so it can resume when it crashes, small batches before spending credits, and the reason always stored next to the score. And most important: test it on what's already known. Without ground truth, you don't have a detection system. You have a generator of interesting images. I wrote about how to build this pipeline without fooling yourself along the way. The link is in the comments, if it's useful to you. #ArtificialIntelligence #AIAgents #Bun #TypeScript #SoftwareDevelopment