---
title: "GLM 5.3 on Pydantic AI Transit Planner"
description: "Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 50%, code mode 70%; rank 22 of 32."
canonical: https://models.pydantic.dev/models/glm-5.3/transit_planner/
---

# GLM 5.3 on Pydantic AI Transit Planner

> Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 50%, code mode 70%; rank 22 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/glm-5.3/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/glm-5.3.md

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time      |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | --------- |
| Tool calling | 50%   | 5 of 10      | $12.87 | 531      | 626        | 175.1 min |
| Code mode    | 70%   | 7 of 10      | $15.70 | 473      | 473        | 229.7 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

GLM-5.3 passed **12/20 runs**: **5/10 in tools** and **7/10 in code_mode**. It handled ordinary journeys more reliably than tours: both modes passed `arrive_by`, `one_change`, `one_vehicle` and `saturday_direct`, while neither passed either tour case.

#### Where it does well

The model can expand repeated services, interpolate untimed calls, handle previous-service-day timestamps and produce the required SVG identifiers. Its strongest checks compare different routing methods: code-mode `meeting_point` and `walking_change` used independent searches successfully.

Tools-mode `departure_profile` returned all 12 nondominated journeys and checked domination by departures outside the requested hour. Code mode eventually computed the same set, although it failed to submit it.

#### Mistakes it makes

**Three failures** came from missing the end of `DATA.md`. Tools-mode `after_midnight`, `meeting_point` and `walking_change` treated station transfers as instantaneous instead of requiring `120 + ceil(distance)` seconds. Checking vehicle calls repeatedly did not catch this missing constraint. Tools-mode `saturday_direct` passed despite the same incomplete reading because its submitted ride required no transfer.

**Three runs** exhausted 80 requests. Repeated SQL repairs, reconstruction queries, calculation rebuilds and SVG polishing consumed the budget. Code-mode `departure_profile` had verified journeys and a written SVG but spent its final request inspecting the file.

Code-mode `timed_tour` used a broken custom heap and reused it in its cross-check. Code-mode `tour` ended in the reported 2400-second timeout. Recoverable errors were also frequent: invalid SQL aliases, placeholder code, unsupported sandbox features and memory resets.

#### Tool calling compared with code mode

Code mode fixed the three transfer-related failures but lost `departure_profile`, for a net gain of two passes. It used **473 requests versus 531**, yet cost **$15.70 versus $12.87**, about **22% more**.

For these cases, code mode is the stronger accuracy choice. Neither mode demonstrated reliable tour completion, and both need tighter execution budgets and validation of routing invariants.

## Runs

### one_vehicle

**Tool calling: passed.** Passed in 26 requests with an initial walk and one ride on `R27f8d4b1+2`. Reported station departure `29400`, boarding `29940`, and arrival `30480`. ($0.35, 26 requests, 8.6 min)
- Right: Read the final rules explicitly with `read_text(start_line=108)`.
- Right: Searched platforms within walking range instead of assuming the vehicle must serve both named stations directly.
- Right: Checked Wednesday service eligibility, repeat offsets and possible previous-day services.
- Mistake: The first loading batch failed on unquoted `at`; a subsequent query assumed `places` existed when it did not.
- Mistake: Initially attempted to read service dates such as `2026-326` as integers.
- Mistake: Later used invalid `CROSS JOIN g ON ...` and referenced an absent `untimed` column. These were repaired.

**Code mode: passed.** Passed with an initial walk followed by `R27f8d4b1+2`, arriving `30480`. It used 41 requests compared with tool mode's 26. ($0.68, 41 requests, 13.5 min)
- Right: Searched nearby boarding and alighting platforms while preserving the one-vehicle restriction.
- Right: Correctly distinguished station departure `29400` from vehicle boarding `29940`.
- Right: Checked repeat instances and Wednesday service eligibility.
- Mistake: Initially set `START = 10*3600 + 8*60`, producing `36480` instead of `29400`.
- Mistake: Used `DAY = 2026-336`, which evaluates to `1690`, and passed the same subtraction expression into service filtering. This produced empty results until it used day-of-year `336`.
- Mistake: Misread SQL row lists as dictionaries and later made numerous SVG inspection/edit calls.

### saturday_direct

**Tool calling: passed.** Passed with direct tram `Rb28d92d7`, boarding `P7fa04a55` at `33484` and alighting `P1093f876` at `34560`. Its exploratory walking model did not follow the benchmark rules. ($0.95, 39 requests, 16.5 min)
- Right: Applied Saturday service eligibility and verified the untimed boarding call's interpolation.
- Right: Returned the correct direct ride and generated the required SVG.
- Mistake: The initial `read_text` calls missed the final rules. Later searches experimented with walking speeds `1.4`, `3.0` and `2.0` metres/second instead of the specified `1`, and allowed `R` access.
- Mistake: These mistakes did not affect the submitted direct ride, which needs neither walking nor a transfer.
- Mistake: Repeated SQL repairs included unquoted `at`, ambiguous `place`, and nonexistent `run2` and `eeast_dummy` references.

**Code mode: passed.** Passed with `Rb28d92d7` from `33484` to `34560`. It corrected repeat naming and interpolation bugs before submission. ($0.96, 33 requests, 19.4 min)
- Right: Read the full rules and searched with explicit walking/transfer states.
- Right: Rebuilt repeated instances using the required `<run>+<k>` identifiers.
- Right: Independent interpolation checks found that filled untimed calls were being reused as brackets; it rebuilt them using originally timed calls and reran the search.
- Mistake: Attempted to import unavailable `heapq`, then accessed `c[5]` in five-element call tuples.
- Mistake: Overwrote `lines` with a list and subsequently called `lines.get`.
- Mistake: The initial interpolation algorithm was incorrect, although the final selected direct journey remained unchanged after correction.

### one_change

**Tool calling: passed.** Passed with `Rafeef850` followed by `R620ec7d9`, departing `27669` and arriving `28440`. It recovered from substantial SQL errors and a late discovery of the walking rules. ($0.88, 53 requests, 12.9 min)
- Right: Loaded `DATA.md` into a SQL table and retrieved the previously unread walking and transfer rules.
- Right: Rebuilt the search with a `400`-metre walking limit and `b2.dep_time >= l.a1 + 120 + n.walk`.
- Right: The chosen transfer allows `240` seconds for a `72`-second walk plus the `120`-second margin.
- Mistake: Initially searched without the complete rules, then had to rebuild the calculation.
- Mistake: Used nonexistent columns, placeholder SQL and unsupported `CROSS APPLY`; all required repairs.
- Mistake: A late verification query exhausted DuckDB's `8.3 GiB` temporary-storage allowance, although the selected journey was already available.

**Code mode: passed.** Passed with the same `27669 → 28440` two-tram journey as tool mode, using 36 rather than 53 requests. ($0.80, 36 requests, 15.9 min)
- Right: Read the complete rules, interpolated calls and searched one- and two-vehicle options with initial, transfer and final walks.
- Right: Independently checked that no permitted journey arrived before `28440`.
- Right: Verified the `72`-second platform walk and marked all required SVG endpoints.
- Mistake: One `run_sql` wrapper contained a stray `<arg_value>` fragment and failed to parse.
- Mistake: Called unsupported `time.time()` and twice attempted to assign `phase_b.done` to a function object.
- Mistake: Spent several late requests generating and rebuilding an SVG with extensive background detail; the supplied output exceeds 100,000 characters.

### walking_change

**Tool calling: failed.** Returned arrival `63180` using bus `R76d2117b+4` and tram `Rd49d751b+59`. The transfer misses the required boarding margin, so the run failed. ($0.73, 51 requests, 14.0 min)
- Right: Correctly expanded the selected repeat instances and recovered their scheduled calls.
- Right: Queried the relevant platform coordinates and drew both vehicle legs.
- Mistake: The initial `DATA.md` reads omitted the transfer rules. Routing joined station-level labels with `l.bdep >= r.arr`.
- Mistake: Bus arrival at `P6e794064` is `62040`; the walk to `P72ccec8b` takes `78` seconds. Earliest permissible boarding is `62238`, so tram departure `62220` is 18 seconds too early.
- Mistake: Should have selected the later feasible tram, `R3a0dccd4+54` at `62520`, arriving `63480`, as the passing code-mode run did.

**Code mode: passed.** Passed with bus `R76d2117b+4` and tram `R3a0dccd4+54`, arriving `63480`. It correctly rejected the earlier tram used by tool mode. ($0.84, 35 requests, 16.7 min)
- Right: Read the complete walking rules and calculated the `78`-second transfer walk.
- Right: Routing converged with no improvements in round 5; an independent Dijkstra search also returned `63480`.
- Right: Submitted boarding times `61560` and `62520` and verified the SVG's run and platform identifiers.
- Mistake: Reparsing data into large dictionaries exceeded `268435456` bytes and reset the sandbox; it recovered with lighter structures.
- Mistake: The first SVG-writing attempt referenced `pathlib` without importing it after the reset.
- Mistake: Generated a `144552`-character SVG with extensive background detail for a two-leg journey.

### after_midnight

**Tool calling: failed.** Returned a three-vehicle journey arriving at `5460`, but its final transfer is infeasible. The run failed despite correctly handling previous-day services. ($0.85, 36 requests, 16.5 min)
- Right: Used `run_sql` to expand repeats, interpolate untimed calls and subtract `86400` from Friday-service times.
- Right: Wrote `/out/journey.svg` with the three `data-run` identifiers and six boarding/alighting platforms.
- Mistake: At the initial `read_text` calls, read only through the first journey rule and missed the remaining restrictions.
- Mistake: In the routing rounds, used `ci.a_dep >= f.best` with station-level labels, omitting platform walking and the `120`-second transfer margin. From `P6601f03b` at `4980` to `P0a9e487a` requires `126` seconds walking: boarding must be at least `5226`, so `R181e1950` at `5130` is impossible.
- Mistake: Also allowed access letters with `IN ('Y','R')`; only `Y` is permitted. The chosen calls were `YY`, so this was not the immediate failure.

**Code mode: passed.** Passed with `R93fefd15` and `R900bf42f+2`, departing `5280` and arriving `6420`. It recovered from a memory reset and an incomplete search graph. ($1.20, 40 requests, 20.3 min)
- Right: Read the full dictionary and handled Friday-service times relative to Saturday.
- Right: Explicitly verified `5492 + 120 + 76 = 5688 <= 5700` for the Südhöhe transfer.
- Right: An independent fixpoint calculation also returned earliest arrival `6420`.
- Mistake: Early date parsing raised both a string-arithmetic `TypeError` and `int('2026-338')` failure.
- Mistake: Materializing too much timetable state exceeded the `268435456`-byte sandbox limit and reset the session.
- Mistake: An incomplete platform universe yielded `NO JOURNEY FOUND`; expanding it from `221` platforms to the boarding/alighting universe recovered the valid route.

### arrive_by

**Tool calling: passed.** Passed with departure `63360` and arrival `64440`, using `R1aabe4da+29` and `Rfd6f9e2d+67`. Completion required 56 requests. ($0.91, 56 requests, 12.6 min)
- Right: Built platform walking tables and enforced `120 + walk` for transfers.
- Right: Checked later departures and additional vehicle combinations before submitting the two-leg journey.
- Right: Verified raw calls, repeat offsets and SVG coordinates.
- Mistake: During repeat expansion, attempted to concatenate a `VARCHAR` with a `BIGINT[]`, then used invalid `CROSS JOIN repeats e ON ...` syntax.
- Mistake: Repeatedly referenced unavailable aliases or columns, including `base_ref`, `line`, `a_dep`, `alightA` and `depB`. These were repaired, but consumed substantial requests.

**Code mode: passed.** Passed with the same two-leg `63360 → 64440` journey as tool mode. It took 52 requests, including recovery from a memory reset. ($0.98, 52 requests, 14.9 min)
- Right: Used `run_sql` for initial data inspection, then compact indexed arrays and chunked routing calculations.
- Right: Considered walk-first departures and additional vehicle rounds.
- Right: Verified selected raw calls and repaired missing transfer-platform markers in the SVG.
- Mistake: Initial interpolation attempted arithmetic with a `None` arrival value.
- Mistake: Large Python structures exceeded the `256 MiB` memory limit; rebuilding then encountered unsupported `yield` and `del` syntax.
- Mistake: The first reconstruction failed with `min() iterable argument is empty`; subsequent calls corrected its round indexing.
- Mistake: Several late requests revised SVG labels and markers after routing was complete.

### departure_profile

**Tool calling: passed.** Passed with 12 nondominated journeys, from `25327 → 27420` through `28620 → 30780`. It completed in 68 requests after repairing its dynamic-programming calculations. ($2.06, 68 requests, 23.4 min)
- Right: Included initial/final walks and transfer margins, and compared candidates against departures outside the requested interval.
- Right: Extended the calculation until `v8_improves = 0`.
- Right: Final dominance checks returned zero later departures with no-worse arrival and zero same-departure improvements.
- Mistake: The initial value tables admitted arrival values before boarding: the diagnostic reported `14108` violations in `v1`. It rebuilt the downstream-call window using `ROWS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING` and corrected subsequent tables.
- Mistake: Several `run_sql` calls contained nonexistent references such as `negdep_dummy` and `w1.val`.
- Mistake: After reconstructing the requested journeys, investigated an unrelated early-morning three-leg example, spending additional requests.

**Code mode: error.** Computed and verified the same 12 journeys as the passing tool-mode run and wrote the SVG, but never called `final_result`. It failed at the 80-request limit. ($3.03, 80 requests, 31.9 min)
- Right: Independent interpolation checks detected one-second errors and prompted a rebuild using originally timed bracket calls.
- Right: Final checks covered `107` departure-window roots and `147` later roots with zero mismatches.
- Right: Wrote a `14792`-character SVG containing `24` `data-run` attributes.
- Mistake: Initial interpolation produced `25326` instead of `25327` for `R77afbc0f+4`; repairing this required rerunning the profile calculation.
- Mistake: An oversized brute-force verification call exceeded 30 seconds and reset the session, forcing another rebuild.
- Mistake: Repeated SVG construction failures included assigning `parts.append` to a variable in an environment that rejected that operation.
- Mistake: Used the last request to inspect the completed SVG instead of submitting the already assembled journeys.

### meeting_point

**Tool calling: failed.** Selected Pirnaischer Platz, `S11373b25`, at `33600`, but both submitted journeys contain invalid transfers. The run failed. ($0.89, 42 requests, 15.3 min)
- Right: Expanded Saturday services and repeats, interpolated calls, and compared meeting times using `greatest(ta,tb)`.
- Right: Queried the actual transfer-platform distances before producing the SVG.
- Mistake: After incomplete `DATA.md` reads, the routing updates used `l.dep >= b.t`, treating transfers within a station as instantaneous.
- Mistake: The first passenger's transfer has `177` seconds available, but needs `120 + 64 = 184`; the second has `76`, but needs `120 + 49 = 169`. The later distance query exposed these distances, but the agent never applied the required margin.
- Mistake: Should have retained platform-level arrival states and recomputed feasible meeting journeys; the passing code-mode run meets at Albertplatz at `33701`.

**Code mode: passed.** Passed by selecting Albertplatz, `Sbb9212fa`, at `33701`. Each passenger takes one vehicle, arriving at `33701` and `33692`. ($1.10, 38 requests, 20.6 min)
- Right: Computed platform-level arrivals with walking and transfer restrictions.
- Right: Cross-checked the search with targeted brute force and a separate connection-scan implementation.
- Right: Submitted `Rc0124950` from `33300` and `Rfa439a34` from `32460`, with the required SVG.
- Mistake: The first reconstruction contained literal placeholder code, `if D(P, p0) ...`, causing a syntax error.
- Mistake: Subsequent calls referenced `MEET` and `show` before defining them.
- Mistake: A late raw-call audit indexed beyond the stored tuple length. All these errors were repaired.

### timed_tour

**Tool calling: error.** Reached the 80-request limit without submitting an answer or SVG. It had calculated provisional tour segments but was still auditing timetable interpolation. ($2.38, 80 requests, 25.4 min)
- Right: Read the complete rules and represented walking, transfer margins and visit waiting times in SQL.
- Right: Produced segment results including `A1 = 34440`, `A2 = 37080`, `A3 = 39480`, `A4 = 42300` and return segment `A5 = 44160`.
- Mistake: Spent many requests exploring individual lines and manually executing routing rounds for separate tour orders.
- Mistake: Repeated invalid SQL included unquoted `at`, `calls_raw USING (...)`, an undefined `w4h_w`, and nested window functions.
- Mistake: The final calls were still inspecting `R2d3055ed+14` interpolation. It needed a bounded search and reconstruction workflow that reserved requests for validating and submitting the complete tour.

**Code mode: failed.** Submitted a six-leg tour returning at `48960`, but failed the benchmark. Its search contains a concrete heap-ordering bug that invalidates its optimality checks. ($3.06, 62 requests, 36.6 min)
- Right: Represented opening times and `900`-second stays, and subtracted outgoing walks from visit departures.
- Right: Verified the submitted timetable calls and produced a six-leg SVG.
- Right: Its feasibility validator checked that the required stay interval fits within each opening window.
- Mistake: In `HPop`, called `last = heap.pop()` but compared children against the old root before installing `last`. For priorities `[1,2,3]`, this leaves `[3,2]`, violating the heap invariant.
- Mistake: Routing stopped when `HEAP[0][0] >= best_end`, which is unsafe with that broken heap. The cross-check `wbud3` reused `HPop`, so matching `48960` did not independently establish optimality.
- Mistake: Should have replaced the root with `last` before sifting, tested heap ordering, and rerun the search. The recorded results do not establish the correct optimum.
- Mistake: Also spent requests benchmarking millions of loop iterations and repairing placeholder syntax and undefined variables.

### tour

**Tool calling: error.** Found a candidate return time of `50012` but exhausted 80 requests while reconstructing the route. No final answer or SVG was submitted. ($2.88, 80 requests, 29.8 min)
- Right: Represented visited stations with a bitmask and distinguished `900`-second visits from `120`-second transfers.
- Right: A later queue-based search reached `queue_n = 0`, with `288163` labels and best return `50012`.
- Mistake: Numerous setup and search calls contained placeholders or invalid references, including `INSERT INTO kchain0...`, `ANY(...)`, `candidcf` and `calls2`.
- Mistake: An initial recursive reconstruction produced duplicated branches; the agent restarted the search and then reconstructed predecessors through separate queries.
- Mistake: At the cutoff it was still following `oldlab` predecessors, ending with `Pa1c903d9`, mask `6`, time `42164`. It should have stored an unambiguous predecessor chain and reconstructed it in a bounded operation.

**Code mode: error.** The run timed out after `2400` seconds and 56 requests, with no final output. It had found and reconstructed a candidate returning at `50012`. ($3.05, 56 requests, 40.0 min)
- Right: Built a visited-station bitmask search with walking and visit-duration constraints.
- Right: A second search also reached best return `50012`.
- Right: Corrected its interpolation audit and independently confirmed five selected untimed calls.
- Mistake: The first reconstructed-route verification reported only four of five visits, prompting reconstruction repairs.
- Mistake: A later verification function searched backward from the run's end for the next timed call, producing false interpolation mismatches; the corrected `verify_interp2` found the expected values.
- Mistake: The final SQL cross-check still used incorrect repeat shifts: `R07ed193a+11` appeared at `36823` instead of `50012`, indicating `+11` rather than `+13200`. The run ended during further diagnostics, before SVG creation or `final_result`.
