---
title: "GPT-6.1 Terra 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/gpt-6.1-terra/geo_analyst/
---

# GPT-6.1 Terra 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/gpt-6.1-terra/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.1-terra.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | ------- |
| Tool calling | 100%  | 10 of 10     | $0.24 | 94       | 100        | 7.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 in both modes. Tool calling took 94 requests and cost $0.243. Code mode took 80 requests and cost $0.197. Cases ranged from single-count queries (deep_moment: 3–5 requests, about $0.007) to multi-step map and graph work (pair_map_hypo: 14–19 requests, up to $0.101).

#### Where it does well

- **It reads DATA.md first, every time, and applies the encodings it finds there.** These include `k='T'`, magnitude stored ×100 or in tenths, depth as negative metres, `mk` scale codes, VIIRS = VJ1/VJ2, and excluding place kinds S/H/Q.
- **It picks the right entity when names are ambiguous.** It chose Anchorage, Alaska over Kentucky (b_gof), and Mato Grosso BRA-602 over Mato Grosso do Sul (mato_grosso).
- **Its geometry is sound.**
  - It uses 3D hypocentre distance rather than epicentral distance (b_only_hypo, exposed, pair_map_hypo).
  - It computes great-circle midpoints by vector averaging.
  - It handles the dateline in both filters and projections.
  - It uses 3D grid buckets for world_clusters, where it resolved 45 clusters across 680,723 detections.
- **It catches gaps in its own prefilters.** In brazil_nn and local_night it re-ran suspect nearest-neighbour results against all candidates (39 and 203 events in local_night; 593 in brazil_nn code mode).
- **It reports sanity counts.** Examples are 442 = 406 + 36 in b_only_hypo and the 158 unique data-ids in pair_map_hypo.

#### Mistakes it makes

None of these mistakes caused a failure, but several passes were partly luck.

- **Unverified assumptions:**
  - Units and conventions were never sanity-checked when the DATA.md output was truncated: deep_moment, mato_grosso, and world_clusters time in seconds.
  - Overlap windows were hardcoded (16:00 / 15:36) in b_only_hypo and pair_map_hypo, in both modes.
  - Prefilter sizes were chosen before being validated (exposed tools, cross_section code, the brazil_nn tools bounding box).
- **Logic that only worked because of the data:**
  - In b_gof code mode, the fit ran on a `round()` histogram instead of the halves-up one. It was saved only because the two differ below tick 0.
  - In pair_map_hypo tools mode, the agent never wrote the greedy one-to-one matching. It relied on the candidate set already being one-to-one.
- **Wasted calls:**
  - Multi-statement SQL calls returned only the last result in 5 runs (exposed in both modes, local_night tools, pair_map_hypo tools, brazil_nn code).
  - A reserved-word alias `by` caused one failed query (cross_section tools).

#### Tool calling compared with code mode

Accuracy was identical. Code mode used fewer requests (80 vs 94) and cost about 19% less. That saving comes almost entirely from pair_map_hypo ($0.048 vs $0.101). Without that case, tool calling is slightly cheaper ($0.142 vs $0.149). Tool calling was also cheaper on 6 of the 10 cases, including b_gof, exposed and mato_grosso.

Code mode brought Python-runtime errors:

- a missing `xml` module
- `write_text` rejecting the encoding argument
- `fromisoformat` failing on '+00'

It also spent effort on unrequested extras in pair_map_hypo, such as labels, graticules and land polygons. On the other hand, code mode verified more explicitly in places: it confirmed the R values below Mc in b_gof, wrote tie-broken greedy matching in pair_map_hypo, and checked the data-id count.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md, then answered with one DuckDB query on quakes_a.jsonl filtering class T, moment magnitude (mk=3), m >= 500, z < -70000 and UTC times from 1 to 15 November. It got 7, which matches the expected answer. ($0.0066, 5 requests, 12 s)
- Right: It read DATA.md in three parts before querying, including the magnitude-scale codes and the rule that an earthquake is class 'T'.
- Right: It applied every needed filter in one query: k = 'T', mk = 3, the scaled magnitude threshold m >= 500, the depth threshold z < -70000 and the 1–15 November window.
- Right: The upper time bound is exclusive at 16 November 00:00, so all of 15 November is included.
- Right: It finished in four tool calls with nothing wasted.
- Mistake: It did not run a quick check (for example a sample of rows or the min/max of m and z) to confirm its reading of the scaling and sign conventions for m and z. The part of DATA.md defining those keys is truncated in the transcript, so the units behind m >= 500 and z < -70000 cannot be verified here; the matching answer suggests they were right.
- Mistake: It used UTC day boundaries without any visible check in the transcript that UTC is the convention the questions follow.

### mato_grosso

**Tool calling: passed.** The agent read DATA.md, found the Mato Grosso state polygon (BRA-602), and distinguished it from Mato Grosso do Sul. It then counted fires with cls='H' on 21 Nov 2026 (UTC epoch range) whose points fall inside the polygon. The answer was 5, which is correct. ($0.0062, 4 requests, 12 s)
- Right: Read DATA.md before querying.
- Right: Used ILIKE to find both Mato Grosso states and picked the correct rid BRA-602 rather than Mato Grosso do Sul.
- Right: Ran a spatial containment test (ST_Covers) against the state polygon instead of relying on a name field.
- Right: Got there with only three tool calls before answering.
- Mistake: The transcript does not show the agent checking whether the epoch units of f.t, the H confidence code, or the day boundary (UTC or local) matched the DATA.md conventions, since that file was truncated in the transcript. The answer was still correct.
- Mistake: It did not check for duplicate detections across the four satellites or other dedup conventions, though this did not affect the result.

### b_only_hypo

**Tool calling: passed.** The agent loaded both catalogues into DuckDB, decoded catalogue B's year-day plus seconds-of-day time and its hemisphere-lettered coordinates, and limited B to the overlap window starting at A's first event. It then matched B events of M≥4.5 to A events within ±30 s using a 3D hypocentral distance of ≤50 km and found 36 unmatched. This equals the expected answer. ($0.015, 7 requests, 26 s)
- Right: Read DATA.md and sampled both quake files before writing queries.
- Right: Decoded catalogue B correctly: strptime '%Y-%j' plus seconds-of-day, and N/S/E/W hemisphere letters turned into signs.
- Right: Fixed the INT32 overflow on the first time conversion by switching to 10-millisecond units.
- Right: Restricted B to the period both catalogues cover, from catalogue A's first event onward.
- Right: Used a 3D chord distance between hypocentres, built from A's elevation in metres (converted to km) and B's depth in km, which matches 'hypocentre within 50 km'.
- Right: Did not filter A by event class, as the question asked ('any class').
- Right: Reported sanity counts (442 selected, 406 matched, 36 unmatched).
- Mistake: The window bounds were hand-typed and rounded (16:00:00 start, 15:36:00 end) rather than taken from the exact min/max times. This worked, but it was slightly fragile.
- Mistake: It read only the first 200 lines of DATA.md, plus a later section, and did not explicitly check whether there were conventions on revisions or duplicate rows in catalogue A. It passed anyway.

### local_night

**Tool calling: passed.** The agent filtered catalogue A to events with k='T' and m>=250 (1804 events) and kept places whose kind was not S, H or Q. It found the nearest place with a dot-product great-circle metric inside a ±10° latitude band, then redid the search against every place for the 39 events whose best match was suspect. It converted each event to the nearest place's time zone and counted 787 night events, which matches the expected answer. ($0.016, 9 requests, 33 s)
- Right: Read DATA.md first and applied its conventions: event type k='T', magnitude stored ×100 so m>=250, and places excluding kinds S/H/Q.
- Right: Used a spherical distance metric (dot product of unit vectors) rather than planar lat/lon distance.
- Right: Noticed that the ±10° latitude prefilter could miss the true nearest place (39 events had best < cos 10°) and redid those against all places.
- Right: Converted UTC to local time per IANA zone and applied the time window correctly as >=20:00 OR \<06:00.
- Mistake: A minor slip: the call 'DESCRIBE SELECT * FROM q2; DESCRIBE SELECT * FROM p2;' only returned p2's schema. It added nothing and was wasted.
- Mistake: Tie-breaking between equidistant places was not handled explicitly, though it did not affect the result.

### brazil_nn

**Tool calling: passed.** The agent filtered VIIRS (VJ1/VJ2) fires to Brazilian states, computed haversine distances to places with pop>=10000 using a grid join with an exact fallback for distant fires, and took per-state medians. All 27 rows matched the expected answer. ($0.020, 10 requests, 48 s)
- Right: Read DATA.md first and selected only the VIIRS satellites VJ1 and VJ2.
- Right: Checked that each fire fell in exactly one region (93791 rows, 93791 distinct fids).
- Right: Ran an efficient 5x5 grid-cell join, then fell back to an exhaustive search for fires with no town within 150 km or none found, so the nearest distances are exact.
- Right: Used DuckDB median, which averages the two middle values for even counts, and rounded to 1 decimal.
- Mistake: The town set excluded kinds S, H and Q, and the lat/lon bounding box limited it to the Americas. Nothing in the transcript shows the reason for the kind exclusion, but the result matched the expected answer.
- Mistake: The bounding box was an unverified assumption, since the question allows settlements in any country. It was harmless here because the max distance was about 387 km.

### exposed

**Tool calling: passed.** The agent read DATA.md, filtered catalogue A to real events with a magnitude and selected settlements with population of 500,000 or more. It computed the 3D hypocentre distance with a haversine-based formula, compared it with the magnitude-dependent radius, and returned 23 place ids that match the expected set. ($0.011, 7 requests, 18 s)
- Right: Read DATA.md first and applied conventions from it: filtered k='T', converted m from hundredths (m/100.0) and z from metres (z/1000.0, apparently depth as negative elevation).
- Right: Excluded non-settlement place kinds (S, H, Q) when building the settlements table.
- Right: Used the true hypocentre distance (chord formula combining depth and surface separation) rather than epicentral distance alone.
- Right: Checked afterwards that the max radius (~501 km at M6.8) fits inside the 10-degree latitude prefilter, so no matches were cut off.
- Mistake: Minor: the second-to-last run_sql call ran two statements and returned only the last result, so the max_m check had to be repeated. This was a wasted call, not an error.
- Mistake: The latitude prefilter was chosen before confirming the maximum radius. It happened to be safe, but this was confirmed only after the fact.

### b_gof

**Tool calling: passed.** The agent read DATA.md, located Anchorage, Alaska, in places.psv, and loaded catalogue A tectonic local-magnitude events within 300 km by haversine distance (1613 events). It then ran the goodness-of-fit Mc search in a single SQL query and found Mc=2.0 with b=1.152, which matches the expected answer. ($0.011, 7 requests, 17 s)
- Right: Picked the Alaska Anchorage (61.21806, -149.90028) and ignored the Kentucky one.
- Right: Applied the event-class filter k='T' and the local-magnitude code mk=1 as DATA.md specifies.
- Right: Read magnitudes as integer tenths, so floor(m/10.0+0.5) gives halves-up rounding with no floating-point problems.
- Right: Built the full candidate loop in one query, using LEFT JOIN/coalesce so empty magnitude bins count as observed zero.
- Right: Answered efficiently, with few calls.
- Mistake: It never printed the R values for candidates below 2.0, so the output does not show the earlier candidates failing; only rows with R>=85 were listed. The ORDER BY c over those rows still gives the correct lowest candidate.
- Mistake: It assumed m was stored in tenths of a unit without quoting the DATA.md line that says so. The values -154 to 440 make this plausible, but the agent did not explicitly confirm it.

### world_clusters

**Tool calling: passed.** The agent kept only the VIIRS detections (VJ1/VJ2, 680,723 rows) and bucketed them on a 3D Cartesian 1 km grid plus 12-hour time bins. It built 1.87M haversine-checked edges, found connected components by iterative min-label propagation in SQL until no cross-label edges remained, and reported all 45 clusters of 300 or more detections with correct counts and FRP. The run passed. ($0.031, 17 requests, 75 s)
- Right: Read DATA.md and correctly restricted to VIIRS satellites (VJ1, VJ2), excluding the MODIS MA/MT rows.
- Right: Used 3D ECEF grid cells of about 1 km with neighbor offsets, so the spatial join is correct near the poles and the antimeridian; checked candidates with an exact haversine test at 1 km and abs(t diff) \<= 43200 s.
- Right: Converted frp_kw to MW by dividing by 1000 and rounded to one decimal as the task asked.
- Right: Ran label propagation until the number of edges joining different labels reached 0, confirming the components had converged.
- Right: All 45 cluster ids, counts and FRP totals match the expected answer.
- Mistake: Minor inefficiency: the label-propagation loop needed several manual rounds (edges with differing labels fell 156777 → 9036 → 85 → 0) where a recursive CTE or a loop could have done it in one step. The result was unaffected.

### cross_section

**Tool calling: passed.** The agent read DATA.md, loaded catalogue A, and filtered to class T events with a magnitude. It projected epicentres onto the great circle using 3D vector math in SQL, keeping 25 quakes within 150 km whose nearest point falls between the end points. It wrote a correct SVG and passed. ($0.025, 9 requests, 48 s)
- Right: Read DATA.md and applied the stated earthquake definition (k='T') along with the requirement that m is not null.
- Right: Computed the along-track position with atan2 on the tangent and start vectors and the cross-track distance with asin of the dot product with the normal. It bounded the along-track angle to [0, angle], which matches 'nearest point lies between the two end points'.
- Right: Converted depth correctly: -z/1000 gives km, scaled by 500/700. The resulting coordinates match the expected values.
- Right: Each circle has r=4 and a data-id, and no other element has one. The width and height attributes are set correctly.
- Mistake: One wasted call: the first CREATE VIEW used `by` as a column alias, which is a reserved word in DuckDB, and failed with a parser error. It worked after renaming the alias to b_y.
- Mistake: It did not check the units of depth z or cross-check the projection independently. The -z/1000 conversion turned out right, but this rested on DATA.md without a sanity check.

### pair_map_hypo

**Tool calling: passed.** The agent loaded both catalogues with filters for magnitude, area and the overlapping period, built a candidate pair table using 3-D hypocentre distance, and computed great-circle midpoints. It drew 67 pairs, 67 unmatched A and 24 unmatched B (M≥4.5) as circles with data-id on a clipped equirectangular 900×900 map, and reported 158 features, which passed. ($0.10, 19 requests, 3.0 min)
- Right: Read DATA.md first and handled the format quirks: A depth stored as negative metres, magnitude ×100, mixed local time offsets; B day-of-year plus seconds-of-day timestamps and N/S/E/W suffixes.
- Right: Handled the area crossing the 180° meridian with two longitude ranges, and shifted negative longitudes by +360 for x = (lon−160)×30 and y = (−10−lat)×30.
- Right: Used the 3-D chord distance between hypocentres, including depth, for the 50 km test, as the task's 'hypocentres' wording requires.
- Right: Computed the great-circle midpoint by vector averaging rather than averaging lat/lon.
- Right: Checked that the candidate set was already one-to-one (67 candidates, 67 distinct A ids, 67 distinct B ids), so greedy resolution could not change anything.
- Right: Gave data-id only to circles, used radius 3, and clipped and scaled the land outlines for context.
- Mistake: The agent never wrote the greedy one-to-one acceptance logic. It relied on the candidate set happening to be one-to-one, which was correct here but would have broken if any event had two candidates.
- Mistake: Circles were placed via a translate() on a parent <g> instead of cx/cy attributes. The grader accepted this, but it is a fragile way to state positions.
- Mistake: Wasted a call: a multi-statement run_sql returned only the last statement's result, so the unmatched-B count query had to be run again.
- Mistake: The end of the period (2026-11-25 15:36 UTC) was hardcoded without the transcript showing where it came from, presumably DATA.md. The B times were compared as naive timestamps, which only works because they are UTC.
