---
title: "Gemini 4 Neon 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 100%; rank 1 of 20."
canonical: https://models.pydantic.dev/models/gemini-4-neon/geo_analyst/
---

# Gemini 4 Neon on Pydantic AI Geo Analyst

> Spatial questions and SVG maps from raw earthquake, fire and place data in DuckDB. Tool calling 100%, code mode 100%; rank 1 of 20.
>
> Markdown copy of https://models.pydantic.dev/models/gemini-4-neon/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/gemini-4-neon.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 100%  | 10 of 10     | $4.20 | 173      | 208        | 35.1 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

The model passed all 20 runs: 10 cases in tool-calling mode and the same 10 in code mode. Across the tool-calling runs it used 173 requests and $4.20. Code mode used 118 requests and $2.96. No reviewer recorded a failure cause. Every mistake noted was an inefficiency or an unproven shortcut, and none produced a wrong answer.

#### Where it does well

- **Reads the data documentation first, in every run.** It decodes the stored formats correctly: magnitudes as hundredths (m≥500), depth as negative metres, mk=3 for moment magnitude, and B's year-day timestamps (checking that day 305 is 1 Nov).
- **Tells similar names apart.** It picked Anchorage, Alaska over the Kentucky entry (b_gof), and Mato Grosso (BRA-602) over Mato Grosso do Sul (mato_grosso).
- **Handles geometry correctly.** It used 3D hypocentral distance rather than surface distance. In pair_map_hypo, one pair is 7.4 km apart at the surface but 53.3 km apart in 3D, and was correctly excluded. It handled boxes and lines that cross the 180° meridian (cross_section, pair_map_hypo).
- **Verifies heavily.** Examples include:
  - comparing different spatial-containment functions (mato_grosso);
  - checking events near cutoffs (b_only_hypo: largest match 49.8 km against the 50 km limit);
  - independent recomputation in SQL or Python;
  - testing timezone conversion across daylight-saving changes (local_night).
- **Takes care with rounding.** In world_clusters it avoided float errors with integer arithmetic (tools) or Decimal ROUND_HALF_UP (code mode).

#### Mistakes it makes

- **Small syntax and API errors that cost a retry.**
  - In both modes it used `by` as a column alias, which SQL rejects (cross_section).
  - In code mode it hit Python errors: sorting PosixPath objects (3 cases), passing a float to `timedelta` in a way that failed (2 cases), and an unsupported `write_text` encoding argument (2 cases).
- **Shortcuts that happened to hold but were not proven:**
  - brazil_nn: a South-America-only settlement search, plus a 150 km fallback threshold beyond what the grid guarantees (about 110 km);
  - pair_map_hypo (tools): matching relied on the candidates already being one-to-one, rather than a general greedy procedure;
  - b_only_hypo (tools): hand-typed, rounded overlap bounds instead of A's exact first and last times.
- **Assumptions it did not check.** mato_grosso assumed days are counted in UTC in both modes, and never confirmed this against DATA.md. In the tool-calling run, this choice decided whether some 00:39 UTC detections counted.
- **Redundant work.** About 7 calls tuning SVG land polygons, which the task did not require (pair_map_hypo, tools), plus repeated verification queries in most cases.

#### Tool calling compared with code mode

Code mode used fewer requests in all 10 cases, about 32% fewer in total. It cost less in 8 cases. The remaining two (deep_moment, exposed) were within $0.002 of the tool-calling cost.

The largest saving was pair_map_hypo: 34 requests and $1.41 with tool calls, against 21 requests and $0.57 in code mode. Code mode also put cross-checks in the same call, such as Python against SQL and BFS against pointer-jumping.

The trade-off is a different kind of wasted call. Code mode lost retries to Python runtime errors, while tool calling lost them to SQL binder and parser errors. Both modes reached the same answers.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md and loaded quakes_a.jsonl into DuckDB. It filtered to UTC dates 1–15 Nov, k='T', mk=3 (moment magnitude), m>=500 (hundredths) and z\<-70000 (metres, negative below sea level), which gave 7. It answered {"count": 7}, which is correct. ($0.14, 10 requests, 56 s)
- Right: Read DATA.md before querying and used its conventions for scaled units: magnitude in hundredths and depth in metres with negative values below sea level.
- Right: Filtered on mk=3 for moment magnitude, so ML/mb-type events that also had m>=490–520 in the wider check query were excluded.
- Right: Used a half-open UTC window (>= 2026-11-01, < 2026-11-16), so the last day was counted in full.
- Right: Ran boundary checks: a wider window (31 Oct–17 Nov, m>=490, z\<=-65000) and raw local-offset timestamps. These confirmed that edge events us7000tuku (31 Oct UTC) and us7000tyhr (16 Nov UTC) fall outside the window.
- Right: Ran a query looking for k!='T' events with m>=500 and positive z values, and none turned up in the result.
- Mistake: Minor inefficiency: there were several overlapping verification queries after the first count of 7. They were reasonable checks, but somewhat redundant.

### mato_grosso

**Tool calling: passed.** The agent found Mato Grosso (BRA-602) in regions.tsv, filtered fires.parquet to cls='H' on the UTC day 2026-11-21, and ran a point-in-polygon test. It got 5 and checked the result several ways before answering {"count": 5}, which matches the expected answer. ($0.12, 8 requests, 52 s)
- Right: It read DATA.md first and used the exact-name match BRA-602, so Mato Grosso do Sul (BRA-600) was not picked up by the LIKE '%mato grosso%' search.
- Right: It checked that the polygon was valid and confirmed the session TimeZone was UTC before building the day window from epoch bounds.
- Right: It compared ST_Covers, ST_Intersects, ST_Within and ST_Contains, and all returned 5, so the boundary predicate made no difference.
- Right: It looked at near-boundary points within 0.5° and confirmed the nearby ones (256541, 256554, 256555) belong to Bolivia's Santa Cruz.
- Right: A per-state breakdown across Brazil gave the same count of 5 for Mato Grosso.
- Mistake: Some extra checks were redundant, such as the full per-date/class breakdown and the all-Brazil state counts. They cost requests but caused no errors.
- Mistake: The transcript does not show the agent confirming from DATA.md that the day should be counted in UTC rather than local Brazilian time. The UTC answer matched the expected result, but the near-boundary list contains 00:39 UTC detections on 21 Nov, which fall on 20 Nov in local time, so this choice affected the count.

### b_only_hypo

**Tool calling: passed.** The agent parsed both catalogues and limited B to the overlap window (from A's first event on 26 Oct to its last on 25 Nov), filtered B to magnitude ≥4.5 (442 events). It then anti-joined against A on ±30 s and a 3D hypocentral distance ≤50 km, found 36 unmatched events and answered 36, which is correct. ($0.35, 18 requests, 2.2 min)
- Right: Read DATA.md first. Correctly handled A's local-offset timestamps, verified by comparing raw strings with parsed UTC values for several offsets.
- Right: Parsed B's year-day plus seconds-of-day format, checked that day 305 maps to 1 Nov, and converted N/S/E/W hemisphere letters to signed coordinates.
- Right: Treated A's z as negative elevation in metres and B's depth as km, then computed true 3D hypocentral distance with Cartesian coordinates.
- Right: Restricted B to the overlap period, as the question's 'period both catalogues cover' requires.
- Right: Ran sensitivity checks: borderline matches, max matched dt (6.3 s) and distance (49.8 km), and a second distance formula giving the same 36. These showed the answer was robust.
- Mistake: The overlap window used hand-typed rounded bounds ('2026-10-26 16:00' to '2026-11-25 15:36') rather than A's exact min/max timestamps. It was harmless here but fragile.
- Mistake: The first query failed because it used SET TimeZone, which wasted a call. Several diagnostic queries were more than needed, though not harmful.

### local_night

**Tool calling: passed.** The agent filtered catalogue A to earthquakes (k='T') with m>=250 (hundredths), 1804 events. It found each event's nearest settlement (excluding kinds S, H, Q) using a staged 3D chord-distance search, converted UTC to local time with the settlement's IANA tz, and counted 787 night events. This matches the expected answer. ($0.31, 18 requests, 2.5 min)
- Right: Read DATA.md first and applied its conventions: magnitude stored in hundredths (m>=250), earthquake kind 'T', and settlement kinds excluding S/H/Q.
- Right: Used a staged nearest-neighbour search (chord \<=0.05, then \<=0.2, then a brute-force pass for the last 33) that guaranteed all 1804 events were matched exactly once.
- Right: Checked the nearest-neighbour results against a haversine brute force on 100 events: 100 of 100 matched.
- Right: Used the IANA tz with `AT TIME ZONE` to get DST-aware local time, and tested this around the 1 Nov fallback before relying on it.
- Right: Inspected near-tie cases where the second-nearest settlement has a different time zone (e.g. Fernando de Noronha, Recife vs Noronha) and confirmed the strict nearest settlement was used.
- Right: Compared the hour-based and time-based night filters (both 787) and contrasted them with UTC (747) and the raw-offset interpretation (795).
- Mistake: The run had a few redundant steps: a DESCRIBE of quakes_a was repeated, and the read_json was re-read with explicit types. These cost calls but did not change the result.

### brazil_nn

**Tool calling: passed.** The agent loaded the Brazil regions, filtered the fires to VIIRS (VJ1/VJ2) inside a bounding box and joined them to states with ST_Covers. It then computed haversine distances to settlements of 10k or more (excluding kinds S/H/Q), using a 2° grid search with an exhaustive fallback, and took per-region medians. All 27 rows match the expected counts and medians. ($0.34, 16 requests, 2.4 min)
- Right: Read DATA.md first. It applied the settlement definition by excluding kinds S, H and Q, which gave 41,954 settlements of 10k or more.
- Right: Checked the invalid Goiás polygon: ST_Covers counts were the same on the original and the ST_MakeValid geometry (62), and nothing was double-assigned (93,791 rows, 93,791 distinct fids).
- Right: Considered settlements in other countries. The non-BR nearest places included Cobija (BO) and Santa Elena de Uairén (VE).
- Right: The grid search alone missed some nearest settlements. It re-ran an exhaustive search for every fire with a grid distance of 150 km or more, which improved 256 fires.
- Right: Checked its own median calculation against DuckDB's MEDIAN; the difference was 0.
- Mistake: The exhaustive fallback searched only settlements_sa (lat -45..15, lon -85..-25), not the whole world. That was safe here because the maximum distance was about 387 km, but it was not strictly proven.
- Mistake: The fallback threshold of 150 km was a heuristic. The 3x3 grid of 2° cells only guarantees correctness out to roughly 1° (about 110 km or less, depending on where the fire sits in its cell), so a fire whose grid distance was between about 110 and 150 km could in principle have had a closer settlement outside its 3x3 cells. The final answer was still correct.

### exposed

**Tool calling: passed.** The agent loaded places and catalogue A. It computed 3D straight-line distances from settlements with population of 500,000 or more (excluding kinds S/H/Q) to hypocentres of type-T quakes, using m/100 as magnitude and z in metres. It returned 23 ids that match the expected set exactly. ($0.21, 12 requests, 81 s)
- Right: Read DATA.md before querying and checked the schemas and sample rows.
- Right: Correctly scaled the magnitude (m/100) and depth (z in metres, negative down) into a 3D hypocentre position.
- Right: Computed both a Cartesian chord distance and a haversine-based 3D distance and confirmed they agree.
- Right: Ran a check without the filters (all event kinds and all place kinds) to see whether the exclusions changed the result, then used the filtered set.
- Right: Cast pid to VARCHAR so the ids came out as strings.
- Mistake: Minor inefficiency: the first places load had to be redone with a pid type override.
- Mistake: Applied the k='T' and kind NOT IN ('S','H','Q') filters based on its reading of DATA.md, which was truncated in the transcript. The result matched, but the full justification isn't visible.

### b_gof

**Tool calling: passed.** The agent found Anchorage, Alaska (pid 5879400) in places.psv, filtered catalogue A to local-magnitude events (k='T', mk=1) within 300 km by haversine, rounded halves up via FLOOR((m+5)/10), and ran the full goodness-of-fit Mc scan in SQL. It took Mc=2.0 (N=616) and answered b=1.152, which matches the expected answer. ($0.32, 18 requests, 1.9 min)
- Right: Read DATA.md first and worked out the encoding of m (hundredths), k and mk.
- Right: Told the two Anchorage entries apart and picked the Alaska one (A2, 61.218, -149.900) over the Kentucky one.
- Right: Checked negative magnitudes and values ending in 5 so the halves-up rounding (FLOOR((m+5)/10)) would be correct for negatives too.
- Right: Built empty bins with generate_series so zero-count magnitudes counted in the fit sum.
- Right: Recomputed b at Mc=2.0 with full precision (1.1521335) as a check before answering.
- Mistake: Some calls were wasted: the raw line count of quakes_a.jsonl, the substring search of places.psv for 'Anchorage' (it mostly returned other places in the America/Anchorage timezone), and the separate histogram listing.
- Mistake: The output of the R scan was truncated after Mc=1.9, so the transcript never shows R reaching 85 at Mc=2.0. The agent did not print the rows around the threshold to confirm Mc explicitly, although the final answer was correct.

### world_clusters

**Tool calling: passed.** The agent filtered fires.parquet to the VIIRS satellites (VJ1, VJ2; 680,723 rows). It built 1.87M links using 3D 1-km grid cells with a haversine check of 1 km or less and a time difference of 43,200 s or less, then found connected components through iterated SQL pointer-jumping. It returned 45 clusters of 300 or more detections whose counts and FRP sums match the expected answer, and the run passed. ($0.49, 23 requests, 6.9 min)
- Right: Took 'VIIRS' to mean sat VJ1/VJ2 only and excluded the MODIS satellites MA and MT.
- Right: Used 3D Cartesian 1-km cells with 27-neighbour offsets, which avoids antimeridian and longitude-scaling problems, and confirmed with a 2-km grid that the edge count (1,874,135) did not change.
- Right: Converted frp_kw to MW by dividing by 1000.
- Right: Checked the components carefully: zero remaining cross-component edges, zero non-root pointers, and a recursive reachability test showing 27,725 nodes with 0 extra and 0 unreached.
- Right: Looked at boundary cases near exactly 1 km and near the 12 h limit, and found that minute-quantized timestamps made the 43,200 s cutoff unambiguous.
- Right: Computed rounding in integer arithmetic ((kw+50)//100) to avoid half-up/half-even issues, e.g. 310601 gives 30720.6 rather than the 30720.5 that double rounding produced.
- Mistake: Spent a few extra queries on verification (borderline distance listings, testing several rounding methods). This was thorough but more than strictly needed.
- Mistake: Its first CREATE TABLE query failed with a binder error because it referenced a column alias in the same SELECT; it had to recompute the cell indices inline.

### cross_section

**Tool calling: passed.** The agent computed cross-track and along-track distances for catalogue A events with vector great-circle math in DuckDB. It selected 25 earthquakes with a magnitude, within 150 km of the line and projecting between the endpoints, and wrote an SVG with the correct circles. The run passed. ($0.52, 16 requests, 8.6 min)
- Right: Read DATA.md first. Correctly decoded z as negative metres (depth_km = -z/1000) and m as hundredths of a magnitude unit.
- Right: Used a robust vector-frame projection (normal vector plus atan2 along-track angle), which handles the antimeridian crossing correctly.
- Right: Cross-checked the vector method against spherical-trig cross- and along-track formulas; the differences were 0.
- Right: Checked for borderline cases near the 150 km boundary and near the endpoints (0 found), and reviewed events just past the B end (e.g. us7000ttnt at x=1078) to confirm they were correctly excluded.
- Right: Kept data-id only on the circles, with radii between 2.5 and 6. The 25 coordinates match the expected output.
- Mistake: The first SQL attempt failed with a parser error because `by` is a reserved word used as a column alias; this cost one retry.
- Mistake: Filtered on k = 'T' (earthquakes only). The task's wording 'every earthquake' made that reasonable, and the agent confirmed no non-T events fell in the region, so it did not matter here.
- Mistake: Ran several redundant exploratory queries (bounding-box listings, counts), which were somewhat wasteful but harmless.

### pair_map_hypo

**Tool calling: passed.** The agent loaded both catalogues, restricted B to the overlapping time window, selected events in the box that crosses the 180° meridian, and matched them using 3D hypocentral distance. It placed pair midpoints on the great circle, wrote a 900x900 SVG with 158 data-id circles to /out/map.svg, and passed. ($1.41, 34 requests, 7.4 min)
- Right: Converted the A timestamps with their local offsets and the B year-day plus seconds fields to UTC epochs, and checked that 2026-305 maps to 1 November.
- Right: Restricted B to the period both catalogues cover (A's range, 2026-10-26 16:02 to 2026-11-25 15:35) and used A's integer magnitude (m_int >= 450).
- Right: Handled the box across 180° with lon360 between 160 and 190, and probed a 1° margin to confirm nothing sat near the edges.
- Right: Computed hypocentre distance in 3D Cartesian coordinates (radius 6371 − depth), not surface distance. Near-miss checks show this matters: us7000ttfk/B639c8287 is 7.4 km apart at the surface but 53.3 km in 3D, so it is correctly excluded.
- Right: Found 67 candidates involving 67 distinct A and 67 distinct B events, so greedy one-to-one matching was trivially all of them.
- Right: Computed great-circle midpoints from normalized unit-vector sums and verified them with haversine checks (max_diff 0).
- Right: Checked the 158 features: distinct ids, no nulls, none out of bounds. Circle radii were clamped to 3–6 px, inside the required 2–6.
- Mistake: Spent many run_sql calls (about 7) tuning land-polygon simplification and SVG path size, which the task did not require; this was wasteful but harmless.
- Mistake: The matching step was not implemented as a general greedy procedure. It relied on the candidate set already being one-to-one, which happened to hold here.
