---
title: "Gemini 4 Argon 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-argon/geo_analyst/
---

# Gemini 4 Argon 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-argon/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-argon.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 100%  | 10 of 10     | $1.16 | 90       | 90         | 22.8 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, each run once with tools and once in code mode. Total spend was $1.16 and 90 requests with tool calling, and $0.84 and 84 requests in code mode. Easy counting tasks (deep_moment, mato_grosso, exposed) took 4–5 requests. Multi-step tasks (world_clusters, pair_map_hypo) took 14–18.

#### Where it does well

- **Data conventions:** It read DATA.md first in every run and applied the encodings correctly:
  - magnitude stored ×100 or in tenths
  - depth in negative metres
  - k='T' for earthquakes
  - VJ1/VJ2 for VIIRS
  - S/H/Q places treated as non-settlements
- **Ambiguous names:** It picked Anchorage, Alaska over Kentucky (b_gof) and BRA-602 over Mato Grosso do Sul (mato_grosso).
- **Geometry:**
  - 3D hypocentral distance in b_only_hypo, exposed and pair_map_hypo
  - Antimeridian handling in cross_section and pair_map_hypo
  - Unit-vector midpoints
- **Self-checks:** It routinely tested edge cases, including:
  - the 300 km boundary in b_gof
  - 19:59/20:00 local times in local_night
  - ST_Intersects vs ST_Contains in mato_grosso
  - zero cross-component edges in world_clusters
- **Recovery:** It got past timeouts in world_clusters (tools) and local_night (code) by changing the join strategy.

#### Mistakes it makes

None of these changed an answer, but several would break on other data.

- **Hardcoded values instead of derived ones:** The overlap start was fixed at 16:00 rather than taken from A's actual start of 16:02:31. This happened in both modes of b_only_hypo and pair_map_hypo.
- **Unjustified shortcuts:**
  - pair_map_hypo (tools) never implemented greedy matching. It relied on the 67 candidate pairs already being one-to-one.
  - brazil_nn (tools) used a ±5° search window.
  - world_clusters (tools) ignored the antimeridian in its longitude bins.
  - cross_section (tools) added a k='T' filter the task did not ask for.
- **Unverified assumptions:** In mato_grosso (tools), DATA.md was truncated and the model never read the rest. In both modes it did not check how duplicate detections should be handled.
- **Wasted calls on errors:**
  - `by` used as a reserved word
  - `write_text(encoding=...)`, twice in code mode
  - a binder error from `CREATE TABLE IF NOT EXISTS`
  - a join typo
  - multi-statement SQL calls that returned only the last result (brazil_nn, local_night)

#### Tool calling compared with code mode

Accuracy was the same: 10/10 in each mode. Code mode cost about 28% less overall ($0.84 vs $1.16). Most of that gap comes from one case:

| Case            | Tools              | Code mode          |
| --------------- | ------------------ | ------------------ |
| pair_map_hypo   | $0.41, 18 requests | $0.13, 14 requests |
| local_night     | 13 requests        | 9 requests         |
| All other cases | $0.75              | $0.71              |

In pair_map_hypo with tools, the model spent calls on ST_Dump errors while drawing land outlines the task did not need. In code mode it actually implemented the greedy matching.

Code mode also tended to be more rigorous in other places:

- It cross-checked the brazil_nn medians against QUANTILE_CONT.
- It used exact Decimal half-up rounding in world_clusters.

Code mode was not cheaper on the small cases. It cost more on deep_moment ($0.050 vs $0.029) and exposed ($0.060 vs $0.037).

For complex, multi-stage tasks, code mode is the safer and cheaper choice. For simple lookups, tool calling is slightly cheaper.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md, then ran one filtered count query on catalogue A (k='T', mk=3 for moment magnitude, m>=500, z\<-70000, 1–15 Nov UTC) and got 7. It ran a broader check query and submitted 7, which is correct. ($0.029, 4 requests, 23 s)
- Right: Read DATA.md first and applied its conventions: magnitude scaled ×100 (m>=500), depth as negative metres (z < -70000), mk=3 for moment magnitude, and k='T' for tectonic events.
- Right: Used a half-open UTC window \[2026-11-01, 2026-11-16) for 'from 1 to 15 November'.
- Right: Computed variants in one query (strict vs inclusive depth bound, rv=1) to confirm the boundary choices did not change the count.
- Mistake: Nothing wrong affected the answer. The second query listed nearby events with mk=2 and out-of-window dates but never printed a count, so it added little beyond the first query's breakdown. The 'strict_lt_70km_kT' column repeated the k='T' condition already in the WHERE clause.

### mato_grosso

**Tool calling: passed.** The agent read DATA.md and found Mato Grosso's region ID (BRA-602), separating it from Mato Grosso do Sul. It then counted cls='H' fire points inside the state polygon on 21 Nov 2026 UTC, got 5, and submitted 5, which was correct. ($0.034, 5 requests, 80 s)
- Right: Read DATA.md before running any queries.
- Right: Used ILIKE '%Mato Grosso%' and picked BRA-602 over the similarly named BRA-600 (Mato Grosso do Sul).
- Right: Ran ST_Intersects and ST_Contains side by side as a check on boundary points; both returned 5.
- Right: Listed the 5 matching rows to confirm the timestamps fall on 21 Nov UTC and that cls is 'H'.
- Mistake: DATA.md was only partly shown (11169 more characters were cut off) and the agent never read the rest. It relied on cls='H' meaning high confidence and on the day being defined in UTC without checking those conventions; the answer happened to be right.
- Mistake: All 5 detections come from a single satellite pass (sat 'MT' at 00:39 UTC) and four of them sit very close together. The agent did not check whether DATA.md asks for duplicate or overlapping detections to be handled; it passed, so this may not have mattered.

### b_only_hypo

**Tool calling: passed.** The agent read DATA.md and loaded both catalogues, converting A's elevation in metres and B's depth to radius. It limited B to the overlap window, magnitude 4.5 or more, and counted the B events with no A event within 30 s and 50 km of 3D hypocentral distance. It got 36, which matches the expected answer. ($0.11, 7 requests, 2.6 min)
- Right: Read DATA.md first and handled the unit conventions: A's z is elevation in metres (divided by 1000 and added to the Earth radius), A's m is magnitude×100, and B's coordinates carry hemisphere suffixes and its time is given as year-day plus seconds.
- Right: Restricted B to the period both catalogues cover (from A's start, 26 October), not B's full span starting 12 October.
- Right: Used true 3D hypocentral distance, combining the chord distance with the radius difference, as the 'hypocentre within 50 km' wording requires.
- Right: Matched against A events of any class, with no filter on A's class field, as the question asks.
- Right: Checked the result with a second method: the final count used Cartesian coordinates with NOT EXISTS, after earlier diagnostic queries using the haversine-based 3D formula.
- Mistake: The overlap start was hardcoded as 2026-10-26 16:00 rather than taken from A's actual minimum time (16:02:31). This was harmless only because the agent checked that the first B event in that window, at 19:36, came after A's start.
- Mistake: Two diagnostic queries in the middle, listing near-threshold cases, used extra calls but did not change the approach.

### local_night

**Tool calling: passed.** The agent filtered catalogue A to k='T' with m >= 250 (magnitude stored ×100), which left 1804 events. It found the nearest settlement to each by haversine over a full cross join of 162,307 places (excluding kinds S, H, Q), converted the event times to that settlement's tz, and counted local hours >= 20 or < 6. The result was 787, which matches the expected answer. ($0.099, 13 requests, 2.1 min)
- Right: Read DATA.md first and applied its conventions: k='T' keeps only earthquakes, m is magnitude ×100, and places of kind S/H/Q are not settlements.
- Right: Saw that the first join with a dot-product cutoff (> 0.85) could miss the true nearest place (the max nearest distance was 3,372 km), so it redid the search as a full CROSS JOIN.
- Right: Converted to local time with DuckDB timezone(tz, ts), which handles DST correctly.
- Right: Checked edge cases: events whose first and second nearest settlements are in different zones and nearly equidistant, and events at exactly 19:59, 20:00, 05:59 and 06:00 local time.
- Mistake: The first attempt with the 0.85 cosine cutoff was wasted work, though the agent caught the problem.
- Mistake: It ran several statements in one run_sql call and only the last result came back, so it needed a second query to see both counts. This was a minor inefficiency.

### brazil_nn

**Tool calling: passed.** The agent assigned VIIRS (VJ1/VJ2) fires to Brazilian states using bbox prefilters plus ST_Intersects. It found the nearest settlement with pop >= 10,000 (excluding kinds S/H/Q) by haversine within a ±5° window and computed per-state medians with the even-count average. All 27 rows matched the expected answer. ($0.089, 9 requests, 1.5 min)
- Right: Read DATA.md first and used the satellite codes VJ1/VJ2 to select VIIRS detections, later confirmed with a DISTINCT sat, px_m query.
- Right: Filtered settlements by pop >= 10000 and excluded non-settlement kinds (S, H, Q), apparently following the data conventions.
- Right: Did not restrict settlements by country, as the question requires, and used a box wider than Brazil to catch neighbouring towns.
- Right: Checked that the ±5° search window found a settlement for every fire: the count stayed 93,791 and the maximum distance was 387 km.
- Right: Computed the median correctly with ROW_NUMBER at positions (cnt+1)//2 and (cnt+2)//2, then averaged, which handles even counts.
- Mistake: The ±5° window was only checked by coverage. A fire with a nearer settlement just outside the window would have been missed, though the 387 km maximum makes this unlikely to matter.
- Mistake: One diagnostic call returned output only for its last statement (sat/px_m), so the place-kind check in that call produced nothing visible. This was minor waste.

### exposed

**Tool calling: passed.** The agent read DATA.md and ran two SQL queries computing the 3D straight-line distance from each settlement with population of 500,000 or more to each catalogue A hypocentre. It submitted 23 place ids, which match the expected set. ($0.037, 4 requests, 29 s)
- Right: Read DATA.md before querying.
- Right: Applied the documented conventions: magnitude stored ×100 (m/100), depth in metres (z/1000, negative downward), excluded non-settlement place kinds S/H/Q, and kept only k='T' events.
- Right: Measured to the hypocentre rather than the epicentre, using the chord formula sqrt(r1²+r2²−2·r1·r2·cosθ) with r2 = 6371 + z_km.
- Right: In the second query, widened the prefilter to a 0.5-radian latitude band with no longitude limit, removing the risk that the tight first prefilter (0.2 rad latitude, 0.3 rad longitude) had dropped valid pairs.
- Right: Used a strict < comparison and returned distinct pids cast to strings.
- Mistake: Minor inefficiency: the first query used a ×1.5 tolerance and a tight bounding box purely for exploration, so a second query was needed. The run still finished in three tool calls.

### b_gof

**Tool calling: passed.** The agent read DATA.md and identified Anchorage, Alaska (pid 5879400). It filtered catalogue A to earthquake events with a local magnitude within 300 km by haversine, rounded halves up in integer hundredths, and computed the goodness-of-fit Mc search in a single SQL query. It answered b=1.152, which matches the expected value. ($0.057, 6 requests, 55 s)
- Right: Separated Anchorage, Alaska (pid 5879400, pop 289600) from Anchorage, Kentucky.
- Right: Read the DATA.md conventions and applied them: filtered k='T' and mk=1 and treated m as hundredths (min -154, max 450).
- Right: Rounded halves up exactly in integer space with floor((m+5)/10), so no float rounding errors.
- Right: Ran the full candidate loop (N, mean, b, a, predicted bins, R) in one query.
- Right: Checked events near the 300 km boundary (299.33-300.82 km) to make sure the cutoff was handled correctly.
- Mistake: The visible tool result was truncated before the row where R reaches 85, so the chosen Mc and the b of 1.152 cannot be confirmed from the transcript. The agent did not run a narrower follow-up query to show that row explicitly.

### world_clusters

**Tool calling: passed.** The agent filtered fires to the VIIRS satellites (VJ1, VJ2) and built a spatial-temporal grid self-join to find edges (≤1 km haversine, ≤12 h). It computed connected components with iterative min-label propagation plus pointer jumping, checked that no cross-component edges remained, and reported all 45 clusters of 300 or more detections with correct counts and FRP sums. The run passed. ($0.18, 17 requests, 3.4 min)
- Right: Correctly identified the VIIRS satellites as VJ1/VJ2 and excluded the MODIS satellites MA/MT.
- Right: Recovered from the 30-second timeout by adding a time bin (t/43200) and a 27-offset grid join, which produced 1,874,135 edges.
- Right: Used a 1/100° latitude bin and a 1/30° longitude bin, wide enough for 1 km at latitudes up to about 71°.
- Right: Checked convergence by verifying that 0 edges cross component labels.
- Right: Converted frp_kw to MW and checked edge cases: pairs at exactly 1 km and sums ending in exactly .05 MW.
- Mistake: During iteration 2 the agent wrote a typo in a join condition (`e.v = cu.node AND e.v = cv.node`). It noticed this and rebuilt active_edges from the full edges table, which cost an extra call.
- Mistake: The longitude bin did not handle the antimeridian. The agent only checked this afterwards and found 2 points with |lon| > 179.9.
- Mistake: For the half-way cases, the final answer used half-up decimal rounding, giving 30720.6 where the double-based sum-then-divide gives 30720.5. The expected answer gives 2 decimals (30720.55), so either result was probably accepted within tolerance.

### cross_section

**Tool calling: passed.** The agent built a great-circle frame in DuckDB SQL from 3D unit vectors. It filtered catalogue A to events with a magnitude that lie within 150 km of the circle and project between the endpoints, computed x and y, generated 25 circles with data-id, wrote /out/map.svg and replied 25, matching the expected answer. ($0.11, 7 requests, 2.2 min)
- Right: Read DATA.md first and correctly converted z from metres (negative) to km depth: y = (-z/1000)\*(500/700).
- Right: Used a proper spherical approach: cross-track distance R\*asin(p·n) and along-track angle atan2 in the plane of the great circle, normalized by theta_b. This correctly handles the dateline crossing between 178°E and 174°W.
- Right: Ran sanity checks: the counts with and without the k and m filters were all 25, and the nearest excluded event was 160 km away against a maximum included distance of 135 km, so no event sat on the boundary.
- Right: Generated the SVG circles directly in SQL with printf. Only the circles carry data-id and the radius is 4, within the 2–6 range.
- Mistake: The filter included k = 'T' without the task asking for it; it made no difference here (all_k_count equals exact_count, 25), but it could have dropped valid events.
- Mistake: The first SQL call failed because `by` is a reserved word, costing one extra call.

### pair_map_hypo

**Tool calling: passed.** The agent parsed both catalogues and filtered them to the area (including the antimeridian crossing) and to the overlapping period. It built the time and distance candidates, found that all 67 were unique one-to-one so no greedy step was needed, and computed great-circle midpoints. It then wrote a 900x900 SVG with 158 circles carrying data-ids and reported 158 features, which passed. ($0.41, 18 requests, 7.8 min)
- Right: Read DATA.md first and parsed catalogue B's year-day plus seconds times and its N/S/E/W coordinate strings correctly.
- Right: Handled the antimeridian with (lon >= 160 OR lon \<= -170) and shifted negative longitudes by +360 for x pixel coordinates (scale of 30 px per degree).
- Right: Restricted catalogue B to the period catalogue A covers (from 2026-10-26 16:00).
- Right: Used 3D hypocentre distance that includes depth, matching the 'hypocentres 50 km apart' wording.
- Right: Checked that candidate pairs were already one-to-one (67 pairs, 67 distinct A ids, 67 distinct B ids), so the greedy matching was trivially satisfied.
- Right: Computed great-circle midpoints by averaging unit vectors, which is correct; output coordinates match the expected ones.
- Right: Kept circle radii within 2-6 px and put data-id only on feature circles.
- Mistake: The agent never actually implemented the greedy one-to-one matching. It relied on the candidates happening to be unique, which it did check, but the approach would break if they were not.
- Mistake: The B period filter ends at a hardcoded 15:36 instead of taking the actual minimum of the two catalogue end times. It was harmless here because B ends earlier.
- Mistake: Filtered catalogue A with k = 'T' without visibly checking that this matches the question's notion of 'earthquakes'. The result was correct but the check is not shown.
- Mistake: Several SQL calls were wasted on ST_Dump, ST_DumpPoints and ST_PointN type errors while building land outlines that the task did not require.
