---
title: "Qwen3.8 27B on Pydantic AI Transit Planner"
description: "Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 0%, code mode 0%; rank 29 of 32."
canonical: https://models.pydantic.dev/models/qwen3.8-27b/transit_planner/
---

# Qwen3.8 27B on Pydantic AI Transit Planner

> Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 0%, code mode 0%; rank 29 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/qwen3.8-27b/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/qwen3.8-27b.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time      |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | --------- |
| Tool calling | 0%    | 0 of 10      | $2.37 | 375      | 429        | 108.4 min |
| Code mode    | 0%    | 0 of 10      | $1.05 | 146      | 151        | 104.3 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`gateway/doubleword:Qwen/Qwen3.8-27B-FP8` passed **0/20** runs on `transit_planner 0.2`: **0/10 in each mode**. Seventeen runs returned structured answers; three ended without one. No run demonstrated a compliant journey SVG. These results do not support choosing it for autonomous timetable planning.

#### Where it does well

It sometimes completes substantial preparation: service filtering, repeat expansion, distance-based interpolation and platform walking joins. Tools-mode `meeting_point` checked `48428` interpolated calls for time inversions. Tools-mode `walking_change` used the correct `120 + walk` transfer constraint and found candidates arriving at `63480`. Code-mode `walking_change` implemented exact ceiling distances with `isqrt`.

These are partial capabilities, not successful end-to-end results.

#### Mistakes it makes

Ten of the 17 returned answers contained no vehicle legs anywhere. Several stopped immediately after preparation; code-mode `departure_profile` stopped after reading only `DATA.md`.

Executable-code reliability is poor: repeated unquoted `at`, missing semicolons, nonexistent files, undefined variables and literal placeholders. Repairs frequently introduce new errors. In code-mode `walking_change`, reusing `b` as both run ID and stop index collapsed `3973` runs into `497` dictionary entries. In `timed_tour`, reconstruction repeatedly followed the same alighting predecessor until memory exhaustion.

Specific-looking answers are also unreliable. Tools-mode `meeting_point` finalized while its SQL still reported no common station. Tools-mode `walking_change` returned arrival `93360` despite retrieving `63480`. Code-mode `one_vehicle` supplied unsupported identifiers such as `P_114` without a route query.

#### Tool calling compared with code mode

Tools mode used **375 requests and $2.3656**; code mode used **146 requests and $1.0501**—about **61% fewer requests and 56% lower cost**, with no improvement in pass rate.

Tools mode often stalls in SQL repair and repeated file reads. Code mode batches more preparation, but adds Python syntax errors, unsupported imports, state-reset mistakes and reconstruction bugs. Its lower cost partly reflects earlier termination, not demonstrated planning efficiency. Tools-mode `timed_tour` hit the provider output-token limit; code-mode `timed_tour` timed out after visible algorithmic failures.

## Runs

### one_vehicle

**Tool calling: failed.** Expanded the timetable and established that no run directly served both stations, but stopped before completing the permitted walking connections. Returned an empty answer after 56 requests. ($0.43, 56 requests, 27.3 min)
- Right: Loaded `163359` calls, selected Wednesday services and expanded `10180` run instances.
- Right: Checked direct station-to-station runs, then began constructing origin and destination walking candidates.
- Mistake: The `bfinal` interpolation expression used division without the required `floor`, allowing fractional times.
- Mistake: Walking distances used `ROUND(SQRT(d2))` followed by `r2 + 1` for non-squares; this can exceed the required `CEIL(SQRT(d2))` by one second.
- Mistake: After building seven origin and eight destination walking candidates, called `final_result` without joining them to single-vehicle journeys. No SVG was written.

**Code mode: failed.** Attempted table loading but performed no route query. Returned a specific single-vehicle journey with identifiers unsupported by the retrieved data. ($0.0071, 8 requests, 10 s)
- Right: Corrected the directory sort to use `key=lambda x: x.name`.
- Right: Eventually constructed SQL loads for the documented semicolon-separated `.txt` files.
- Mistake: Initially queried seven nonexistent `.csv` files, then submitted malformed Python containing `db =` and `run_sql(query: str = ...)`.
- Mistake: The last loading cell ended with undefined `done`; it also did not inspect individual SQL results.
- Mistake: Immediately afterward, supplied run `f3a4e1c2+3`, platforms `P_114` and `P_27`, and times `29885..31672` without querying any journey. It needed data-backed identifiers and times, plus the SVG.

### saturday_direct

**Tool calling: failed.** Prepared Saturday calls and cumulative distances, then returned an empty zero-time journey before performing routing. ($0.030, 15 requests, 43 s)
- Right: Selected `2072` Saturday base runs and `48428` associated calls.
- Right: Constructed cumulative distances from individually rounded-up stop-to-stop segments.
- Mistake: Two queries failed on unquoted `at` before the model corrected it to `"at"`.
- Mistake: Immediately after building `stops_s`, called `final_result`. It had not completed interpolation, expanded repeats, searched journeys or drawn the SVG.

**Code mode: failed.** Loaded tables and identified station platforms, but failed during service filtering. Returned a two-leg itinerary without having searched it. ($0.072, 12 requests, 1.7 min)
- Right: Verified all seven table counts and retrieved the actual Spenerstraße and destination platform IDs.
- Mistake: Applied `&` to `VARCHAR` service masks, then accessed `r['rows']` on an error response, producing `KeyError: rows`.
- Mistake: Later repairs referenced undefined `r2` and called nonexistent `async_blueprint()` instead of the defined `main()`.
- Mistake: Finalized with boarding platform `P962deec4` at `33300`, although the retrieved origin platforms were `P69f58a45`, `P7fa04a55`, `P8bf17a40` and `Pfbdc0d54`. Boarding elsewhere exactly at the start time leaves no time for a positive-length initial walk.
- Mistake: Neither retrieved the claimed legs nor wrote the SVG.

### one_change

**Tool calling: failed.** Created an empty SVG, encountered a table-loading error and returned an empty zero-time journey after 10 requests. ($0.0070, 10 requests, 10 s)
- Right: Read the complete dictionary and successfully inspected the `places.txt` schema.
- Mistake: The second tool call wrote only `<svg width="800" height="600"></svg>`, with no platform markers or vehicle lines.
- Mistake: Requested nonexistent `/data/schedules.txt` despite the documented file list.
- Mistake: Combined `CREATE TABLE` statements without semicolons. After repairing only the `places` load, finalized instead of searching journeys with at most two vehicles.

**Code mode: failed.** Read documentation and headers, struggled to invoke SQL, then returned an empty answer immediately after a successful SQL smoke test. ($0.031, 7 requests, 61 s)
- Right: Eventually demonstrated the correct invocation with `await run_sql(query="SELECT 1 AS x")`.
- Mistake: Tried nonexistent module `sql` and file `/data/calls.csv`.
- Mistake: Submitted prose and Markdown fences inside `run_code`, causing a syntax error.
- Mistake: After successfully calling `run_sql` directly, stopped instead of loading the timetable and searching up to two vehicles. No SVG was written.

### walking_change

**Tool calling: failed.** Found two-vehicle candidates arriving at `63480`, but returned a different three-vehicle itinerary arriving at `93360`. The SVG was an empty file. ($0.28, 46 requests, 5.2 min)
- Right: Built interpolated, repeated Friday calls and `15047` walking pairs.
- Right: Its transfer join required `f.dep_time >= a.t1 + 120 + w.wdist`.
- Right: The final candidate query found `R76d2117b+4` followed by `R3a0dccd4+54`, arriving at `63480`.
- Mistake: Restricted first vehicles to labels `61`, `62`, `63` and `333` without establishing that this preserved all eligible journeys.
- Mistake: At finalization, discarded the retrieved `63480` candidates and supplied unrelated runs beginning with `Rc3ae796c+20`, arriving `29880` seconds later. It should have reconstructed and validated the best retrieved candidate.
- Mistake: Called `write_file` three times with empty content for `/out/journey.svg`.

**Code mode: failed.** Loaded Friday services but corrupted the interpolated timetable through variable reuse. Returned an unsupported two-leg journey before running a route search. ($0.14, 25 requests, 26.7 min)
- Right: Identified eight Friday services and `3973` base runs, expanding to `10398` instances.
- Right: Implemented exact rounded-up integer distances using `isqrt` and checked the Python call coverage against SQL.
- Mistake: In interpolation, `for b in DAY_BASES` used `b` as the run ID, then reassigned `b = i+1` as a stop index. Consequently, `base_calls[b] = rec` overwrote entries under integer keys: only `497` entries remained instead of `3973`.
- Mistake: The subsequent SQL/Python checks exposed the discrepancy—SQL had `81040` active calls and Python confirmed all `3973` runs existed—but it finalized without repairing the dictionary or searching.
- Mistake: The final run name `R27fdc8d0+0` violated the naming convention: the base instance retains `R27fdc8d0`, while suffixes start at `+1`. No SVG was produced.

### after_midnight

**Tool calling: error.** Spent 80 requests loading and repairing SQL without completing a journey or SVG. The run ended at the request limit. ($0.19, 80 requests, 18.2 min)
- Right: Eventually considered both Friday service day `338` and Saturday `339`, with a `86400` adjustment for previous-day runs.
- Right: Built repeat instances and cumulative distances for interpolation.
- Mistake: Before reading `DATA.md`, queried nonexistent `/data/repeats.csv` with `|` separators; it should have used the documented `.txt` files and `;` separator.
- Mistake: Throughout preparation, repeatedly used unquoted `at`, nonexistent columns such as `r.run`, and incomplete SQL containing `...`, even after successful quoted-column queries.
- Mistake: Late requests repeatedly reread the first few lines of `places.txt` and issued queries such as `SELECT ULMRET.N, UPATHON FROM base_kalls`; these consumed the remaining budget without advancing routing.

**Code mode: failed.** Loaded and expanded overnight services, but the search failed on an unavailable import. Returned an empty journey at `370`, which was also the wrong start time. ($0.16, 15 requests, 4.2 min)
- Right: Recovered from service-parsing errors and considered both Friday and Saturday services.
- Right: Applied previous-day subtraction by `86400` and expanded repeats.
- Mistake: Set `T0 = 370` and filtered instances against `370`; `01:10` is `4200` seconds after midnight.
- Mistake: The interpolation loop used already-filled arrivals as subsequent anchors, rather than retaining the nearest originally timed calls, risking cumulative rounding errors.
- Mistake: The final search cell failed at `import heapq`. Instead of replacing the unavailable dependency, submitted `departure = arrival = 370` with no legs or SVG.

### arrive_by

**Tool calling: failed.** Read documentation and file samples, then returned an empty journey with departure and arrival both `0`. It never searched for the latest feasible departure. ($0.0063, 7 requests, 8 s)
- Right: Read the service-day, walking, transfer-margin and interpolation rules, plus `services.txt` and `service_changes.txt`.
- Mistake: The first two calls both used `list_files`, and later documentation reads overlapped.
- Mistake: After reading a sample of `repeats.txt`, called `final_result` without any `run_sql` call or timetable search. It needed to maximize departure within `59400..64800`, subject to arrival by `64800`, and write the SVG.

**Code mode: failed.** Successfully loaded relevant services, then discarded its state and failed repeatedly while rebuilding it. Returned an empty zero-time journey. ($0.16, 18 requests, 4.3 min)
- Right: Identified eight Thursday services, `3870` active base runs and `10183` expanded instances.
- Right: Checked that the minimum direct origin-to-destination distance was `3300` metres, ruling out a single permitted walk.
- Mistake: In the first interpolation build, `calls_exp` added arrival `a` to a value from `t_d` that was already a departure, doubling the arrival component.
- Mistake: Called `run_code` with `restart: true` while referring to `base_runs`, `calls_by_run` and `runs_exp`; the restart erased those variables.
- Mistake: Rebuilds used malformed `.split\n('')` and unpacked a rows-only return as `_, rows`, producing syntax and unpacking errors. It needed a consistent loader and a completed latest-departure search before finalization.

### departure_profile

**Tool calling: failed.** Loaded the tables but failed during type handling and returned one empty, zero-time journey. No departure profile or SVG was produced. ($0.16, 12 requests, 4.4 min)
- Right: Loaded all seven timetable files and retrieved the relevant station platforms.
- Mistake: After loading with `all_varchar=true`, applied `s.days & 2` without casting; `run_sql` returned a binder error.
- Mistake: The attempted typed reload used unquoted `at IS NULL`, causing another parser error. It then finalized without searching departures or applying the dominance rule.
- Mistake: Wrote unrelated `/out/cfg.json` containing `{"tool": "mcp"}` instead of `/out/journey.svg`.

**Code mode: failed.** Read only `DATA.md`, then returned `journeys: []` after two requests. No timetable search or SVG was attempted. ($0.033, 2 requests, 67 s)
- Right: Read the full dictionary before working with timetable data.
- Mistake: The second request called `final_result` without loading any timetable files. It needed to enumerate departures in `25200..28800` and compare them against potentially dominating journeys leaving at other times.

### meeting_point

**Tool calling: failed.** Built a substantial timetable and started a two-origin search, then submitted unsupported journeys and a meeting time. Its last SQL result still showed no common reachable station. ($0.26, 50 requests, 21.5 min)
- Right: Filtered five Saturday services, interpolated `48428` calls and checked that arrival times had no inversions.
- Right: Built `6330` platform pairs within `400` metres and included the `120`-second transfer margin in boarding conditions.
- Mistake: Preparation repeatedly failed on `int(...)`, unquoted `at`, missing aliases and placeholder SQL before recovering.
- Mistake: The walking transition preserved the same `F0` or `F1` state, allowing repeated walks; it needed a state that prevents chaining walks between vehicles.
- Mistake: Submitted `final_result` alongside an unfinished search query. That query returned `mb = null`, but the answer claimed a meeting at `32460` using unsupported identifiers such as `L136f8a` and `P1a2b3c`. It needed to finish the search and reconstruct actual legs.
- Mistake: Did not create the required SVG.

**Code mode: failed.** Reached service filtering but never computed reachability or a meeting point. Nevertheless, returned a specific station, time and partially empty journeys. ($0.19, 24 requests, 24.3 min)
- Right: Verified all `7548` call-run IDs existed and that stop positions had no duplicates.
- Right: Recovered handling for services present only in `service_changes.txt`, and eventually counted `2072` Saturday and `3973` Friday base runs.
- Mistake: Parsed day-of-year bounds with `[6:]`, dropping their first digit and producing zero active runs; later corrected this to `[5:]`.
- Mistake: The last code cell failed on undefined `rr2` in a diagnostic comprehension. No route search followed.
- Mistake: Then claimed meeting at `Sc921c3c6` at `35837`, with unsupported leg `R50b36f78+19` and an empty second journey. It needed to compute both arrival functions, minimize their maximum and reconstruct both journeys; no SVG was produced.

### timed_tour

**Tool calling: error.** Spent 79 requests preparing and inspecting timetable fragments without completing the timed round trip. The provider’s output-token limit ended the run before another response was generated. ($0.89, 79 requests, 28.4 min)
- Right: Expanded current- and previous-day services and eventually produced `79287` base calls with no missing interpolated times.
- Right: Retrieved platforms and services relevant to all four required visits.
- Mistake: Repeatedly requested nonexistent `/data/placeports.txt`, reread `service_changes.txt`, and submitted incomplete SQL such as `FROM reads...`.
- Mistake: Later queries failed on missing `FROM` clauses, nonexistent aliases and aggregate positions in `GROUP BY`, consuming requests without evaluating a complete visit order.
- Mistake: Wrote only a placeholder SVG; a subsequent write to `out/journey.svg` failed because the required path was `/out/journey.svg`.
- Mistake: Before the terminal provider error, had not produced a round trip enforcing all `900`-second visits and opening windows.

**Code mode: error.** Built a routing graph, but search and reconstruction bugs prevented completion. A reconstruction loop exhausted the sandbox’s 256 MiB memory limit; the run ultimately timed out after `2400` seconds. ($0.23, 29 requests, 40.0 min)
- Right: Built `9096` vehicle instances and platform walking adjacency.
- Right: Implemented replacement heap operations after discovering that `heapq` was unavailable.
- Mistake: The initial `leg_search` compared string platform IDs, `pls[j]`, with a set of integer indices, `G`, yielding `NO PATH` for all four destinations.
- Mistake: After fixing that comparison, reconstruction set `pidx = VPI[v2i][j2]`, returning to the same alighting platform whose predecessor had just been read. It repeatedly appended the same segment until `MemoryError`; reconstruction needed to follow the boarding predecessor through `info_r`.
- Mistake: The post-reset rebuild contained two consecutive `def dow_bit(d):` declarations without a body. No complete tour, opening-window validation or SVG followed.

### tour

**Tool calling: failed.** Loaded the data but never searched a tour. Returned `legs: []`, `visits: []` and arrival `0`. ($0.11, 20 requests, 2.5 min)
- Right: Verified table sizes and retrieved platforms for the origin and five required stations.
- Mistake: Initially used `read_csv(..., auto_detect=false)` without a column schema, then submitted SQL beginning with `KEYBOARD`.
- Mistake: The first `active_services` query used only `s.first < '2026-340'`, admitting all 18 services. Repairs failed on missing semicolons and nonexistent scalar function `bitand`; it should have used the weekday mask with `&` and complete date/exception filtering.
- Mistake: After several repeated dictionary reads, finalized without the five `900`-second visits, return journey or SVG.

**Code mode: failed.** Read documentation and small file samples, then returned a single unsupported 60-second leg with no visits. It never searched the required round trip. ($0.028, 6 requests, 42 s)
- Right: Recovered once from a malformed dictionary-read expression and inspected the available files.
- Mistake: Repeated the same invalid `print(open('/data/DATA.md').read())))` expression after previously fixing it.
- Mistake: Finalized with `R129b49ba` from `36120` to `36180` without loading calls or searching routes.
- Mistake: Returned `visits: []`, omitting all five required `900`-second stays and the return to Hauptbahnhof, and produced no SVG.
