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

# GPT-6.2 Astra on Pydantic AI Transit Planner

> Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 100%, code mode 100%; rank 1 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/gpt-6.2-astra/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.2-astra.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 100%  | 10 of 10     | $2.05 | 122      | 122        | 10.1 min |
| Code mode    | 100%  | 10 of 10     | $1.71 | 88       | 88         | 7.9 min  |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

20 of 20 cases passed: 10 in tool calling, 10 in code mode. No provider errors and no run came near giving up. Total cost was $2.04 over 122 requests with tools and $1.71 over 88 requests in code mode.

#### Where it does well

- **Reads the rules and encodes them exactly.** Every run read `/data/DATA.md` first and wrote the untimed-call interpolation, repeat expansion (`<run>+<k>`), 400 m walks and the 120 s + walk margin directly in DuckDB SQL.
- **Proves optimality instead of assuming it.** In most cases it re-ran the search bounded by the candidate answer, or iterated to a measured fixed point (`nextbest()` diff 0, `prof7 except prof6` 0 rows, recursive `reach` CTE). In `meeting_point` (tools) this changed the answer from 33780 at `S29c8f148` to the correct 33701 at `Sbb9212fa`.
- **Hard cases are handled with real algorithms**: bitmask DP over stations for `tour` and `timed_tour`, backward profiles for `departure_profile`, with opening windows and walk-adjusted visit departures.
- **Checks data before skipping a rule**: in `timed_tour` (tools) it printed `service_changes.txt` (two irrelevant rows) before ignoring it.

#### Mistakes it makes

- **SQL slips needing a resend**: 7 failed statements in tools mode (unquoted `at`, a missing table, an unparenthesised `union`, four binder errors, three of them in `tour`) and 2 in code mode, plus one Python error.
- **Lost results from multi-statement `run_sql`**: in at least 5 tools cases it bundled several SELECTs, got only the last back and repeated the query.
- **Loose tie-breaks**: `arrive_by` (code mode) arrives at 64500 where 64440 was available for the same departure; `timed_tour` (code mode) walks 379 m to board a run that also calls at the origin platform. Both passed.
- **Previous service day not always loaded** (`walking_change`, `tour`, `timed_tour`); harmless here because all were daytime questions.

#### Tool calling compared with code mode

Both modes scored 10/10, and where answers differed (`arrive_by`, `departure_profile`, `timed_tour` first leg) both were accepted. Code mode was cheaper in 9 of 10 cases, about 16% less overall and 28% fewer requests; the gap is largest on `timed_tour` (10 vs 16 requests, $0.20 vs $0.29) and `tour` (14 vs 19). Python loops replaced hand-stepped rounds, several results could be printed per call, and SVG and JSON were generated from query rows rather than typed out. Tool calling produced richer, labelled SVGs and applied slightly better tie-breaks.

## Runs

### one_vehicle

**Tool calling: passed.** Pre-filtered to runs calling near both stations (`pairs`), interpolated only those, and returned bus `R27f8d4b1+2` from `P0091960a` after a 399 s walk. Passed in 11 requests. ($0.15, 11 requests, 42 s)
- Right: Narrowed to candidate runs before interpolation, keeping the query small
- Right: Reported journey departure 29400 (start, since the 399 s walk precedes boarding at 29940)
- Mistake: Three calls bundled several SELECTs and got only the last result back (`select * from sv limit 2` twice, then the coordinates query re-run after a `lines.txt` lookup shadowed it)

**Code mode: passed.** Same approach as tools mode (candidate `pair` table, interpolate only those runs) and the same bus `R27f8d4b1+2`, departure 29400, arrival 30480. Passed in 9 requests. ($0.14, 9 requests, 42 s)
- Right: Checked `count(bt)`/`count(et)` on `pair` (98 and 87 of 144 timed) and so interpolated untimed calls before ranking
- Right: Included the previous service day with −86400
- Mistake: A `describe services` call was spent on schema it had already seen

### saturday_direct

**Tool calling: passed.** Found direct tram `Rb28d92d7` 33484→34560, then ran three more transfer rounds bounded by 34560 to confirm nothing faster. Passed in 13 requests, the most of the simple cases. ($0.16, 13 requests, 47 s)
- Right: Pruned `ev` to `arr<=34560` and iterated `ready`/`ride`/`onward` for rounds 2–4; the direct ride stayed best
- Mistake: Created view `onward` referencing table `rr` before it existed (`Catalog Error`)
- Mistake: Two later calls bundled several SELECTs and returned only the last (`count(*) from rr`, then the `lines.txt` lookup), so coordinates and line label each needed another request

**Code mode: passed.** Ran five rounds of a `roundtrip(i)` helper; round 1 gave direct tram `Rb28d92d7` arriving 34560 and later rounds were worse. Passed in 7 requests at the lowest cost ($0.12). ($0.12, 7 requests, 29 s)
- Right: One loop covered both the answer and the check that transfers do not beat it
- Right: SVG coordinates taken straight from query rows

### one_change

**Tool calling: passed.** Loaded two service days, compared the best direct ride (29160) with the best two-vehicle journey (28440) and returned the latter. Passed in 11 requests. ($0.18, 11 requests, 48 s)
- Right: Evaluated one-vehicle and two-vehicle options separately, respecting the at-most-2-vehicles limit
- Right: Ordered ties by total walking (`sw+w.dur+ew`) and chose the zero-walk start at `P0708873e`
- Mistake: A `times` query used unquoted `at` and failed with a parser error; the big statement had to be resent with `"at"`

**Code mode: passed.** Ran the direct and the two-vehicle query in one sandbox call and returned the 28440 two-leg journey. Passed in 7 requests. ($0.13, 7 requests, 35 s)
- Right: Both candidate queries printed from one `run_code`, avoiding the lost-result problem seen in tools mode
- Right: Two service days loaded; `e.run!=r1` enforces a real change

### walking_change

**Tool calling: passed.** Defined `ride`, `next0` and `dest` table macros, ran four rounds, and returned a two-leg journey with a 78 m platform change at Pirnaischer Platz arriving 63480. Passed in 9 requests, the fewest in tools mode. ($0.15, 9 requests, 44 s)
- Right: Reusable macros kept the search to one statement
- Right: Looked up which first leg feeds `P72ccec8b` with the 120 s + 78 s margin (62040+198 ≤ 62520)
- Mistake: One call bundled two SELECTs, only the second returned, and the first was re-sent
- Mistake: Only the question day's services were loaded; harmless at 17:05

**Code mode: passed.** Ran six rounds of an `rnd(i)` helper carrying path strings; round 2 gave the 63480 journey with the platform change at Pirnaischer Platz. Passed in 8 requests. ($0.14, 8 requests, 36 s)
- Right: Round 1 returned no direct ride and rounds 3–6 only gave 63780 or later, so the two-leg answer is confirmed
- Right: Used `service_changes` both for `+` and `-` when building `active`
- Mistake: Only the question day's services were loaded; harmless at 17:05

### after_midnight

**Tool calling: passed.** Built the timetable in DuckDB with an `inst`/`delta` table for shifted service days, found no direct ride, then a two-leg journey arriving 6420. Passed in 10 requests. ($0.16, 10 requests, 47 s)
- Right: Empty `oneleg`→destination result led straight to a two-leg join (`r2`) rather than a wrong direct answer
- Right: Checked optimality with a recursive `reach` CTE limited to `arr<6420`; it returned 6628, so nothing beats 6420
- Right: Kept the 76 m walk between `P96dc02de` and `P983fcb99` out of the legs and drew it as an unlabelled path
- Mistake: Sent two statements in one `run_sql` (the `r2` result plus `select * from oneleg`); only the last result came back, so it re-ran the `r2` query in a separate call

**Code mode: passed.** Built an `early` run set with a `shift`, looped 12 relaxation rounds in Python and got the same two-leg journey arriving 6420. Passed in 7 requests. ($0.13, 7 requests, 33 s)
- Right: Path strings carried run, platforms and times through the loop, so no separate reconstruction was needed
- Right: Result stable from round 1 to round 11, confirming optimality
- Mistake: Ran all 12 rounds though the answer stopped changing after round 1; cheap but unnecessary

### arrive_by

**Tool calling: passed.** Searched backwards from the 18:00 deadline (`lastleg`, `firstleg`), found departure 63360 with arrival 64440, and passed in 11 requests. ($0.16, 11 requests, 51 s)
- Right: Confirmed no later departure with a recursive `late` CTE over `firstleg where start>63360`, which returned no rows
- Right: Among the two options leaving at 63360 it took the earlier arrival (`Rfd6f9e2d+67`, 64440, over `R54c1ee76+5`, 64500) via `order by start desc, fin`
- Mistake: Combined the coordinates query with a `lines.txt` lookup in one call; only the second result returned, so the coordinates query was repeated

**Code mode: passed.** Searched backwards from the deadline in a nine-round loop (`ride{i}`/`best{i}`) and returned departure 63360 arriving 64500. Passed in 8 requests. ($0.13, 8 requests, 35 s)
- Right: Latest departure 63360 appeared at round 2 and later rounds only gave earlier ones
- Mistake: Picked `R54c1ee76+5` (arrive 64500) where the tools run found `Rfd6f9e2d+67` (arrive 64440) for the same departure; the `distinct on(b.place) … order by b.d desc` tie-break ignores earlier arrival. It still passed
- Mistake: The printed output did not show the 64 m walk between `P3b6efaff` and `P6ea0167f` (query returned the final walk `dt`=0); the 120 s + walk margin was enforced in SQL but not displayed

### departure_profile

**Tool calling: passed.** Computed a backward profile (`best`, iterated with a `nextbest()` macro to a fixed point), filtered dominated departures, and returned 12 journeys for 07:00–08:00. Passed in 12 requests. ($0.27, 12 requests, 77 s)
- Right: Loaded both day 2026-342 and the previous service day with a −86400 offset
- Right: Ran `nextbest()` five times then verified convergence: the diff against one more iteration was 0 rows
- Right: Dominance filter used a window `min(finish)` over later departures, matching the question's rule
- Mistake: The `active` query contains a stray predicate `coalesce(ch.change=' precisely',false)`; it is always false so harmless, but it is junk SQL
- Mistake: One binder error (`Column "place" does not exist`) on the first `winners` query, fixed on retry

**Code mode: passed.** Built backward tables `b1`…`b7` with an ASOF join to a profile, stopped when no row changed, and assembled 12 journeys in Python. Passed in 9 requests. ($0.24, 9 requests, 62 s)
- Right: Loop terminated on a measured fixed point (`b7` diff 0)
- Right: Two service days loaded with offset
- Right: Journey JSON was built in code, so no manual transcription of 24 legs
- Mistake: Leg reconstruction issued one SQL query per leg in a Python loop
- Mistake: Six of the journeys change at `P3b6efaff` on the same platform, where the tools run changed at Postplatz; same departure and arrival times, so both are valid

### meeting_point

**Tool calling: passed.** Expanded reachability from both origins with an `advance` macro, first got `S29c8f148` at 33780, then re-searched with that bound and found Albertplatz `Sbb9212fa` at 33701. Passed in 10 requests. ($0.19, 10 requests, 47 s)
- Right: Did not trust the first answer: rebuilt the search as `adv` with `r.a+w.dur<=33780`, ran it until `a6` was empty, and found the better station
- Right: Verified both legs against `tc` (times and `YY` access) before answering
- Mistake: The first `advance` pass kept one row per `(orig, walked-to platform)` ordered by arrival-plus-walk, which dropped the arrival that gives Albertplatz 33701; had it stopped there it would have answered 33780
- Mistake: The refined path showed boarding `P3035f403:33180`; the final answer boards the same run at `Pda4a5390` 33300, picked from the last check query rather than from the search

**Code mode: passed.** Expanded from both origins round by round, found Albertplatz at 33701 after round 1, then continued bounded at 33701 until no rows were added. Passed in 9 requests. ($0.19, 9 requests, 47 s)
- Right: Re-ran the expansion with `<=33701` for rounds 2–5 to prove no multi-leg route meets sooner
- Right: Fetched the final legs with a join back to `r0` for the origin platform
- Mistake: Round 2 of the `step` loop hit `Ambiguous reference to column name "d"`; the loop did not stop, so rounds 2 and 3 printed cascading `r2 does not exist` errors before a rewrite

### timed_tour

**Tool calling: passed.** Wrote a bitmask tour search in SQL (a `route` macro using a recursive CTE with `using key`), stepped it five times and returned a 5-leg tour back at 44160. Passed in 16 requests. ($0.29, 16 requests, 1.5 min)
- Right: Printed `service_changes.txt` first (two rows, days 325/326) and so safely filtered services on `days&4` and date range only
- Right: Encoded opening windows in `st(i,s,op,cl)` and applied `greatest(arrival,op)+900<=cl`
- Right: Swapped the first boarding from `Pb9e884d4` (379 m walk) to `P72ccec8b` at the origin station on the same run after a check query
- Mistake: First `route` macro failed with a parser error at `union` (unparenthesised `order by` branches); resent the whole statement
- Mistake: `leg` table was a full self-join of 962,177 rows; it worked but is heavy
- Mistake: Two extra check queries after the answer was already determined

**Code mode: passed.** Wrote a Python `route(i,t)` label-correcting search over SQL temp tables and a bitmask DP over `(mask, station)`; returned the same 5-leg tour arriving 44160. Passed in 10 requests versus 16 in tools mode. ($0.20, 10 requests, 64 s)
- Right: Opening hours held in Python lists `op`/`cl` and checked with `max(a,op[j])+900>cl[j]`
- Right: Cached `route` results by `(station, ready time)`
- Right: Visit departures computed as boarding time minus walk (35523 = 35640 − 117)
- Mistake: First leg boards at `Pb9e884d4` (DD Deutsches Hygiene-Museum, 379 m walk) at 32940 although the same run calls at the origin's own platform `P72ccec8b` at 32820; valid but an unnecessary walk that the tools run corrected
- Mistake: SVG marks the visited stations but carries no time labels

### tour

**Tool calling: passed.** Built per-boarding earliest-arrival costs to each of six stations (`cost`, `improve()` to a fixed point), enumerated station orders in a recursive CTE, and reconstructed 11 legs returning at 48660. Passed in 19 requests, the most expensive run ($0.34). ($0.34, 19 requests, 1.8 min)
- Right: Checked the fixed point: `checkcost except cost` returned 0 rows
- Right: Encoded leg count in the cost (`t*100+1`) so path reconstruction could follow `v-1`
- Right: Visit departures subtract the walk to the next platform (e.g. 38112 for a 38400 boarding)
- Mistake: Four failed statements: three ambiguous-column binder errors (`i`, `dst`, `dep`) and each needed a resend of a long query
- Mistake: Only the question day's services were loaded (no previous service day); harmless for a 10:00 start

**Code mode: passed.** Built layered backward profiles (`board{i}`, `prof{i}`, `start{i}`) to a fixed point at layer 7, ran the order DP in Python, and reconstructed the same 11 legs returning at 48660. Passed in 14 requests versus 19. ($0.29, 14 requests, 1.6 min)
- Right: Verified convergence: `prof7 except prof6` and `prof8 except prof7` both 0 rows
- Right: DP over station subsets done in Python against `start7`, one SQL call per level
- Right: Legs and visit departures printed from code and matched the tools-mode answer exactly
- Mistake: `select max(at)` with unquoted `at` gave a parser error in the first exploration call
- Mistake: SVG cell crashed with `TypeError: 'list' object is not an iterator` on `next(generator)`; rewritten with `.index()`
- Mistake: Only the question day's services were loaded; harmless for a 10:00 start
