---
title: "Claude Opus 5.5 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/claude-opus-5.5/geo_analyst/
---

# Claude Opus 5.5 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/claude-opus-5.5/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/claude-opus-5.5.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | ------- |
| Tool calling | 100%  | 10 of 10     | $1.08 | 79       | 79         | 6.0 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 and 10 in code mode. In tool calling it used 79 requests for $1.08 in total. In code mode it used 55 requests for $0.76. The cases cover earthquake and fire catalogues with unusual encodings, spatial joins, clustering and SVG output. Reviewers found no errors that changed a result. The issues they noted are about robustness and efficiency.

#### Where it does well

- **Reads DATA.md first in every run** and decodes its conventions correctly:
  - magnitudes stored in hundredths or tenths
  - depth stored as negative metres (`-z/1000`)
  - event kind `k='T'`
  - place kinds S/H/Q excluded
  - catalogue B's year-day plus seconds-of-day timestamps with N/S/E/W signs
- **Gets the geometry right.** It uses:
  - 3D hypocentre chords (b_only_hypo, exposed, pair_map_hypo)
  - vector cross-track and along-track positions (cross_section)
  - unit-vector midpoints
  - antimeridian handling (pair_map_hypo)
- **Handles time correctly.** It converts local-offset times to UTC (deep_moment correctly excludes us7000tuku) and applies daylight saving per event (local_night).
- **Disambiguates names.** It picks Anchorage, Alaska over Kentucky (b_gof) and Mato Grosso over Mato Grosso do Sul.
- **Checks its own work.** It routinely checks for duplicate ids, re-runs queries with loosened thresholds to test boundaries (deep_moment), and runs a convergence check (world_clusters, "bad = 0").

#### Mistakes it makes

- **Hard-coded or heuristic bounds that happened to hold:**
  - b_only_hypo hand-picked the overlap window in both modes.
  - brazil_nn (tools) used a fixed ±4°/±5° search window.
  - local_night (code) used a 550 km fallback cutoff.
  - world_clusters used 0.03° longitude cells. The code-mode reviewer flagged these as too narrow above about 60° latitude, and the data reach 71°N.
- **Special-case shortcuts.** In pair_map_hypo (tools), the greedy one-to-one matching was never implemented in general form. It relied on the candidates already being unique.
- **Conventions not verified.** Several runs applied DATA.md codes (`k='T'`, `mk=3`, cls 'H', UTC day boundaries) without visibly confirming them. In mato_grosso (code), the checks ran after the main query.
- **Wasted calls on avoidable errors:**
  - a relative file path (brazil_nn, tools)
  - `__import__` and xml.sax failures (cross_section, code)
  - a timedelta type error (pair_map_hypo, code)
  - a first query capped at 200 rows (b_gof, code), which the model caught itself

#### Tool calling compared with code mode

Both modes passed every case. The difference is cost on iterative work:

| Case           | Tools               | Code mode          |
| -------------- | ------------------- | ------------------ |
| world_clusters | 24 requests, $0.288 | 7 requests, $0.111 |
| pair_map_hypo  | 9 requests, $0.284  | 7 requests, $0.131 |

In world_clusters, tool calling ran label propagation by hand across about 10 near-identical SQL calls. Code mode ran it as a single loop.

Across the other eight cases the two modes cost about the same: $0.506 for tools and $0.514 for code mode. Code mode was slightly more expensive on simple single-query tasks, for example exposed ($0.049 vs $0.038) and b_gof ($0.071 vs $0.055).

Code mode had more runtime errors from Python cells. Tool calling had the one path error.

Choose code mode for loops and multi-step computation. On simple lookups, tool calling is marginally cheaper.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md, filtered catalogue A to earthquakes (k='T') with magnitude type '3' (moment magnitude), m>=500 (hundredths), z\<-70000 m, and UTC dates 1–15 November. It got 7, which matches the expected answer. ($0.051, 5 requests, 10 s)
- Right: Read DATA.md before querying and applied its encodings: magnitude in hundredths, depth in negative metres, event kind code 'T', magnitude type code '3'.
- Right: Converted the local-offset timestamps to UTC with timestamptz before applying the date window. For example, us7000tuku is local 1 Nov but 31 Oct UTC and was correctly excluded.
- Right: Checked for duplicate ids with count(distinct id) and found none.
- Right: Ran a boundary check with slightly looser thresholds over a wider window to see the edge cases near the cutoffs.
- Mistake: No substantive errors. Because the DATA.md output was truncated in the transcript, it cannot be confirmed whether the agent checked for revision or superseded rows (rv). The sanity check showed rv=1 for all rows.

### mato_grosso

**Tool calling: passed.** The agent read DATA.md, loaded the Brazilian regions, found Mato Grosso (BRA-602) and counted cls='H' fires on 21 November 2026 UTC whose points fell inside its polygon. That gave 5, which matches the expected answer. ($0.043, 5 requests, 10 s)
- Right: It read DATA.md before querying.
- Right: It told Mato Grosso (BRA-602) apart from Mato Grosso do Sul.
- Right: It did a spatial point-in-polygon join with ST_Intersects and filtered on the H confidence class.
- Right: It checked for duplicate rows with count(distinct fid) and confirmed the confidence class values L/N/H.
- Mistake: The transcript does not show the agent checking DATA.md's convention on which timezone defines 'the day'. It used UTC day boundaries without verifying that, and it got the expected answer anyway.

### b_only_hypo

**Tool calling: passed.** The agent loaded both catalogues, parsed B's year-day/seconds-of-day times and hemisphere coordinates, and counted B events of magnitude 4.5 or more in the overlap window with no A event within 30 s and 50 km of 3D hypocentral distance. It got 36, which matches the expected answer. ($0.055, 5 requests, 14 s)
- Right: Read DATA.md before loading any data.
- Right: Parsed catalogue B's '%Y-%j' date plus seconds-of-day into a timestamp, and applied the N/S/E/W signs to the coordinates.
- Right: Converted A's depth `z` (negative metres) to positive km with `-z/1000.0`, so both catalogues used the same depth units.
- Right: Measured hypocentre distance as a 3D chord using Earth radius minus depth, not epicentral distance alone.
- Right: Restricted B to the overlap period, starting from catalogue A's first event on 26 Oct, and included A events of any class, as the question asked.
- Right: Ran sanity checks (counts, distinct ids, min/max of time, depth and magnitude) before the final query.
- Mistake: The overlap bounds were hand-picked from the observed min/max of A ('2026-10-26 16:00' to '2026-11-25 15:36') rather than taken from a documented convention. It worked here, but it is fragile.
- Mistake: B's columns 7 and 8 (e.g. 'B'/'L' and 'T') were never checked to see whether some rows needed filtering, such as non-earthquakes or reviewed status. The transcript shows no check that DATA.md conventions on these codes were applied.
- Mistake: A's magnitude column has odd ranges (-154 to 680, looking like it is scaled by 100) and was not examined. That was harmless only because A's magnitude was not used.

### local_night

**Tool calling: passed.** The agent loaded catalogue A and places, kept event-type 'T' quakes with m>=250 (magnitude stored in hundredths, per DATA.md), found the nearest settlement by haversine through a cross join, converted each quake to that settlement's time zone and counted local hours >=20 or \<6. It got 787, which matches the expected answer. ($0.062, 7 requests, 24 s)
- Right: Read DATA.md first and applied its conventions: event kind 'T', magnitude scaled by 100 (m>=250), and excluding place kinds S/H/Q from the settlements.
- Right: Checked that ids are unique (9566 rows, 9566 distinct ids) before counting.
- Right: Computed great-circle distance with the haversine formula and used arg_min to pick the nearest settlement's time zone.
- Right: Converted times with timezone(tz, ts), so DST is handled per event, and applied the half-open night window \[20:00, 06:00) correctly.
- Mistake: Minor: the query mixing distinct k, place kinds and timestamp lengths into one union returned a confusing result that was not used, a small wasted call.
- Mistake: The cross join of 1804 events by 162k places is brute force but worked fine.

### brazil_nn

**Tool calling: passed.** The agent loaded the Brazil regions, the places and the VIIRS fires (VJ1/VJ2) in DuckDB. It spatially joined the fires to the regions, computed the haversine distance from each fire to the nearest settlement of 10,000 or more within a bounding window, and returned the count and median distance for all 27 divisions. The answer matched the expected one. ($0.084, 9 requests, 30 s)
- Right: Read DATA.md first and used it to pick the VIIRS satellite codes VJ1/VJ2 and the place kinds to exclude (S, H, Q).
- Right: Put a lat/lon prefilter on the fire points before the ST_Intersects join to Brazil regions, which kept the join cheap. It then checked that the 93,791 fire ids were distinct and that all 27 regions were covered.
- Right: Did not limit settlements to Brazil, and used a generous bounding box so places in neighbouring countries were included, as the question asks ('in any country').
- Right: Checked that every fire got a nearest-settlement distance: the count in d equalled the fire count, and the maximum distance (387 km) was inside the search window.
- Right: Used DuckDB's median, which averages the two middle values when the count is even, matching the question's rule.
- Mistake: The distance search window (|dlat|\<4, |dlon|\<5) could in principle miss a nearer settlement just outside it, and a fire with no settlement in its window would drop out silently. The agent only partly guarded against this by checking that the row count matched; it did not confirm the window could never exclude the true nearest place.
- Mistake: One query failed on a relative path ('data/fires.parquet' instead of '/data/fires.parquet'), costing a wasted call.

### exposed

**Tool calling: passed.** The agent read DATA.md and then ran a single SQL query. The query took catalogue A events with k='T' and non-null magnitude, converting m/100 to magnitude and z to depth in km. It filtered places to pop>=500000, excluding some kinds, and computed straight-line 3D distance to the hypocentre. Its 23 ids match the expected set and the run passed. ($0.038, 3 requests, 9 s)
- Right: Read DATA.md before querying, which revealed the unit conventions (m/100, z in metres negative) and the filters to apply.
- Right: Used true hypocentre distance: a 3D chord built from the Earth radius and depth, not just surface distance.
- Right: Answered with one efficient query; the output matched the expected set exactly.
- Mistake: The transcript truncates DATA.md, so it does not show the source of the filters k='T' and kind not in ('S','H','Q'). They evidently matched the conventions, but they cannot be verified from what is visible.

### b_gof

**Tool calling: passed.** The agent read DATA.md, found Anchorage, Alaska (the A2 record at 61.21806,-149.90028 rather than the Kentucky one), and filtered catalogue A to local-magnitude events within 300 km by haversine. It rounded the magnitudes using integer tenths and ran the goodness-of-fit Mc search in one SQL query. The first candidate with R≥85 was Mc=2.0 (R=89.52), giving b=1.152, which matches the expected answer. ($0.055, 5 requests, 14 s)
- Right: Picked the correct Anchorage by checking the Alaska timezone and coordinates instead of taking the first match.
- Right: Handled half-up rounding with floor((m+5)/10) on what appear to be integer-tenths magnitudes, which avoids floating-point rounding errors.
- Right: Built the whole Mc search (N, mean, b, a, predicted counts per bin, R) in a single SQL query, which included empty bins such as r=38 and 40 as zero observed counts.
- Right: Correctly chose the lowest Mc with R≥85 (2.0, R=89.52) even though higher candidates also passed.
- Mistake: The filter (mk=1, k='T', magnitudes stored ×10) depends on DATA.md conventions that the truncated transcript only partly shows. The agent did not verify the units or codes with a sample query, but the result was correct.

### world_clusters

**Tool calling: passed.** The agent filtered fires.parquet to the VIIRS satellites (VJ1, VJ2; 680,723 rows). It built 1 km / 12 h link pairs with a grid-bucketed self-join and found connected components by iterating min-label propagation until no labels changed. It then reported 45 clusters of 300 or more detections with counts and FRP in MW. The answer matched the expected output. ($0.29, 24 requests, 2.4 min)
- Right: It took VIIRS to mean only the VJ1 and VJ2 satellites, which it confirmed by checking the sat values, and left out MODIS (MA, MT).
- Right: When the first self-join timed out, it switched to an equijoin on grid buckets: lat cells of 0.01°, lon cells of 0.03°, 12 h time bins, joined against ±1 neighbour cells. Checking max |lat| of 71.3 confirmed that 0.03° of longitude covers 1 km at that latitude.
- Right: It used exact haversine distance ≤ 1.0 km and |Δt| ≤ 43200 s, so links at exactly the 1 km and 12 h limits were included.
- Right: It ran label propagation with pointer jumping until the count of changed labels reached 0. It then confirmed that no link joined detections with different labels (bad = 0).
- Right: It converted frp_kw to MW by dividing by 1000 and rounded to one decimal place.
- Right: It looked at detections near the antimeridian (only 2, both already in the same cluster) to confirm that longitude wrap-around did not matter.
- Mistake: Running the propagation by hand took about 10 near-identical SQL calls. A recursive CTE or a single loop would have used fewer requests, but the result was not affected.
- Mistake: In the final call the 'bad' check and the cluster aggregation were issued together. The aggregation would only be valid if the check passed, which it did (bad = 0).

### cross_section

**Tool calling: passed.** The agent loaded catalogue A and computed the cross-track distance and along-track position for each event with vector great-circle maths in DuckDB. It filtered to events that have a magnitude, lie within 150 km of the circle and project between the end points, then wrote an SVG with 25 circles. All 25 ids and positions match the expected answer, and the run passed. ($0.12, 7 requests, 34 s)
- Right: Read DATA.md first, then built the whole computation in a few SQL calls.
- Right: Used a correct vector method: the cross-track distance is asin(p·n)·R, and the along-track position is an atan2 angle measured from the start point. The 'between the end points' condition was applied as `al between 0 and L`.
- Right: Got depth right by converting z, which is stored in metres as negative elevation, with -z/1000. The y scale of depth/700\*500 matches the expected coordinates.
- Right: The first grouped query showed that every match has class T, so no other event classes were silently included. A later check confirmed all 25 rows have a magnitude.
- Right: When string_agg output was truncated, it fetched the rows individually instead, so every circle made it into the file.
- Right: The SVG meets every constraint: width 1000 and height 500, circles of radius 4, data-id only on the circles, and the background rect has none.
- Mistake: The filter on magnitude (m) is placed only in the final query, not in the table r. This is minor and caused no error.
- Mistake: It did not check whether class 'k' should limit the set to earthquakes. Every match turned out to be T, so this did not matter here.

### pair_map_hypo

**Tool calling: passed.** The agent loaded both catalogues, normalised the units (depth in negative metres to km, magnitude×100, B's year-day plus seconds-of-day time format), filtered to the shared period and area, and computed candidate pairs using 3D hypocentre distance. It drew 158 features (67 pairs at great-circle midpoints, 67 unmatched A, 24 unmatched B M≥4.5) as an SVG, and the result matched the expected answer. ($0.28, 9 requests, 73 s)
- Right: Read DATA.md first and decoded the unusual formats correctly: A's z in negative metres, m as an integer ×100, timezone-offset timestamps, and B's 'YYYY-DDD' plus seconds-of-day with N/S/E/W suffixes.
- Right: Set the shared-period start from catalogue A's actual coverage (26 Oct 16:00 UTC) and applied it to both catalogues.
- Right: Handled the antimeridian area correctly with (lon>=160 or lon\<=-170) and by shifting negative longitudes +360 before projecting.
- Right: Computed hypocentre distance as a 3D chord using radius minus depth, consistent with 'hypocentres 50 km apart'.
- Right: Computed great-circle midpoints by summing unit vectors, the correct method.
- Right: Checked candidate uniqueness (67 candidates, 67 distinct A, 67 distinct B), which showed the greedy ordering was moot.
- Right: The SVG met the spec: 900×900, radius-4 circles, data-id only on the circles.
- Mistake: Minor: the greedy one-to-one acceptance was not implemented in general form. It relied on the observation that candidates were already unique, which happened to hold here.
- Mistake: Minor: the A filter used k='T', which the agent justified with 'earthquakes'. It verified this changed nothing, so there was no impact.
