---
title: "GPT-6.1 Terra on Pydantic AI Transit Planner"
description: "Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 80%, code mode 90%; rank 15 of 32."
canonical: https://models.pydantic.dev/models/gpt-6.1-terra/transit_planner/
---

# GPT-6.1 Terra on Pydantic AI Transit Planner

> Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 80%, code mode 90%; rank 15 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/gpt-6.1-terra/transit_planner/. 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>`
- Any other question about the models: `GET https://models.pydantic.dev/api/ask?query=<question>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of all but the single model. An `OPTIONS` request to any endpoint returns its schema. The same five 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/transit_planner.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 | 80%   | 8 of 10      | $0.58 | 252      | 256        | 20.6 min |
| Code mode    | 90%   | 9 of 10      | $0.52 | 169      | 169        | 16.4 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

17 of 20 runs passed: 8/10 with tool calling, 9/10 in code mode. All three failures are the two round-trip cases (`tour` in both modes, `timed_tour` in tool mode). No provider errors. Total cost was about $0.58 for tools and $0.52 for code mode. I read the three failures in full and the opening and middle of each passing conversation, not every final step.

#### Where it does well

- Point-to-point routing is reliable: all 16 runs of the eight non-tour cases passed, including previous-service-day (`after_midnight`), arrive-by, Pareto profile and meeting-point questions.
- It gets the data rules right in SQL: distance-based interpolation of untimed calls, `<run>+<k>` repeat names, `Y` access letters, the 400 m walk and the 120 s margin.
- It checks convergence before answering (empty `frontier`, `underbound` 0, STEP 5 adding only a few labels).

#### Mistakes it makes

- **Walk-in visits (3 failures).** Its tour search lets a passenger alight elsewhere, walk into a target station, wait, and board there, reporting the departure as the vehicle time. `timed_tour` tools did this at Technische Universität (alight `P5583032a`, 248 m walk) and failed with arrival 44160. Code mode reached the same 44160 by alighting at a station platform and passed. Both `tour` runs walk 343 m into Marienberger Straße; charging that walk to the departure leaves an 814 s stay. The grader's reason is not recorded, so this is the best-supported explanation, not a confirmed one.
- **Unquoted `at`.** At least 13 of 20 runs hit `syntax error at or near "IS"` (or `")"`/`"::"`) from the reserved column name, each costing one or two requests. `offset` as an alias failed twice more.
- **Multi-statement `run_sql`.** Only the last result comes back; nearly every tool run re-queried `services` or a `max(...)` it had already asked for.
- **Inconsistent `departure`.** The field is sometimes the start time (29400, 27600), sometimes the boarding time (27669). Both passed.
- Two tool runs skip `service_changes`; harmless on these dates.

#### Tool calling compared with code mode

Code mode used 169 requests against 252 and was cheaper in 6 of 10 cases. The gap is largest on searches: tool mode re-sent one relaxation statement 13 times for `timed_tour`, while code mode looped in Python. Code mode also repaired the `at` error with `re.sub`. Its weakness is exporting data through 200-row pages (344 `run_sql` calls in `timed_tour`) and noisy prints. Neither mode fixed the walk-in visit rule; code mode's extra pass on `timed_tour` came from which path its search kept, not from different logic.

## Runs

### one_vehicle

**Tool calling: passed.** Found the 72 runs that call near both stations (`candidate_runs`), interpolated only those and returned a 399 m walk to `P0091960a` (Strehlener Platz) then `R27f8d4b1+2` 29940→30480. Passed in 16 requests. ($0.034, 16 requests, 65 s)
- Right: Considered boarding platforms within 400 m of the origin (`starts`), not only the station's own platforms, which is what produced the answer.
- Right: Restricted interpolation to candidate runs instead of all 163,359 calls.
- Mistake: Unquoted `at` parser error in the `ct` table, resent with `"at"`.
- Mistake: `DESCRIBE calls; SELECT * FROM services; SELECT * FROM changes;` returned only the last result; `SELECT * FROM services;` was run again.
- Mistake: `departure` is given as 29400 (the 08:10 start) although the vehicle is boarded at 29940 after a 399 s walk.

**Code mode: passed.** Selected the 72 `relevant` runs touching platforms near both stations, interpolated them and returned the same walk-plus-bus answer (`R27f8d4b1+2` 29940→30480). Passed in 13 requests. ($0.035, 13 requests, 62 s)
- Right: Interpolated with joins on `prevn`/`nextn` rather than `IGNORE NULLS` windows, a second working formulation.
- Right: Included both `2026-336` and `2026-335` service days in `dayinfo`.
- Mistake: Unquoted `at` parser error in `cc2`, followed by a `SHOW TABLES` call to see what had been created.
- Mistake: `departure` 29400 again reports the start time rather than 29940 minus the 399 s walk.

### saturday_direct

**Tool calling: passed.** Built `basecalls`, expanded repeats into `tc`, ran round tables `r0`/`r1` and returned the direct tram `Rb28d92d7` from `P7fa04a55` at 33484 to `P1093f876` at 34560. Passed in 20 requests. ($0.040, 20 requests, 76 s)
- Right: Used two parallel `run_sql` calls in one turn to inspect services and sample rows.
- Right: Renamed `at` to `ar` in the retry, avoiding further quoting problems.
- Mistake: Unquoted `at` parser error on the first `basecalls` attempt.
- Mistake: `basecalls` filters on `first`/`last`/`days & 32` only and never consults `service_changes`; no change rows apply to `2026-339`, so it did not matter.
- Mistake: Re-ran `SELECT * FROM services;` because the multi-statement call hid it.

**Code mode: passed.** Built `eligible`, `interp`, `events` and round table `r1`, returning the same direct tram `Rb28d92d7` 33484→34560. Passed in 14 requests. ($0.041, 14 requests, 73 s)
- Right: Recovered the failed batch by slicing the stored query string (`q[:q.index('CREATE TABLE interp')]`) rather than rewriting it.
- Right: Carried a `shift` column so runs of two service days stay distinct (`a.shift=b.shift` in the join).
- Mistake: Unquoted `at` parser error on the first `interp` build.
- Mistake: The repair attempt was itself a Python `SyntaxError` (bad quote escaping in chained `.replace(...)`), costing another request.
- Mistake: Then found `eligible` did not exist because the failed multi-statement call had created nothing, and rebuilt it.

### one_change

**Tool calling: passed.** Built `firsts` and second-leg tables limited to two vehicles and returned `Rafeef850` 27669→27960, a walk to `P3b6efaff`, then `R620ec7d9` 28200→28440. Passed in 15 requests, the fewest of the tool runs. ($0.037, 15 requests, 67 s)
- Right: Included the previous service day (`2026-336`, shift -86400) alongside `2026-337`.
- Right: Kept the search narrow (`BETWEEN 27000 AND 35000`) so each query was small.
- Mistake: First load failed on `at::INT AS at` (`syntax error at or near "::"`); fixed by quoting and renaming to `atime`.
- Mistake: Second failure on the alias `offset` (reserved word); renamed to `shift`.
- Mistake: Reported `departure` 27669 (the boarding time), whereas the code-mode run of the same case reported 27600 (the start time); both passed, so the field is filled inconsistently.

**Code mode: passed.** Built `active_runs`, `base_timed`, `expanded`, `origin`, `dest` and `first_legs` (1,195 rows), then the second leg, returning the same two vehicles as tool mode arriving 28440. Passed in 12 requests, the fewest of all runs. ($0.036, 12 requests, 64 s)
- Right: Quoted `"at"` from the start in the interpolation, so no parser retry was needed in the part read.
- Right: Checked the direct options first (best direct arrival 29160) before accepting the one-change answer at 28440.
- Mistake: Did not include the previous service day, after reasoning that `max(at)` 104880 could not reach 07:40; correct here but argued loosely.

### walking_change

**Tool calling: passed.** Built round tables `r1` (no result at the destination) and `r2`, and returned `R76d2117b+4` 61560→62040, a walk from `P6e794064` to `P72ccec8b`, then `R3a0dccd4+54` 62520→63480. Passed in 25 requests. ($0.047, 25 requests, 1.7 min)
- Right: Recognised from the empty `r1` result that no direct vehicle exists and added a second round with the `+120+w.d` margin.
- Right: Built the `walks` table with a 400 m box prefilter before the exact distance test.
- Mistake: `SELECT max(at) ...` failed on the unquoted keyword and was re-sent as `max("at")`.
- Mistake: A four-statement call (`SELECT * FROM services; SELECT * FROM changes; DESCRIBE calls; ...`) showed only the last result; services was queried again.

**Code mode: passed.** Not reviewed. ($0.048, 16 requests, 1.5 min)

### after_midnight

**Tool calling: passed.** Loaded all files with `run_sql`, interpolated untimed calls, expanded repeats for both service days (`2026-338` shifted by -86400 and `2026-339`) and returned `R93fefd15` 5280→5492, a walk to `P983fcb99`, then `R900bf42f+2` 5700→6420. Passed in 24 requests. ($0.053, 24 requests, 1.8 min)
- Right: Handled the previous service day explicitly with a `days` CTE carrying a `-86400` shift, which is the point of this case.
- Right: Applied the `+`/`-` rows of `service_changes` with `EXISTS`/`NOT EXISTS`.
- Mistake: First interpolation query used the unquoted column `at` (`CASE WHEN at IS NOT NULL`) and got `Parser Error: syntax error at or near "IS"`; it had to resend the whole statement with `"at"`.
- Mistake: Sent `SELECT * FROM services; SELECT * FROM changes; SELECT * FROM repeats LIMIT 3;` in one call, only got the last result back, then spent two more calls re-running `SELECT * FROM services;` and `SELECT * FROM changes;`.

**Code mode: passed.** Same data preparation as the tool run but inside `run_code`, with both service days in an `active` table carrying an `off` shift; returned the identical journey arriving 6420. Passed in 16 requests. ($0.042, 16 requests, 87 s)
- Right: Fixed the unquoted `at` error programmatically with `re.sub(r'\bat\b', '"at"', q)` instead of retyping the query.
- Right: Checked that run names do not collide across the two service days (`GROUP BY 1,2 HAVING k>1` returned 0).
- Mistake: Unquoted `at` parser error on the first big statement; then a probe `SELECT count(*) FROM active` to learn the whole batch had not been applied.

### arrive_by

**Tool calling: passed.** Built timed calls for day `2026-344`, listed the latest departures from platforms within 400 m of Pohlandplatz and returned `R1aabe4da+29` 63360→63900 then `Rfd6f9e2d+67` 64260→64440, leaving at 63360. Passed in 27 requests. ($0.056, 27 requests, 1.8 min)
- Right: Framed it as a backward search from the 18:00 deadline (`BETWEEN 59000 AND 64800`) and ranked candidates by `dep - walk` descending.
- Right: Checked with `SHOW TABLES` which tables survived a failed multi-statement call before re-running it.
- Mistake: Same unquoted `at` parser error in the `calc` table; the full five-table statement was resent.
- Mistake: `SELECT * FROM services; SELECT * FROM changes;` returned only the changes rows, so `SELECT * FROM services;` was run again.

**Code mode: passed.** Built `timed_calls`, `active_runs` for days `2026-344` and `2026-343`, an `edges` table (264,400 rows) and backward `labels` seeded at `64800 - walk`; returned the same journey leaving at 63360. Passed in 15 requests against 27 in tool mode. ($0.043, 15 requests, 74 s)
- Right: Seeded the backward search directly from the deadline with `max(64800-w.d)` per platform.
- Right: Included the previous service day, which the tool-mode run of this case did not.
- Mistake: Unquoted `at` parser error, then a second failure on the column alias `offset` in `AS day(day,bit,offset)`; renamed to `off`.

### departure_profile

**Tool calling: passed.** Built a `rides` table (706,171 rows) and a backward `label`/`newer` table keeping only non-dominated (departure, arrival) pairs per boarding platform, then listed the journeys leaving Marienberger Straße between 25200 and 28800. Passed in 30 requests. ($0.074, 30 requests, 3.4 min)
- Right: Dominance filter done in SQL with `min(arrival) OVER (PARTITION BY board ORDER BY dep DESC ...)`, matching the question's definition.
- Right: Used `originwalk` so the departure is the first vehicle minus the walk, as the question asks.
- Mistake: The `base` table filters services only on `first`/`last`/`days` and ignores `service_changes`; harmless here because the only change rows are for days `2026-325` and `2026-326`.
- Mistake: Highest request count among the non-tour tool cases (30) and third-highest cost ($0.0742).

**Code mode: passed.** Listed first-vehicle departures near Marienberger Straße and built the non-dominated journey list; passed in 19 requests. Its fourth journey differs from the tool run (alight `Pd6ad09b1` 27360, board 27714) with the same 26220→28428 times. ($0.075, 19 requests, 2.3 min)
- Right: Same departure and arrival times as the tool run for the journeys visible in the output (25327→27420, 25620→27828, 25927→28020, 26220→28428, 26527→28663).
- Right: 11 fewer requests than tool mode (19 against 30).
- Mistake: Printed a table of well over 100 candidate boarding rows (run, platform, time, name) into the conversation, which inflated cost to $0.0746, slightly above the tool run.

### meeting_point

**Tool calling: passed.** Computed per-friend earliest arrivals in staged tables `stage0`, `stage1`, `stage2`, joined them per station in `arrivals2` and chose Albertplatz `Sbb9212fa` at 33701 with one direct vehicle each. Passed in 26 requests. ($0.055, 26 requests, 1.9 min)
- Right: Ranked stations by `greatest(a.arr, b.arr)` and included a final walk to any platform of the station.
- Right: Applied the 120 s margin only from the second vehicle on (`s.arr+120+w.sec` in `stage2`, not in `stage1`).
- Mistake: Prefixed three consecutive calls with `SELECT max(c."at"+...) ma ...;` followed by a `CREATE TABLE`; the tool only returns the last statement, so the value (104880) was seen only on the third try.
- Mistake: An earlier call did the same with `SELECT max("at"), count(*) FILTER (...) FROM calls; SELECT count(*) ...` and had to be split.

**Code mode: passed.** Kept the per-person search in SQL (`best`, a `step` query and a `meet` query) and drove it from a Python loop of five rounds; chose Albertplatz `Sbb9212fa` at 33701. Passed in 14 requests against 26 in tool mode. ($0.051, 14 requests, 86 s)
- Right: Ran rounds until they stopped changing the top result (STEP 5 added only 24 and 6 labels) instead of stopping at two vehicles.
- Right: First friend's journey includes the walk from `P6239000d` to `P3035f403` with `departure` 32400.
- Mistake: The loop printed the full five-row `meet` result after every round, so the same Albertplatz rows were emitted six times.

### timed_tour

**Tool calling: failed.** Ran a hand-iterated label-correcting search in SQL over (platform, visited mask) and returned a round trip back at 44160, the same arrival as the passing code-mode run. It failed; the answer differs from the passing one in how Technische Universität is visited. ($0.093, 34 requests, 3.1 min)
- Right: Encoded opening windows in a `targets` table (`opening`, `closing`) and waited with `greatest(f.actual+w.d, t.opening)+900`.
- Right: Iterated the frontier until it was empty (`frontier` 0, `best` 15495) before reading the answer.
- Right: Got the same final arrival, 44160, as the passing code-mode answer.
- Mistake: Leg 2 rides `Rf679205e+8` to `P5583032a` (Mommsenstraße, 37140), walks 248 m into Technische Universität and counts the visit from 37388, then boards at `P1b70f91f` at 38312 and reports visit departure 38312. The question says a visit's departure is the next vehicle's departure minus the walk; the search's walk-in `V` action spends the one allowed walk before the stay. The passing code-mode answer stays on the same run to `P6e8c05a2` (a TU platform) at 37080 and leaves at 38244. The grader's reason is not recorded, but this is the only visit that differs.
- Mistake: It should have required a visit to start by alighting at a platform of the station, or checked the stay as `board_time - walk - arrival >= 900` using the alight-to-board walk.
- Mistake: Repeated the same ~600-character relaxation statement in 13 separate `run_sql` calls instead of one recursive query, giving 34 requests and $0.0927.
- Mistake: Unquoted `at` error on the first interpolation, and a path query that put `unnest` before `LIMIT 1` and returned an empty row.

**Code mode: passed.** Pulled 68,622 expanded calls out of DuckDB in 200-row pages and ran an event-scan search over (platform, mask) in Python; returned a tour back at 44160 that alights at a Technische Universität platform. Passed in 28 requests. ($0.080, 28 requests, 2.7 min)
- Right: Visit to `Sd3f1948f` is by alighting `Rf679205e+8` at `P6e8c05a2` at 37080 and leaving at 38244 (board `P1b70f91f` 38312 minus 68), which is the form the grader accepted.
- Right: Thought about tie ordering of arrival and departure events at the same second before sorting.
- Mistake: Fetched the data with 344 `run_sql` calls of 200 rows each, in seven `asyncio.gather` batches of 50, one batch per request; a wider or packed export (as its tour run did with `string_agg`) would have saved about six requests.
- Mistake: Its reasoning still planned to allow walk-in visits; the passing answer did not use one, so the pass owes something to which path the search happened to keep.

### tour

**Tool calling: failed.** Ran a macro-driven label search in SQL (`getboard()`, `getnew()`) over (platform, mask) and returned a ten-leg tour back at Hauptbahnhof at 50012. It failed, with the same arrival and the same walk-in visit as the failing code-mode run. ($0.096, 35 requests, 3.4 min)
- Right: Wrapped the relaxation step in table macros so each iteration was a short call.
- Right: Checked convergence with an `underbound` count (0 new labels below 50012) before stopping.
- Right: Noticed the 44313 vs 44280 mismatch at Altpieschen and correctly reported the vehicle arrival 44280.
- Mistake: Marienberger Straße `S596c8f4e` is visited by alighting `Rac88f0dd` at `P61c124e5` (Rennplatzstraße, 39000), walking 343 m to `P8e65d0ee` (visit arrival 39343) and boarding there at 40500 with reported departure 40500. This is the same walk-in pattern that separates the failing and passing timed_tour answers; with the walk charged to the departure the stay is 40500 - 343 - 39343 = 814 s, under 900. The grader's reason is not recorded.
- Mistake: The third branch of `getboard()` (`vwalk = 1`, visit the destination platform's station after walking) is what admits this; it should have been dropped or the stay recomputed.
- Mistake: Seeded labels at 35880 (36000 - 120) to cancel the 120 s margin on the first vehicle, a trick that works but hides the rule.
- Mistake: 35 requests and $0.0961, the most expensive run; includes an unquoted `at` error, a `GROUP BY` binder error and a `FROM FROM` typo.

**Code mode: failed.** Packed 48,428 timed calls into 8,072 `string_agg` rows, pulled them with 41 parallel queries and ran a Python event scan over 244,538 events and 32 masks; returned a ten-leg tour back at 50012. Failed, with the same arrival and walk-in visit as the tool run. ($0.071, 22 requests, 2.5 min)
- Right: Efficient export: six calls per row via `string_agg`, fetched in one `asyncio.gather` of 41 queries.
- Right: Stopped the scan as soon as events passed the best arrival (`if best is not None and t>best[0]: return`).
- Right: 22 requests and $0.0706 against 35 and $0.0961 in tool mode.
- Mistake: Its own reasoning says "If I walk to a station before leaving, that counts as two walks, which isn't allowed", yet `scan()` keeps the branch `lab[m]=(ready,ride,(stq,t+d,0))` that marks a visit after walking into another station.
- Mistake: That branch produced the Marienberger Straße visit: alight `Rac88f0dd` at `P61c124e5` 39000, walk 343 m, visit 39343→40500, board `Reca28e8d+8` at `P8e65d0ee`. The grader's reason is not recorded, but this matches the pattern that failed in tool-mode timed_tour.
- Mistake: It should have removed the walk-in branch, or set the visit departure to `t - walk` with the alight-to-board walk and re-tested the 900 s stay.
- Mistake: `SELECT max(at) ...` failed twice on the unquoted keyword before being quoted.
