---
title: "GPT-6 Luna on Pydantic AI Geo Analyst"
description: "Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 100%, code mode 90%; rank 1 of 20."
canonical: https://models.pydantic.dev/models/gpt-6-luna/geo_analyst/
---

# GPT-6 Luna on Pydantic AI Geo Analyst

> Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 100%, code mode 90%; rank 1 of 20.
>
> Markdown copy of https://models.pydantic.dev/models/gpt-6-luna/geo_analyst/. Index for agents: https://models.pydantic.dev/llms.txt

**Agents: use the API for model information.** It answers a question in one request, where the pages need several.

- Choose a model for an agent: `POST https://models.pydantic.dev/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: https://models.pydantic.dev/select.md
- Search models by name: `GET https://models.pydantic.dev/api/search?query=<text>`
- List, filter and sort models: `GET https://models.pydantic.dev/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://models.pydantic.dev/api/models/<slug>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of the first three. An `OPTIONS` request to any endpoint returns its schema. The same four are tools of the MCP server at `https://models.pydantic.dev/mcp`. More: https://models.pydantic.dev/usage.md

About the benchmark: https://models.pydantic.dev/benchmarks/geo_analyst.md. The model on every Pydantic AI benchmark: https://models.pydantic.dev/models/gpt-6-luna.md

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | -------- |
| Tool calling | 100%  | 10 of 10     | $0.059 | 128      | 126        | 10.9 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

The model passed **19 of 20** runs: 10/10 with tool calling and 9/10 in code mode. Across the 10 tasks it used **128 requests for $0.0590** in tools mode and **103 requests for $0.0389** in code mode. The only failure was a bad final answer, not a wrong method: in code mode on `b_gof` it submitted `1` where the expected value was 1.152.

#### Where it does well

- **It reads the documentation first.** It read DATA.md and applied its conventions: magnitude ×100, depth in negative metres, `k='T'`, VIIRS = VJ1/VJ2, and excluding place kinds S/H/Q. This held in `deep_moment`, `exposed`, `local_night`, `brazil_nn` and `mato_grosso`.
- **Its geometry is correct.** It computed 3D hypocentral chords in `exposed` and `b_only_hypo`. It handled antimeridian crossings in `cross_section` and `pair_map_hypo`, and computed great-circle midpoints.
- **Its nearest-neighbour searches are exact.** It used a bounding-box seed plus refinement or fallback in `brazil_nn` and `local_night`.
- **It handles the hard tasks.** In both modes, `world_clusters` (680,723 detections, label propagation to convergence) returned all 45 clusters.
- **It resolves ambiguity.** It chose Anchorage, Alaska over the Kentucky match and Mato Grosso over Mato Grosso do Sul.
- **Simple counts take few steps.** `mato_grosso` took 4–5 requests and `deep_moment` took 5–6.

#### Mistakes it makes

- **Unit and sign slips**, usually caught on a rerun:
  - `log(10)` used where `log10(e)` was needed (`b_gof`, tools)
  - z/1,000,000 instead of z/1000 (`b_only_hypo`, code)
  - B depth sign flipped and midpoint latitude left in radians (`pair_map_hypo`, tools)
  - 6371 multiplied into the cosine term (`exposed`, code)
- **SQL syntax errors**: the reserved words `cross` and `by`, unbalanced parentheses, and a `generate_series` binder error.
- **Multi-statement calls where only the last result came back**, which wasted lookups (`local_night`, `exposed`, `b_gof`).
- **Unverified assumptions**:
  - adding a `k='T'` filter that the question did not ask for
  - assuming the session timezone is UTC
  - not checking for `rv` revision duplicates
- **Truncated output not followed up.** In the failed `b_gof` run, the output was cut off after Mc 1.9 and the model guessed an answer instead of re-querying.

#### Tool calling compared with code mode

- **Accuracy:** tool calling was perfect (10/10). Code mode lost `b_gof` at the final answer.
- **Hard tasks:** code mode was much cheaper.
  - `world_clusters`: 12 vs 35 requests ($0.0043 vs $0.0129)
  - `pair_map_hypo`: 15 vs 24 requests ($0.0079 vs $0.0261)
  - Code mode also checked its written SVGs more often. In tools mode on `pair_map_hypo`, the model could not read back `/out/map.svg`, and features may sit in a `<script>` block.
- **Simpler tasks:** tools mode was slightly leaner. Across the other eight tasks it used 69 requests for $0.0200, against 76 requests for $0.0267 in code mode. Code mode often wasted early calls on DATA.md truncation or `read_text` misuse.

If reliability on single-answer questions matters most, use tool calling. For heavy iterative workloads, code mode costs roughly a third as much.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md, sampled catalogue A, then counted 1–15 November 2026 UTC events with mk=3 (moment magnitude), m≥500 (5.0 scaled by 100), z\<-70000 (more than 70 km down, in metres) and k='T'. The single query returned 7, which matches the expected answer. ($0.0008, 5 requests, 8 s)
- Right: Read DATA.md first and returned to the catalogue B, codes and conventions part (start_line 30), which gave the mk=3 code for moment magnitude.
- Right: Read the scaling from the sample rows: magnitude ×100 (260 → 2.6) and depth in metres with negative values downward (-58100). It translated 'more than 70 km below sea level' into z < -70000 and M≥5.0 into m ≥ 500.
- Right: Used a half-open UTC window from 2026-11-01 up to but not including 2026-11-16, which takes in all of 15 November.
- Right: Restricted to event class k='T', presumably the earthquake class, so other event types were left out.
- Right: Finished in very few calls.
- Mistake: The transcript shows neither the catalogue A field table nor the conventions section in full, so it is unclear whether the agent confirmed the units for z and m, the meaning of k='T', and the timezone rule for day boundaries. It may have relied on inference from the sample rows.
- Mistake: It did not check the 'rv' (revision) field or look for duplicate ids or revisions before counting. Any such duplicates would have inflated the count; the answer was correct either way.

### mato_grosso

**Tool calling: passed.** The agent read DATA.md, then ran one DuckDB query that filtered fires to cls='H' on 2026-11-21 and counted those covered by the BRA 'Mato Grosso' state polygon from regions.tsv. It returned 5, which matches the expected answer. ($0.0007, 5 requests, 8 s)
- Right: Read DATA.md before querying, including a second read_text call from line 30 to get the rest of the file.
- Right: Used the state polygon from regions.tsv with ST_Covers point-in-polygon instead of relying on any country or state label in the fire records.
- Right: Restricted the region match to country='BRA' and grouped the result by rid and name, which confirmed a single match (BRA-602, Mato Grosso, State) rather than a mix-up with Mato Grosso do Sul.
- Right: Solved it in one SQL query, so the run was efficient.
- Mistake: The date filter `to_timestamp(f.t)::DATE` depends on the DuckDB session timezone being UTC. The agent never set or checked the timezone, so the result could have shifted around midnight.
- Mistake: It did not check the confidence code ('H') or the units of the time field against the data, for example with a quick DISTINCT or a sample of rows. It relied only on the documentation, which shows only in truncated form in the transcript.

### b_only_hypo

**Tool calling: passed.** The agent read DATA.md, parsed both catalogues and restricted catalogue B M4.5+ events to the overlap window (26 Oct 16:00 to 25 Nov 15:36 UTC). It then counted B events with no A event within 30 s and within 50 km 3D hypocentral distance, and answered 36, which matches the expected answer. ($0.0020, 9 requests, 24 s)
- Right: Read DATA.md and took the overlap period from its stated coverage bounds for catalogue A and catalogue B.
- Right: Converted catalogue A depth from z (negative metres) and catalogue B depth (positive km) into radii consistently, so it computed true 3D hypocentral distance with the law of cosines.
- Right: Parsed catalogue B's year-day date plus seconds-of-day and its N/S/E/W coordinate suffixes correctly.
- Right: When the first query returned 0 rows, it found the faulty strptime format ('%Y-%j-%d' with '-01' appended) and fixed it with '%Y-%j'.
- Right: Matched against A events of any class, as the question asked, with no class filter on A.
- Mistake: The first matching query used a broken date parse that produced NULL timestamps and a result of 0/0/0, which cost one extra call before the fix.
- Mistake: It did not check the edge case at the window boundary, e.g. a B event just after the overlap start whose A match falls just before 16:00. It also cast A timestamps to TIMESTAMPTZ but compared them with naive B timestamps, which relies on the session timezone being UTC. The result was still correct.

### local_night

**Tool calling: passed.** The agent read DATA.md, filtered catalogue A to tectonic events with m>=250 (stored in hundredths), dropped non-settlement place kinds, found the nearest settlement for each quake by haversine distance with an exact bounding-box refinement, converted UTC to that settlement's time zone and counted local hours >=20 or \<6. It got 787, which matches the expected answer. ($0.0038, 11 requests, 50 s)
- Right: Read DATA.md before querying and used its conventions: magnitude stored as hundredths (m>=250), 'earthquake' meaning class k='T', and settlements excluding kinds S/H/Q.
- Right: Built a correct nearest-neighbour search: a seed match within 20°, a full cross-join fallback for unmatched events, then a recheck of all places inside an exact spherical bounding radius around the seed distance, with ties broken by pid.
- Right: Converted each UTC time to local civil time with DuckDB's timezone(tz, ts), so DST is handled per event.
- Right: Applied the night window correctly: hour >= 20 OR hour < 6.
- Mistake: Several early calls batched multiple SELECT statements into one run_sql, and only the last result came back (e.g. the call checking candidates vs places returned just the places counts). That cost extra calls.
- Mistake: The middle check join (±5°) used count(DISTINCT q.ts) as an event count, which is unreliable if two events share a timestamp. It was only exploratory and did not affect the answer.

### brazil_nn

**Tool calling: passed.** The agent read DATA.md, filtered VIIRS fires (sat VJ1/VJ2) to Brazilian divisions with ST_Covers, and computed haversine nearest distances to places with pop >= 10,000 (excluding kinds S/H/Q) using a staged bounding-box search. It then took the median per division, and all 27 rows matched the expected answer. ($0.0043, 16 requests, 77 s)
- Right: Read DATA.md before querying and applied its conventions: VIIRS = VJ1/VJ2, place kinds to exclude.
- Right: Used a correct exact-nearest strategy. It seeded a candidate distance with 1° and 5° boxes, then refined with a bounding box derived from that seed distance so no closer place could be missed.
- Right: Checked counts along the way: 93,791 fires in Brazil, and the nearest table also had 93,791 rows, so every fire got a distance.
- Right: DuckDB's median averages the two middle values, which matches the tie rule in the question. Rounding to 1 decimal was correct.
- Mistake: The first DATA.md read was truncated at about 7,100 characters. The agent did not show re-reading the place-kind and VIIRS conventions in full, but its filters turned out correct.
- Mistake: The 5° fallback stage assumes every fire has a qualifying place within 5°. That held here (seed1 92,732 + seed5 1,059 = 93,791), but the agent did not check it explicitly before the refinement step.

### exposed

**Tool calling: passed.** The agent read DATA.md, sampled both files, and wrote one SQL query. The query computed 3D straight-line distances from each place at the surface to each catalogue A hypocentre at depth, using magnitude m/100 and depth z in metres, then filtered for places of 500k or more. It returned 23 ids, which match the expected set. ($0.0012, 6 requests, 14 s)
- Right: Read DATA.md before querying and followed its conventions: magnitude scaled by /100, depth in negative metres, k='T' for tectonic events, and excluded place kinds.
- Right: Measured distance to the hypocentre as a 3D chord using Earth radius minus depth, rather than a surface distance to the epicentre.
- Right: Finished in a handful of calls, with one cross-join query that gave the correct set.
- Mistake: Small risk only: the filters (k='T', excluding kinds S/H/Q) came from DATA.md conventions that were truncated in the transcript, and the agent did not run a check such as comparing results with and without the filters. The result was correct.

### b_gof

**Tool calling: passed.** The agent found Anchorage, Alaska in places.psv and filtered catalogue A to local-magnitude events within 300 km using a haversine distance. It then ran the goodness-of-fit Mc search in one SQL query, got Mc=2.0 with R≈89.5 and b=1.152, which matches the expected answer. ($0.0024, 7 requests, 23 s)
- Right: Picked the Alaska Anchorage (61.218, -149.900) over the Kentucky one (38.27, -85.53) when two places matched the name.
- Right: Used half-up rounding, floor(m/10+0.5)/10, on the integer magnitude field, as the task required.
- Right: Filtered with mk=1 and k='T', which appear to select local magnitude and earthquakes per DATA.md conventions.
- Right: Fixed b to use log10(e) in the second query; the first query had used ln(10) instead.
- Right: Included empty magnitude bins with an observed count of 0 (LEFT JOIN plus coalesce) when summing residuals over m from Mc to the maximum.
- Mistake: The first full query computed b as log(10.0)/(...), where DuckDB's log is base 10, so b was 1/(...) and not log10(e)/(...). That cost a rerun before it was corrected to log10(exp(1.0)).
- Mistake: The first run_sql call included a wasted 'Anchorage' places lookup whose result never appeared, because only the second statement's output was returned.

### world_clusters

**Tool calling: passed.** The agent filtered the fires to VIIRS satellites VJ1 and VJ2 (680,723 detections). It built a grid-bucketed spatio-temporal self-join that produced 1,874,135 edges, then ran iterative label propagation with pointer-jumping until no edge crossed two labels. It returned all 45 clusters of at least 300 detections, and these match the expected answer. ($0.013, 35 requests, 3.3 min)
- Right: It read DATA.md and identified VIIRS as sat VJ1/VJ2, excluding the MODIS satellites MA and MT.
- Right: When the band-joins on abs(ix difference) timed out, it switched to an equi-join over the grid cells, using a cross join of offset ranges (-3..3 in x, -1..1 in y). This made the full edge build run within the time limit.
- Right: It used the haversine distance at \<=1.0 km and a time difference of \<=43200 s, matching the link definition.
- Right: It checked convergence by counting edges whose two ends had different labels, and kept iterating until that count was 0. It added pointer-jumping (relabelling each node with its candidate's label) to speed this up.
- Right: It checked for links across the antimeridian and found none.
- Right: It converted FRP from kW to MW (divided by 1000) and rounded to one decimal place.
- Mistake: About three timed-out or broken queries (the latitude-band inserts and the a_dx binder error) and a parser error from a duplicated subquery cost extra calls.
- Mistake: The plain min-label propagation was slow, and it ran many rounds before adding pointer-jumping, which was wasteful but not harmful.
- Mistake: The longitude grid width of 0.02° with ±3 cells covers about 1 km only below roughly 81° latitude. This is fine here because the maximum VIIRS latitude is 71.3°, but the agent never stated this check.

### cross_section

**Tool calling: passed.** The agent wrote a single DuckDB query projecting catalogue A events with a magnitude onto the 23°S 178°E to 17°S 174°W great circle, kept 25 events within 150 km whose projection fell between the end points, and wrote an SVG with 25 data-id circles. The ids and coordinates match the expected answer and the run passed. ($0.0048, 10 requests, 46 s)
- Right: Read DATA.md, including the second section on codes and the catalogue conventions, before querying.
- Right: Handled the antimeridian crossing correctly by using 186° as the end longitude.
- Right: Computed along-track and cross-track distances with spherical formulas and filtered on along between 0 and d12 and |xt|\*6371 \<= 150. This gave exactly the 25 expected ids.
- Right: Scaled x as along/d12\*1000, which does not depend on the Earth radius, and y as -z/1400, converting the negative z from metres to km with 700 km at y = 500. Positions match the expected values to 0.1 px.
- Right: Gave circle radii in the required 2–6 px range, put data-id only on the circles, set width and height to 1000 and 500, and the reply count of 25 matches the file.
- Mistake: Minor: the first spatial query failed because `cross` is a reserved word, so one call was wasted before renaming the column to xt.
- Mistake: Minor: it added k='T' without visibly confirming the earthquake definition in the truncated part of DATA.md, though the result matched.
- Mistake: Minor: it ran an extra query for the total section length (1069 km) only to place axis tick labels. This was harmless decoration.

### pair_map_hypo

**Tool calling: passed.** The agent filtered both catalogues to the region and common period, matched them greedily with a recursive CTE, computed great-circle midpoints, and wrote an SVG of 157 features. That count and the positions match the expected answer, so the run passed. ($0.026, 24 requests, 3.5 min)
- Right: Read DATA.md and parsed catalogue B correctly: N/S/E/W signs, YYYY-DDD dates plus seconds, and the event class filter.
- Right: Restricted both catalogues to the overlap period (26 Oct 16:00 to 25 Nov 15:36) and handled the 180° crossing with lon>=160 OR lon\<=-170.
- Right: Ran the greedy one-to-one matching as a recursive CTE ordered by dt, then distance, then aid, then bid.
- Right: Computed true great-circle midpoints with the vector formula and shifted longitudes to 0–360 for the x projection.
- Right: Caught the depth sign mismatch: A's z is negative metres, B's depth is positive km. Fixing it to -depth\*1000 raised matches from 33 to 67 and features from 191 to 157, which is correct.
- Mistake: The first feature query used an arithmetic-mean midpoint and joined to araw, giving duplicated rows and x=-4601 for us7000ttfc. The second left the midpoint latitude in radians (y≈-292). Both were wasted calls before the degrees() fix.
- Mistake: The first distance calculation used depth\*1000 for B, treating A's negative-up z and B's positive-down depth as the same sign. The agent wrote the 191-feature SVG with this before noticing, then had to rewrite the file twice.
- Mistake: The final SVG appears to keep feature records inside a <script> block, so circles may be generated by JavaScript rather than written as static <circle data-id> elements. The output is truncated, so this cannot be confirmed; if so, a grader reading the SVG statically could find no circles and the pass would be lucky.
- Mistake: Land outlines were hand-drawn approximate polygons, not taken from countries.geojson, after the ST_Simplify attempts were abandoned. This was wasted effort and is not data-derived.
- Mistake: The agent tried to verify /out/map.svg with read_text, which failed because that tool only reads /data. It never confirmed the file contents.
