---
title: "GPT-6 Luna 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 40%; rank 15 of 32."
canonical: https://models.pydantic.dev/models/gpt-6-luna/transit_planner/
---

# GPT-6 Luna 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 40%; rank 15 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/gpt-6-luna/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-luna.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 80%   | 8 of 10      | $0.18 | 350      | 360        | 33.7 min |
| Code mode    | 40%   | 4 of 10      | $0.28 | 344      | 344        | 45.6 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`gpt-6-luna` passed 12 of 20 runs: 8 of 10 with tool calling and 4 of 10 in code mode. Simple point-to-point questions mostly pass; both `tour` runs fail. Total cost was $0.18 for tools and $0.28 for code mode, with about 350 requests each.

#### Where it does well

- **Timetable modelling.** In most runs it handled the previous service day (shift of -86400), repeat runs named `<run>+<k>`, the 400 m walk limit and the 120 s change margin correctly.
- **Self-checks that worked.** It caught a 439 m walk in `tour` (tools), negative arrival times in `one_change` (tools), a wrong calendar date in `meeting_point` (tools) and a wrong start time in `walking_change` (tools).
- **Checking deeper options.** Passing runs usually tested 3-ride journeys before accepting a 2-ride answer.
- **Output.** Every answer that was returned had a well-formed SVG and result; no failure came from formatting.

#### Mistakes it makes

- **Wrong test for untimed calls (6 runs, 5 failed).** It checked `count(*) FILTER (WHERE "at"='')`, got 0 and skipped interpolation. Empty fields load as NULL; `IS NULL` shows 49,345 of 163,359 calls are untimed. This caused `saturday_direct` and `tour` (tools) and `after_midnight`, `one_change` and `tour` (code mode) to miss faster journeys. `walking_change` (tools) made the same check and passed only because its answer used timed calls.
- **Interpolation bug.** `walking_change` (code mode) computed distance along the run one call behind, giving a wrong board time of 62481.
- **Lost data not noticed.** `departure_profile` (code mode) rebuilt its table from 634,086 to 158,544 rows, apparently losing the repeat runs, and returned 3 slow journeys.
- **Not finishing.** `timed_tour` (code mode) had the right tour (44160) by request 59, then spent its last calls re-checking that the SVG existed and hit the 80-request limit.
- **Implausible answers accepted.** A 6-vehicle, 70-minute trip in `after_midnight` (code mode) was returned without question.
- **SQL friction.** Nearly every run lost 3–6 requests to unquoted `at`, reserved aliases (`offset`, `day`), an unloaded `lines` table, or multi-statement queries that return only the last result.

#### Tool calling compared with code mode

Code mode was worse here: half the pass rate at about 1.5 times the cost. The model mostly used `run_code` as a wrapper around single `run_sql` calls, so it saved few requests. When it did move data into Python, it paged 200 rows per call and ran into sandbox limits: 256 MiB memory errors (3), the cap of 100 nested calls (3) and 30-second timeouts (2), each followed by a session reset and re-fetch. Code mode was better in two cases: `saturday_direct` (13 requests, correct interpolation) and `meeting_point` (34 requests against 49).

## Runs

### one_vehicle

**Tool calling: passed.** Queried direct runs from platforms within 400 m of Lennéplatz to Technische Universität and returned bus `R27f8d4b1+2` from `P0091960a` at 29940, arriving 30480. Passed in 17 requests. ($0.0077, 17 requests, 89 s)
- Right: Allowed a start walk to Strehlener Platz rather than only the origin station's platforms, after the same-station query returned no rows
- Right: Re-derived the repeat offset for `+2` and checked the raw calls of `R27f8d4b1`
- Mistake: Three SQL errors (`lines` not loaded, a stray comma, missing column `shift`)

**Code mode: passed.** Found bus `R27f8d4b1+2` from `P0091960a` at 29940 arriving 30480 with a few SQL queries through `run_code`. Passed in 14 requests. ($0.011, 14 requests, 81 s)
- Right: Allowed a start walk to a neighbouring station's platform after the direct same-station query was empty
- Right: Fewest requests of its pair (14 against 17 in tools)
- Mistake: One runtime error on an import when writing the SVG (message 24), fixed on the next call
- Mistake: Cost $0.011 against $0.0077 for tools

### saturday_direct

**Tool calling: failed.** Returned a 2-vehicle journey (bus `Rebc40153` then tram `Rb9c6fb68`) arriving 35160; the code-mode run found a direct tram `Rb28d92d7` boarding at 33484 and arriving 34560. Failed. ($0.014, 35 requests, 2.3 min)
- Right: Included the previous service day and built a per-trip key after seeing mixed run instances (message 39)
- Right: Checked 3-ride options and an end walk before finalising
- Mistake: Message 21: tested for untimed calls with `count(*) FILTER (WHERE "at"='')`, got 0 and concluded every call is timed. Empty fields load as NULL, so the right test is `"at" IS NULL` (49,345 of 163,359 calls). It then built `expanded` without interpolation
- Mistake: Because of that, its direct-ride query (message 48) showed the earliest direct arrival as 35460 and the tram boarding at the untimed call `P7fa04a55` at 33484 was never seen
- Mistake: Three consecutive multi-statement calls (messages 15–19) returned only the last statement before it ran the count alone

**Code mode: passed.** Built an interpolated timetable in SQL and returned direct tram `Rb28d92d7` from `P7fa04a55` at 33484, arriving 34560. Passed in 13 requests, the cheapest run at $0.0079. ($0.0079, 13 requests, 89 s)
- Right: Interpolated untimed calls: 33484 is an interpolated departure, the journey the tools run missed
- Right: Checked whether an end walk was needed before answering
- Mistake: Two failed calls at the start (table `tt` did not exist because the creating statement's result was discarded; a parser error near a comma)

### one_change

**Tool calling: passed.** Built `callbase` with interpolation and `trip_calls` for days 337/336, queried direct and 2-ride options, and returned `Rafeef850` boarding at 27669 then `R620ec7d9`, arriving 28440. Passed in 20 requests. ($0.0078, 20 requests, 86 s)
- Right: Interpolated the untimed call at `P0708873e` (board time 27669), which is what makes the 28440 arrival reachable
- Right: Spotted negative arrival times (-57240) in the first direct query and rebuilt `trip_calls` with a per-trip key
- Right: Confirmed the raw calls and the 72 m walk before writing the SVG
- Mistake: Four SQL errors (alias `at`, alias `day`, unknown column `s.sarr`, `lines` not loaded)
- Mistake: A multi-statement query returned only the last result, so two more calls were needed

**Code mode: failed.** Returned tram `Rb0356f0c+8` at 27960 then `R749e73aa`, arriving 28740; the tools run arrived at 28440 by boarding `Rafeef850` at 27669. Failed. ($0.013, 19 requests, 2.4 min)
- Right: Verified the 72 m walk plus 120 s margin (28260 + 192 ≤ 28500)
- Right: After a 30-second timeout it narrowed the search to boards near the origin
- Mistake: Message 9: `COUNT(*) FILTER (WHERE "at"='')` returned 0 and it skipped interpolation, although its own plan in message 7 mentioned it. `Rafeef850` calls at `P0708873e` untimed, so the 27669 departure was not in its data
- Mistake: Message 22: first 2-ride result had arrivals before departures (26880 after boarding at 28140) because `n` was compared as text; fixed with `CAST(c.n AS INTEGER)`
- Mistake: Three requests spent patching the SQL string with `.replace()`

### walking_change

**Tool calling: passed.** Built `tripcalls` and `ride_options` views, found bus `R76d2117b+4` to Pirnaischer Platz, a 78 m walk and tram `R3a0dccd4+54`, arriving 63480. Passed in 34 requests. ($0.014, 34 requests, 2.7 min)
- Right: Diagnosed an empty result: it had used 102300 as the start time and a view with only 30 eligible departures, then rebuilt `instances` (550,141 rows) and searched from 61500
- Right: Checked 3-, 4- and 5-ride depths (63780, 63780, 64080) against the 2-ride 63480
- Right: Verified the transfer: 62040 + 120 + 78 ≤ 62520
- Mistake: Message 15: `WHERE "at"=''` returned 0 untimed calls, the same wrong test that failed other cases; this answer happens to use only timed calls, so it passed
- Mistake: About ten requests (messages 25–47) were spent on queries with the wrong start time 102300
- Mistake: SQL errors on `at`, alias `seconds`, and a missing CTE `firsts`

**Code mode: failed.** Ran a label-correcting search and returned the same two runs and the same 63480 arrival as the tools run, but changing at Prager Straße → Altmarkt and boarding the tram at an interpolated 62481. Failed. ($0.016, 27 requests, 2.7 min)
- Right: Used `"at" IS NULL` (49,345 untimed) and wrote an interpolation in SQL
- Right: Re-ran the relaxation until six rounds showed no change (`[0,63480]`)
- Right: Transfer margin holds on its own numbers: 61920 + 120 + 341 ≤ 62481
- Mistake: Message 33: the distance along the run is `sum(seg) OVER (… ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)`, where `seg` is the distance from the previous call. That leaves out the segment into the current call, so every `spos` is one call behind and interpolated times are wrong. The frame should end at `CURRENT ROW`
- Mistake: The answer boards `R3a0dccd4+54` at the untimed call `P9cd5b9a9` with that time (62481); the tools run boarded the same tram at a timed call, `P72ccec8b` at 62520, and passed
- Mistake: Did not compare the interpolated time against the neighbouring timed calls of the run

### after_midnight

**Tool calling: passed.** Built an `events` table for service days 339 and 338 (shift -86400) with interpolated times, searched 1-, 2- and 3-ride journeys in SQL and returned the 2-ride journey arriving 6420. Passed. ($0.013, 24 requests, 2.0 min)
- Right: Included the previous service day with `('2026-338',16,-86400)` so the after-midnight Friday runs were visible
- Right: Interpolated untimed calls: the first leg alights at `P96dc02de` at 5492, a non-timetabled time
- Right: Ran a 3-ride query that returned no rows before settling on the 2-ride answer
- Right: Re-read the four calls and platform coordinates before writing the SVG
- Mistake: Five failed `run_sql` calls from SQL slips (alias `offset`, a stray comma, ambiguous `east`, missing column `iid`, `lines` table never loaded) cost about 5 of 24 requests

**Code mode: failed.** Ran a label-correcting loop over `rides`/`labels` tables from Python and returned a 6-vehicle journey arriving 8400; the tools run reached Wasaplatz at 6420 with two vehicles. Failed. ($0.014, 23 requests, 2.3 min)
- Right: Included the previous service day and noticed runs active on both days (message 22)
- Right: The relaxation loop ran to convergence in one `run_code` call (`[1143,1225,238,19,5,4,0]`)
- Mistake: Message 11: `FILTER (WHERE "at"='')` returned 0 untimed calls; `occ` was built with `CAST(c."at" AS BIGINT)` and no interpolation. The 6420 journey alights at an untimed call (`P96dc02de` at 5492), so it was invisible
- Mistake: Message 15: the active-service filter used `(CAST(s.days AS INTEGER)&32)=32` for both `2026-338` and `2026-339`; Friday needs bit 16
- Mistake: Accepted a 6-ride, 70-minute answer for a trip between nearby stations without questioning it

### arrive_by

**Tool calling: passed.** Built interpolated `calltimes` and `instances` views, searched for the latest departure reaching Lennéplatz by 18:00, and returned tram `R1aabe4da+29` at 63360 then `Rfd6f9e2d+67`, arriving 64440. Passed. ($0.020, 36 requests, 3.7 min)
- Right: Checked 1-, 2- and 3-ride options for a later departure than 63360 using temp tables `late_first`, `midboards`, `late_mid_arr`
- Right: Verified the 64 m walk and 120 s margin at Straßburger Platz before answering
- Mistake: About 6 failed `run_sql` calls (missing `lines` and `active_services`, `COALESCE` type mix, parser error, `VARCHAR - DOUBLE`) and one 30-second query timeout; 36 requests for a 2-leg answer
- Mistake: Several multi-statement queries returned only the last result, so it re-ran the earlier statements one at a time

**Code mode: passed.** Built interpolated call times, searched the latest departure with SQL driven from `run_code`, and returned the same journey as the tools run (leave 63360, arrive 64440). Passed. ($0.021, 34 requests, 3.7 min)
- Right: Used `IS NULL` for the untimed check and saw 49,345 untimed calls (message 14)
- Right: Tested 3-ride and deeper options with a frontier table before settling on 63360
- Mistake: Used `run_code` as a thin wrapper: almost every call is a single `await run_sql(...)`, so it took 34 requests, about the same as tools (36)
- Mistake: One 30-second timeout on a self-join of 264k leg rows and five SQL errors

### departure_profile

**Tool calling: passed.** Built an interpolated event table for days 341/342, materialised 1-change journeys in `j1`, tested 3-vehicle options through `p2a`/`p2c_min`, and returned the non-dominated list starting 25327→27420. Passed. ($0.018, 37 requests, 4.8 min)
- Right: Computed departure as `s.bt - s.walk`, as the question defines it
- Right: Kept repeat runs (`R77afbc0f+4`, `R45005fd8+1` …) in the event table
- Right: Checked whether 3-vehicle journeys improved any departure before finalising
- Mistake: Two queries hit the 30-second limit (messages 44 and 54) and had to be restructured into smaller tables
- Mistake: The 2-change check was only finished after the SVG had been planned; it noted 4-vehicle journeys were not tested

**Code mode: failed.** Returned only three journeys (25800→28663, 26956→29580, 27780→31063), none on a repeat run; the tools run listed many more, starting 25327→27420. Failed in 42 requests. ($0.029, 42 requests, 5.8 min)
- Right: Found and fixed 4x duplicate rows caused by window partitions that ignored the service day (messages 29–37)
- Right: Used the departure definition of first departure minus walk
- Mistake: Messages 37–38: the rebuilt `timedcalls` dropped from 634,086 rows to 158,544, about the size of the raw `calls` file, and every run in the answer is a base run with no `+k` suffix. The repeat runs appear to have been lost in the rewrite, and the row count was not questioned
- Mistake: Only 28 start options were seeded, and the search stopped at one or two transfers; message 73 says it needed to finalise 'urgently'
- Mistake: Seven requests (messages 9–23) went on patching one SQL string with `q.replace(...)` after errors on `offset`, `at` and `dayoff`
- Mistake: Arrivals 28663, 29580 and 31063 for departures around 07:10–07:43 are far slower than a 35-minute trip, and were accepted

### meeting_point

**Tool calling: passed.** Ran a hand-driven label-correcting search in SQL (`reach`/`rnext` tables rebuilt round by round) for both friends, picked Albertplatz `Sbb9212fa` at 33701 with one direct ride each. Passed. ($0.019, 49 requests, 3.2 min)
- Right: Caught its own date error: first mapped day 339 to a November date, then corrected it (message 17)
- Right: Noticed impossible arrivals at 32400 (message 53), traced them to run/service-day mixing and rebuilt the tables
- Right: Meeting time correctly taken as the later arrival, 33701 vs 33692
- Mistake: 49 requests, the most of any passing tools case: each relaxation round was a separate `run_sql` call (`DROP TABLE reach; ALTER TABLE rnext RENAME TO reach; …`) and the whole loop was done twice after the rebuild
- Mistake: Five SQL errors (`offset` alias, commas after `at`, missing alias `w`, `lines` not loaded)

**Code mode: passed.** Paged timetable rows into Python, ran an event scan for both friends and returned Albertplatz `Sbb9212fa` at 33701, the same answer as the tools run. Passed in 34 requests. ($0.026, 34 requests, 3.9 min)
- Right: Noticed 47 base runs missing from the paged data and fetched them (message 37)
- Right: Did the search in Python in one call instead of one SQL round per request, 34 requests against 49 in tools
- Mistake: Pulled data 200 rows per `run_sql` call in batches of up to 100 calls; one batch failed with a runtime error (message 20) and two more calls failed on the unquoted `at`
- Mistake: Cost $0.0258 against $0.0188 for the tools run

### timed_tour

**Tool calling: passed.** Built interpolated `ecalls`, reasoned through the opening windows by hand with targeted SQL for each hop, and returned the order Prohlis → TU → Pohlandplatz → Mickten, back at 44160. Passed. ($0.031, 37 requests, 5.0 min)
- Right: Used `"at" is null` for the untimed check (message 21) and interpolated
- Right: Worked out from the windows that Pohlandplatz must come before Mickten and that Mickten cannot be left before 12:00
- Right: Computed visit departures as next vehicle departure minus walk (e.g. 38268, 40478, 43241)
- Right: Verified the calls of all six runs before writing the SVG
- Mistake: The order was chosen by manual reasoning and per-hop queries, not by an exhaustive search over the 24 orders; the result was right but not proven
- Mistake: Five SQL errors (unquoted `at` three times, `''` to INT64 conversion, aggregate in `WHERE`); highest cost of the passing tools cases at $0.0314

**Code mode: error.** Paged the timetable into Python, ran a staged search and had the tour back at 44160 by message 118, but never called `final_result` and stopped at the 80-request limit. Failed with no output. ($0.086, 80 requests, 13.1 min)
- Right: Used `"at" IS NULL OR "at"=''` and found 49,345 untimed calls (message 14)
- Right: The computed tour (Prohlis, TU, Pohlandplatz, Mickten, back 44160) matches the tools run's passing answer
- Right: Wrote the SVG and checked it: 5 `data-run` legs, 5 station markers, stays of 1053, 1164, 998 and 941 s
- Mistake: Message 68: `MemoryError` at 268 MB after loading 64,125 extra rows; the session reset and all paged data had to be fetched again
- Mistake: Messages 62 and 94: exceeded the 100 nested tool calls per `run_code` by issuing 121 `run_sql` calls; message 90 and 138: 30-second timeouts, the second after re-running a search it had already completed
- Mistake: Messages 119–134: fetched 14,886 more rows and repeated the whole staged search, getting the same 44160
- Mistake: Messages 145–157: seven consecutive `run_code` calls that only re-check `Path('/out/journey.svg').exists()` or print the summary. Its notes say a developer message required a tool call before finishing; it should have called `final_result` at message 147

### tour

**Tool calling: failed.** Built station-to-station segments of at most two rides, ran a bitmask recursion over them and returned a round trip back at 51780 with 11 legs. Failed in 61 requests. ($0.040, 61 requests, 7.1 min)
- Right: Caught that its first result (51360) used a 439 m walk at Waldschlößchen, over the 400 m limit (message 81), and rebuilt the segments platform-to-platform (`bseg2`, `states2`)
- Right: Computed visit departures as board time minus walk (45089, 47913, 50652)
- Mistake: Message 15: `count(*) FILTER (WHERE "at"='')` returned 0 and it treated all calls as timed; `ev` was built with `CAST(c.at AS INTEGER)` and `TRY_CAST`, so untimed calls carry no time and were never interpolated
- Mistake: Message 73: it noted that hops were limited to two rides and that a 3-ride hop could be faster, but did not extend the search
- Mistake: Two recursive queries hit the 30-second limit (messages 34 and 52); the path was then reconstructed by about 20 one-hop backtracking queries
- Mistake: Several multi-statement calls returned only the last result

**Code mode: failed.** After two memory errors it cut the network to about 22 hub stations plus targets, ran a time-stepped search in Python and returned a 10-leg tour back at 52603, later than the tools run's 51780. Failed in 58 requests. ($0.056, 58 requests, 8.8 min)
- Right: Recovered from session resets by re-paging from DuckDB, which kept its tables
- Right: Counted the final 163 m walk to a Hauptbahnhof platform in the arrival (52440 + 163)
- Mistake: Message 20: untimed check on the filtered calls returned 0 and `ev` was built with `CAST(c.at AS INTEGER)`, no interpolation
- Mistake: Messages 54 and 74: `MemoryError` at the 256 MiB limit from a state table over about 40k events
- Mistake: Messages 85–90: reduced the events to 14,786 around hand-picked hubs; message 95 admits transfers away from hubs would be missed. Message 111 notes 10 vehicles and many transfers, and it finalised anyway
- Mistake: Message 60: one batch exceeded the nested-call limit; message 70: a `NameError`-style failure from variables lost in the reset
