---
title: "Kimi K3.1 Pro 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/kimi-k3.1-pro/geo_analyst/
---

# Kimi K3.1 Pro 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/kimi-k3.1-pro/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/kimi-k3.1-pro.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 100%  | 10 of 10     | $1.31 | 125      | 149        | 19.6 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. Totals were close. Tool calling used 125 requests for $1.31, and code mode used 99 requests for $1.31. Cases ranged from a single filtered count (`deep_moment`: 3–4 requests, about $0.02–0.03) to connected components over 680,723 fire detections (`world_clusters`: about $0.37 in either mode).

#### Where it does well

- **Reads the data docs and applies them.** In every run it read DATA.md first. It decoded the scaled magnitudes, the negative-metre depths, `k='T'`, `mk` codes, VIIRS = VJ1/VJ2, and the excluded place kinds S/H/Q.
- **Disambiguates entities.** It chose Anchorage, Alaska over Kentucky in `b_gof`, and Mato Grosso (BRA-602) over Mato Grosso do Sul in `mato_grosso`.
- **Handles geometry correctly.** It crossed the antimeridian in `cross_section` and `pair_map_hypo` and repaired the invalid Goiás polygon with ST_MakeValid in `brazil_nn`. It used 3D hypocentral distance and exact nearest-neighbour searches with guard radii.
- **Self-checks.** It caught an implausible b≈0.74 caused by an ln(10)/log10(e) mix-up and fixed it (`b_gof`, tools). It also ran brute-force samples (100 points, 0 mismatches), distinct-id counts, boundary probes, and independent SQL/Python recomputations.

#### Mistakes it makes

None of these changed an answer, but several are risky:

- **Doesn't finish reading DATA.md.** In `deep_moment` and `mato_grosso`, DATA.md was truncated in both modes and the model never read the rest. Conventions such as the UTC-day boundary went unconfirmed, and all 5 `mato_grosso` fires fell on 20 Nov local time.
- **Hard-codes values.** It hand-set coverage windows (16:00–15:36 UTC) in `b_only_hypo` and `pair_map_hypo`.
- **Skips logic, leaves checks broken.** In `pair_map_hypo` (tools) the "greedy" matching was just row_number. It was correct only because the candidates were already one-to-one. In `b_only_hypo` (tools) it submitted with its sensitivity queries still failing on parser errors.
- **Wastes calls on routine slips.** These included a reserved-word alias, ambiguous columns, nonexistent functions (`try_timezone`, `geometry_type`) and lost multi-statement results. In `world_clusters` (tools) it made about 25 unbatched propagation calls.

#### Tool calling compared with code mode

- **Requests and cost.** Code mode needed fewer requests mainly on `world_clusters`: 18 versus 41. On the other nine cases the counts were similar (81 vs 84). Cost depended on the case:
  - Code mode was cheaper on `pair_map_hypo` ($0.159 vs $0.265).
  - Code mode was dearer on `b_gof` ($0.120 vs $0.075) and `local_night` ($0.135 vs $0.085), partly from redundant re-verification.
- **Verification.** Code mode checked outputs more thoroughly. It verified the written SVGs and implemented real greedy matching. With tools, the model tried to verify the SVGs with `read_text`, which reads only /data, so the files were never checked.
- **Sandbox failures.** Code mode hit its own problems:
  - In `b_gof`, loading places.psv exceeded memory and reset the session.
  - The sandbox rejected `del` and the `encoding` argument to `write_text`.
  - One message misstated 44 clusters before it answered 45.

## Runs

### deep_moment

**Tool calling: passed.** The agent read DATA.md and loaded catalogue A from quakes_a.jsonl. It ran one filtered count (1–15 Nov UTC, k='T', mk=3 for moment magnitude, m>=500, z\<-70000 m) and returned 7, which matches the expected answer. ($0.023, 4 requests, 17 s)
- Right: Read DATA.md before querying and used its codes: magnitude stored as hundredths (m>=500), depth as negative metres (z\<-70000), mk=3 for moment magnitude, k='T' for earthquakes.
- Right: Used a half-open UTC window up to 2026-11-16, so the whole of 15 November was included.
- Right: Checked for duplicate rows with COUNT(DISTINCT id) alongside COUNT(\*); both were 7.
- Right: Took few steps: one sample query, then the answer query.
- Mistake: The agent never checked how revisions (the rv field) are handled, for example whether duplicate rows exist across revisions or what other values k takes. The distinct-id check partly covers the duplicate case. The answer was correct, but the DATA.md read was truncated, so these conventions were not confirmed in the transcript.

### mato_grosso

**Tool calling: passed.** The agent read DATA.md, found the Mato Grosso polygon (BRA-602, kept separate from Mato Grosso do Sul), and filtered fires to cls='H' on 21 Nov 2026 UTC with a point-in-polygon test. It got 5 detections and answered {"count": 5}, which matches the expected answer. ($0.048, 5 requests, 23 s)
- Right: Read /data/DATA.md before writing any queries.
- Right: Picked rid BRA-602 'Mato Grosso' specifically and did not lump in 'Mato Grosso do Sul' (BRA-600).
- Right: Checked the fires schema and the time range before filtering.
- Right: Used ST_Intersects with ST_Point(lon, lat), with the coordinates in the correct order.
- Right: Re-listed the 5 matching rows to confirm they were distinct and looked plausible.
- Mistake: DATA.md was truncated (about 11k characters not shown) and the agent never read the rest. It therefore used cls='H' and a UTC calendar day without checking the documented conventions for confidence codes, day boundaries or duplicate detections across satellites. The answer matched, but the run partly relied on luck.

### b_only_hypo

**Tool calling: passed.** The agent parsed both catalogues, using offset-aware timestamps for A and day-of-year plus seconds for B. It limited B events with magnitude 4.5 or more to A's coverage window (442 candidates), matched them to A events within 30 s and a 3D hypocentral distance of 50 km, and reported 36. This was correct. ($0.083, 8 requests, 55 s)
- Right: Read DATA.md before writing any queries.
- Right: Parsed A's ISO times with their local offsets and B's 'YYYY-DDD' date plus seconds-of-day into comparable epoch values.
- Right: Took the overlap period from the actual first and last A origin times (from 26 Oct 16:02 UTC) instead of calendar dates alone.
- Right: Computed true hypocentral (3D) distance including depth, and checked it with a second formula (chord vs law of cosines); both gave 36.
- Right: Matched against A events of any class without filtering on event type, as the question asked.
- Mistake: Two boundary-sensitivity queries (inclusive vs strict limits) failed with parser errors from unbalanced parentheses. The agent submitted without fixing them, so it never checked how sensitive the answer was to the 30 s and 50 km limits.
- Mistake: The window bounds were hardcoded and rounded (16:00 to 15:36 UTC) rather than set to the exact min/max of A. This was harmless here but somewhat fragile.

### local_night

**Tool calling: passed.** The agent filtered catalogue A to earthquakes (k='T') with m>=250, which is magnitude ≥2.5 in hundredths, giving 1804 events. It found each event's nearest settlement (excluding kinds S, H, Q) by 3D chord distance, converted the UTC time to that settlement's time zone, and counted 787 events in the 20:00–06:00 window. This matches the expected answer. ($0.085, 9 requests, 56 s)
- Right: Read DATA.md first and applied its conventions: magnitude stored in hundredths (m>=250), event-type filter k='T', and settlement kinds excluded (S, H, Q).
- Right: Used exact nearest-neighbour search via unit-sphere chord distance with arg_min over a full cross join, so no approximation error.
- Right: Converted the offset-aware timestamps to the IANA zone with timezone(p.tz, c.t), which handles DST correctly.
- Right: Checked boundary cases near 06:00 (events at 05:59 vs 06:01), confirmed no null local times, and checked the hourly distribution sums consistently (787 + 1017 = 1804).
- Mistake: Minor: one validation query called a non-existent function, try_timezone, and errored. It was harmless and covered by a later null check.
- Mistake: The k breakdown shows 3 non-T events (Q and X) with m>=250 that were excluded. This was presumably correct per DATA.md, but the agent never stated why.

### brazil_nn

**Tool calling: passed.** The agent loaded the fires, places and regions tables. It filtered to VIIRS (VJ1/VJ2) detections and settlements with pop>=10000 that excluded kinds S/H/Q, and joined fires to the made-valid Brazil state geometries. It then computed nearest-settlement haversine distances with a grid search plus a guard-radius check. The 27 rows it returned match the expected counts and medians. ($0.17, 13 requests, 1.9 min)
- Right: Read DATA.md first and applied conventions from it: VIIRS = VJ1/VJ2, and kinds S/H/Q excluded from settlements.
- Right: Noticed Goiás had an invalid geometry (ST_IsValid false) and wrapped all geometries in ST_MakeValid before the point-in-polygon join.
- Right: Checked for duplicate fids and for fires matched to more than one region; found none.
- Right: Grid-based nearest search with a guard distance ensured correctness; it widened the search to 5° for the 1,304 points left unresolved at 1°.
- Right: Checked 100 sampled points against a brute-force search: zero mismatches.
- Right: DuckDB median() averages the two middle values for even counts, which matches the requested rule.
- Mistake: The first nearest-distance query threw a BinderException because the final SELECT used count(d) where the column was nearest_km. A follow-up call fixed it, costing one extra call.
- Mistake: The answer query also ran an unrelated null-check SELECT, so only the null-check result came back and another call was needed to view the answer table.

### exposed

**Tool calling: passed.** The agent read DATA.md, loaded catalogue A and the places file, and filtered to settlements with population of at least 500,000 (excluding kinds S/H/Q). It cross-joined these with tectonic events, computed hypocentral distance from depth and the haversine formula, and returned the 23 distinct place ids. These match the expected set. ($0.062, 7 requests, 36 s)
- Right: Read DATA.md before querying and applied its unit conventions: magnitude stored ×100 and depth z in negative metres, converted to km.
- Right: Computed true hypocentral distance (a 3D chord with depth correction) rather than epicentral distance.
- Right: Excluded non-settlement place kinds (S, H, Q) and non-tectonic events (k='T'), following the data conventions.
- Right: Returned distinct place ids, de-duplicating places matched by several events.
- Mistake: Minor inefficiency: the first stats query returned only the second statement's result, so the counts for nulls and positive z were never seen. Similarly, in the final query the count statement's output was lost and only the id list came back. This caused no harm.

### b_gof

**Tool calling: passed.** The agent filtered catalogue A to local-magnitude events (mk=1, k='T') within 300 km of Anchorage, Alaska, by haversine distance and rounded the magnitudes half up in tenths. It ran the goodness-of-fit Mc search in SQL, found Mc=2.0 with N=616 and R≈89.5, and returned b=1.152, which is correct. ($0.074, 8 requests, 36 s)
- Right: Read DATA.md first and used its encoding: magnitudes stored in tenths, the mk code for local magnitude and the k='T' event filter.
- Right: Picked the Anchorage, AK record (tz America/Anchorage, pop 289600) over the Kentucky Anchorage.
- Right: Rounded half up with integer arithmetic, floor(m/10+0.5), which avoids floating-point rounding problems.
- Right: Saw that the first fit run gave an implausible b of about 0.74 and an Mc of 4.4. It traced this to using ln(10)/ln(e) instead of log10(e) and reran with the fix.
- Right: Rechecked the result at Mc=2.0 with a closed-form prediction: R≈89.5, and the predicted total of about 615 roughly matched the 616 observed.
- Mistake: In the first fit query it wrote ln(10.0)/ln(exp(1.0)), which is ln(10), not log10(e). This cost one extra query before it was corrected.

### world_clusters

**Tool calling: passed.** The agent filtered the fire data to VIIRS detections (VJ1/VJ2, 680,723 rows) and built a grid-bucketed haversine self-join with links at ≤1000 m and ≤43200 s, giving 1,874,135 edges. It ran iterative min-label propagation with pointer jumping in DuckDB until nothing changed, then checked for zero cross-component edges. It reported 45 clusters of 300+ detections, converting FRP from kW to MW, and all of them matched the expected answer. ($0.38, 41 requests, 8.3 min)
- Right: Selected VIIRS as sat IN ('VJ1','VJ2') and used every detection, without filtering by confidence class.
- Right: Converted frp_kw to MW by dividing by 1000 before rounding.
- Right: Used a 0.01-degree grid with ±1 lat / ±3 lon neighbour cells and longitude wraparound, then an exact haversine ≤1000 m check, so no candidate pairs were missed at these latitudes.
- Right: Ran connected components as iterative min-label propagation and added 8-hop pointer jumping to speed it up once progress slowed.
- Right: Confirmed convergence: changed=0, cross_component_edges=0 and nonminimum_labels=0 before answering.
- Mistake: The first label-propagation step failed with an ambiguous 'label' column error, and an early count over a cross join timed out after 30 s; both were minor slips that cost extra calls.
- Mistake: The agent issued about 25 near-identical propagation calls one at a time; batching several iterations into each call would have been much more efficient.
- Mistake: Whether ±3 longitude cells (about 1.1 km at 71° latitude) covers 1 km at the northernmost detections was never checked explicitly, though it was sufficient here.

### cross_section

**Tool calling: passed.** The agent read DATA.md, loaded catalogue A and computed cross-track and along-track distances with vector great-circle maths in DuckDB. It filtered to k='T' events with a magnitude, within 150 km and projecting between the endpoints, then wrote an SVG with 25 circles whose coordinates match the expected answer exactly. The run passed. ($0.12, 13 requests, 2.2 min)
- Right: Read DATA.md first and applied the depth convention (z in metres, negative down) to get depth_km = -z/1000.
- Right: Projected points onto the great circle correctly using the normal vector, then used atan2 along-angle limits (0 to sab) for the between-endpoints test.
- Right: Handled the dateline crossing (178°E to 174°W) naturally through 3D vectors.
- Right: Checked whether any non-'T' or magnitude-less events fell near the corridor (none did), so the filter choice was safe.
- Right: The SVG met every spec: width/height 1000x500, radius 4, data-id only on the circles, coordinates to 3 decimals.
- Mistake: Hit two avoidable SQL errors: using 'by' as an alias (a reserved word), and leaving sab out of the view's select list.
- Mistake: The final read_text verification of /out/map.svg failed because that tool only reads /data. The agent did not verify the written file another way, though nothing was wrong with it.

### pair_map_hypo

**Tool calling: passed.** The agent loaded both catalogues and filtered them to the area, the overlap period and the magnitude thresholds (134 A, 95 B events). It found 67 candidate pairs with a fully one-to-one structure, computed great-circle midpoints, projected to 900x900 and wrote an SVG with 158 circles. The run passed. ($0.26, 17 requests, 3.4 min)
- Right: Read DATA.md first. Correctly decoded catalogue A units (m/100, z in negative metres) and catalogue B's day-of-year plus seconds time format and hemisphere suffixes.
- Right: Restricted both catalogues to the overlap period (A's coverage from 26 Oct) and kept only k='T' tectonic events in A.
- Right: Measured hypocentral distance as a 3D chord using depths, and handled the 180° crossing by shifting longitudes (lon+360 for negative values).
- Right: Computed midpoints with the proper vector great-circle formula, not by averaging lat/lon.
- Right: Checked that the 67 candidates had 67 distinct A and 67 distinct B ids, so greedy acceptance was trivially the full candidate set.
- Right: Checked that all 158 features fell within the image bounds and had distinct ids.
- Mistake: The 'accepted' table was just row_number over all candidates, with no greedy one-to-one logic. This was only correct because the candidates happened to be one-to-one already (verified via distinct counts). It is fragile, though justified by that check.
- Mistake: The time filter used a hard-coded upper bound of 15:36 taken from A's max time, not a principled end of coverage; it worked here.
- Mistake: Tried to verify the written file with read_text, which only reads /data, so it was never actually checked (minor wasted calls).
- Mistake: The first run_sql used SET TimeZone and errored, costing one call.
