---
title: "Claude Haiku 5.5 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 80%; rank 15 of 32."
canonical: https://models.pydantic.dev/models/claude-haiku-5.5/transit_planner/
---

# Claude Haiku 5.5 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 80%; rank 15 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/claude-haiku-5.5/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/claude-haiku-5.5.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 80%   | 8 of 10      | $0.29 | 287      | 315        | 27.0 min |
| Code mode    | 80%   | 8 of 10      | $0.37 | 198      | 188        | 30.2 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`claude-haiku-5-5` passed 16 of 20 runs: 8/10 with tool calling and 8/10 in code mode. Both modes failed `tour`. Tools also failed `after_midnight`, and code mode failed `one_change`. Totals were 287 requests and $0.29 for tools, against 198 requests and $0.37 for code mode. `tour` alone accounts for $0.19 of the code-mode total.

#### Where it does well

- **Timetable rules.** Every run read `DATA.md` first, and nearly all then expanded repeats into `<run>+<k>`, interpolated untimed calls by distance, and applied the 400 m walks and the 120 s change margin.
- **Simple and medium questions.** `saturday_direct`, `one_vehicle`, `walking_change`, `arrive_by`, `meeting_point`, `departure_profile` and `timed_tour` passed in both modes, with identical arrival times.
- **Checking.** It usually re-read the chosen runs' calls before answering.
- **Drawing.** No failure traces to the SVG.

#### Mistakes it makes

- **Search modelling on the hard case (`tour`, both modes).** Tools returned 49843 and code mode 50012. Each search left out legal moves: tools allowed no walk out of a station after a visit, and code mode forced a 900 s visit on first arrival.
- **Service-day handling (`after_midnight`, tools).** Each run got one shift of `0` or `-86400`, so Friday runs of services that also run on Saturday were dropped. The result was 8400 against code mode's 6420.
- **Time conversion (`one_change`, code mode).** It used `27000` for 07:40 instead of 27600 and boarded at 27037, before the start.
- **Lucky passes.** `walking_change` (tools) dropped untimed calls, `timed_tour` (tools) hand-picked one visiting order, and `saturday_direct` (tools) ignored `service_changes`.
- **Repeated SQL slips.** Most tools runs used the reserved word `at` as an alias or did arithmetic on `all_varchar` columns, costing 2 to 6 requests each. In code mode it kept reaching for `heapq`, `time.time` and `del`, which the sandbox lacks.
- **No plausibility check.** It accepted a 4-vehicle, 70-minute trip for about 2 km, and a departure before the stated start.

#### Tool calling compared with code mode

Pass rates are equal, but the failures differ. Code mode needed fewer requests on 9 of 10 cases (for example `arrive_by` 9 against 26, `meeting_point` 13 against 34). Its in-memory Dijkstra handled two service days correctly where the SQL version did not. Its weakness is the sandbox limits (30 s, 256 MB): `tour` used 60 requests, about half of them slicing a search that never finished. Tool calling is steadier in cost ($0.013 to $0.061 per case) but iterates fixpoints by resending the same SQL. Excluding `tour`, code mode cost $0.17 against $0.23 for tools.

## Runs

### one_vehicle

**Tool calling: passed.** Found bus run `R27f8d4b1+2` from `P0091960a` (a 399 m walk from Lennéplatz) at 29940 to TU at 30480. Passed. ($0.018, 22 requests, 1.6 min)
- Right: Considered boarding at platforms within 400 m of the origin, not only the origin's own platforms.
- Right: Rebuilt the timetable with interpolation (`cc`, `ft`, `allft`) after a first pass over timed calls only.
- Mistake: The first table `ec` (message 7) kept only timed calls, and that work was redone from message 25.
- Mistake: Reported `departure` as 29799 (start plus walk) where code mode reported 29400. Both passed, so the field looks loosely checked.
- Mistake: Wrote the SVG twice. 22 requests for a single-leg answer.

**Code mode: passed.** Narrowed to candidate runs in SQL, fetched their calls and scored them in Python, answering `R27f8d4b1+2` from `P0091960a` at 29940 to 30480. Passed. ($0.015, 17 requests, 69 s)
- Right: Used platform sets within 400 m of both stations (`Ns`, `Nt`) to find candidate runs.
- Right: Same leg as the tools run.
- Mistake: 17 requests for one leg, with repeated exploratory queries (messages 7 to 21) including one that only re-parsed `cands`.
- Mistake: Hard-coded platform coordinates into the Python (`L=[(12446,8649),...]`).
- Mistake: The SVG label said 'board 08:39' and was patched to 08:19 afterwards (message 31).

### saturday_direct

**Tool calling: passed.** Ran one- and two-vehicle expansions in SQL, found that direct tram `Rb28d92d7` arriving 34560 was best, and drew it as a polyline through its stops. Passed. ($0.013, 19 requests, 80 s)
- Right: Checked that a second vehicle or a final walk could not beat the direct arrival (messages 27, 29).
- Right: Drew the leg through every intermediate stop.
- Mistake: The `act` table (message 7) ignored `service_changes`. This was harmless only because the two changes are on days 325 and 326.
- Mistake: Parser errors on `at` (12) and `bY` (18) as aliases, and a binder error (26).

**Code mode: passed.** Built the timetable in SQL from a Python loop, ran up to six label rounds and answered the direct tram `Rb28d92d7` arriving 34560. Passed. ($0.014, 13 requests, 90 s)
- Right: No execution errors seen across 13 requests.
- Right: Handled `service_changes` in `act`, which the tools run skipped.
- Right: Drew the leg as a polyline through the run's stops.
- Mistake: Ran `for k in range(1,7)` rounds for a question a direct ride answers. Harmless but more work than needed.

### one_change

**Tool calling: passed.** Joined rides to rides through a walk table with the correct start `27600` and answered depart 27669, arrive 28440. Passed. ($0.013, 18 requests, 82 s)
- Right: Converted 07:40 to `27600` correctly (`l1.dep>=27600+o.w0`), which the code-mode run got wrong.
- Right: One self-join query (message 23) solved the at-most-2-vehicles case directly. Cheapest tools pass after `saturday_direct` at $0.0134.
- Mistake: Wrote `/out/journey.svg` three times (messages 29, 31, 33).
- Mistake: Two `at IS NULL` parser errors (10, 14) and one multi-statement parser error (6).

**Code mode: failed.** Built rides and walks in SQL from Python and queried one- and two-vehicle options, answering depart 27037, arrive 27756. It failed: that leaves before the 07:40 start. ($0.019, 17 requests, 1.9 min)
- Right: The join itself was sound: `r2.bdep>=r1.aarr+120+w.w AND r2.rid<>r1.rid`, with start and end walk tables `sp` and `ep`.
- Right: Interpolated untimed calls and expanded repeats.
- Mistake: Message 25 used `r1.bdep>=27000+sp.ws`. 07:40 is 27600 s; 27000 is 07:30. The first leg `R83ccf05c+2` boards at 27037 (07:30:37), nine minutes before the passenger starts. It should have filtered on `27600`, which gives the tools answer 27669 to 28440.
- Mistake: Never compared `board_time` 27037 with the start time, though the SVG title it wrote says 'dep 27037'.
- Mistake: Errors: `import duckdb` (6), `days & 8` on VARCHAR (10), `VARCHAR + BIGINT` (14), `at` as an alias (16), a missing column `arr` (20), `Path` undefined (30).

### walking_change

**Tool calling: passed.** Ran a three-round ready/arrive expansion in SQL and answered `R76d2117b+4` then `R3a0dccd4+54` with a 78 m walk at Pirnaischer Platz, arriving 63480. Passed. ($0.018, 30 requests, 1.7 min)
- Right: Found the change that needs a walk between `P6e794064` and `P72ccec8b`.
- Right: Traced how `P72ccec8b` became ready at 62238 before trusting the result.
- Mistake: Table `tc` (message 15) kept only calls with `"at" IS NOT NULL AND "at"<>''`. Untimed calls were dropped and never interpolated. The pass was lucky because the answer's four calls are timed.
- Mistake: About ten single-row debugging probes (messages 37 to 55). 30 requests for a 2-leg answer.

**Code mode: passed.** Not reviewed. ($0.013, 14 requests, 1.5 min)

### after_midnight

**Tool calling: failed.** Built a round-based earliest-arrival search in SQL and answered a 4-leg journey arriving 8400. It failed: code mode found a 2-leg journey arriving 6420. ($0.032, 38 requests, 2.7 min)
- Right: Recognised that runs of the previous service day (2026-338) matter and built `act338` alongside `act`.
- Right: Interpolated untimed calls with `dep_a`/`s_a`/`arr_b`/`s_b` window columns, and applied the 120 s plus walk change margin.
- Right: Re-read the chosen legs from `ic` and the walks from `W` before answering.
- Mistake: In the `inst` table (message 31) each run got a single shift: `CASE WHEN svc IN (SELECT svc FROM act) THEN 0 ELSE -86400 END`. A service that runs on both Friday and Saturday therefore only kept its Saturday copy, so its Friday runs past midnight were lost. The code-mode answer uses exactly such runs (`R93fefd15@338`, `R900bf42f+2@338`). It should have emitted one instance per active service day (a UNION of the 338 and 339 copies).
- Mistake: Did not question a 4-vehicle, 70-minute result for a trip of about 2 km (rounds 1 to 5, messages 41 to 56).
- Mistake: Lost about 8 requests to SQL errors: `at` used as an alias (message 9), a `VARCHAR + INTEGER` binder error twice (13, 19), `Table c1 already exists` (17), then one-statement probes of `c2`/`c3`.
- Mistake: Wrote `/out/journey.svg` twice.

**Code mode: passed.** Loaded the files in Python, built instances for both service days and ran a label-setting search, answering two legs arriving 6420. Passed. ($0.012, 11 requests, 88 s)
- Right: Created one instance per active day with `shift = -86400 if D=='2026-338' else 0`. The winning runs are the day-338 copies `R93fefd15` and `R900bf42f+2`.
- Right: 11 requests and $0.0125, the cheapest case in the benchmark.
- Mistake: `import heapq` failed (message 8) and it switched to `bisect`.
- Mistake: The SVG labels were first written with wrong clock times (05:28 for 01:28) and patched afterwards with `str.replace` (message 19).

### arrive_by

**Tool calling: passed.** Ran a backward latest-departure search in SQL (table `D`, re-created five times) and answered depart 63360, arrive 64440 with two legs. Passed. ($0.026, 26 requests, 2.3 min)
- Right: Modelled the problem backwards from the 64800 deadline with `MAX(d.D - 120 - w.w)`.
- Right: Checked the two chosen runs `R1aabe4da+29` and `Rfd6f9e2d+67` call by call before answering.
- Mistake: The fixpoint was iterated by hand: the same `CREATE OR REPLACE TABLE D` statement was resent in messages 19 to 27.
- Mistake: Three avoidable SQL errors: `at` as an alias (10), `VARCHAR - VARCHAR` on uncast coordinates (12), and a missing `name` column on `pl` (32). 26 requests for a 2-leg answer.

**Code mode: passed.** Ran a backward search in Python over the window between the earliest start and the deadline, then tightened the transfer, giving the same answer as tools (63360 to 64440). Passed. ($0.017, 9 requests, 2.0 min)
- Right: 9 requests with no errors seen, against 26 in tools.
- Right: Rechecked the second leg `Rfd6f9e2d+67` at `P6ea0167f` 64260 before answering.
- Mistake: Needed a separate 'earliest-arrival tweak' step (message 11) to pick the transfer after the latest-departure search.

### departure_profile

**Tool calling: passed.** Built per-departure label tables `S1` to `S4` in SQL, filtered dominated journeys and listed the profile from 25327 onwards. Passed. ($0.038, 35 requests, 3.6 min)
- Right: Computed `leave` as first boarding minus the origin walk, as the question defines it.
- Right: Extended to 3 and 4 vehicles (`S3`, `S4`) and checked with a count that nothing beat the 2-vehicle bests.
- Right: Applied the domination filter against journeys leaving at any time, not only inside the window.
- Mistake: 35 requests. Multi-statement queries returned only the last result, so the counts were re-asked one at a time (messages 5 to 13).
- Mistake: Errors: `Subquery returns 4 columns` (4), `at` as an alias (18, 46), `Table L2 already exists` (42).

**Code mode: passed.** Ran an earliest-arrival search per candidate departure in Python, in batches of 30 to 40, and returned 12 journeys from 25327 to 28620. Passed. ($0.034, 25 requests, 3.4 min)
- Right: Wrote its own heap (`hpush`/`hpop`) when `heapq` was missing.
- Right: Also evaluated the next departure after each one in the window (`nxt`), which the domination rule needs.
- Mistake: Seven failed executions: curly quotes in the code (12), `heapq` (14), a missing service key (16), a 268 MB `MemoryError` (18), two type-check errors after the session reset (20, 22), and `time.time` (32).
- Mistake: A pointless probe `import heapq_dummy if False else None` (25) and `Path` not imported (46). 25 requests.

### meeting_point

**Tool calling: passed.** Ran two earliest-arrival expansions in SQL (`RD1`/`VA1` and `RD2`/`VA2`), took the station with the smallest later arrival and answered Albertplatz `Sbb9212fa` at 33701. Passed. ($0.030, 34 requests, 2.8 min)
- Right: Handled `service_changes` with both `+` and `-` in the active-service query.
- Right: Sanity-checked `BT` for null and backwards times before searching.
- Right: Verified both friends' rides and the 353 m origin walk to `P3035f403`.
- Mistake: Three consecutive parser errors on reserved words (`at`, then `"at" AS INT) at`, then `days`) in messages 8 to 12.
- Mistake: Each expansion round was resent by hand (messages 29 to 47): 34 requests in total.

**Code mode: passed.** Ran a Python Dijkstra from each origin over both service days and picked the station with the smallest later arrival, Albertplatz at 33701. Passed. ($0.019, 13 requests, 2.3 min)
- Right: 13 requests against 34 in tools, for the same station and time.
- Right: Rewrote `dijkstra` as `dijkstra2` with per-platform arrival tracking so the legs could be rebuilt.
- Mistake: Friend one boards `Rc0124950` at `Pda4a5390` at 33300, where the tools run boarded the same run one stop earlier at `P3035f403` at 33180. Both passed.
- Mistake: The first `svc_day` used day numbers `338, 339` and had to be redone with `2026338, 2026339` (messages 7, 9).

### timed_tour

**Tool calling: passed.** Fixed the visiting order Prohlis, TU, Pohlandplatz, Mickten and chained station-to-station earliest arrivals by hand, answering return at 44160. Passed. ($0.042, 27 requests, 4.0 min)
- Right: Respected the opening windows and the 15-minute stays (visits 34440-35340, 37080-37980, 39480-40380, 42300-43200).
- Right: Got the same legs and arrival as the code-mode search.
- Mistake: Did not enumerate orders. `rdy` was rebuilt for hand-picked start times (32400, 39600, 37800, 35340, 40380, 43200, 37980 in messages 27 to 39), so optimality rests on the windows forcing the order. The pass was partly lucky.
- Mistake: Errors on `VARCHAR + INTEGER` (14), `at IS` (16) and `at` as an alias (42).

**Code mode: passed.** Ran a time-bucketed search in Python over (platform, visited mask) with the opening windows in `TGT`, and answered return at 44160. Passed. ($0.029, 19 requests, 4.2 min)
- Right: A real search over all visiting orders, where the tools run fixed one order by hand.
- Right: After a 30 s timeout it rebuilt the state and processed in slices (`process(40000)`, then onwards).
- Mistake: `process(50000)` hit the 30 s limit and reset the session (message 22). The rebuild then failed a type check (24).
- Mistake: A stray `import subprocess` raised an error in the first data peek (message 4).

### tour

**Tool calling: failed.** Ran an 11-round label search over (visited mask, platform) in SQL and answered an 11-leg tour back at 49843. It failed. ($0.061, 38 requests, 5.5 min)
- Right: State was (visited mask, platform) with the earliest `ready` kept per state, and it pruned on the incumbent (`ready < 50580`, then `50012`, then `49843`).
- Right: Reconstructed the chain with a recursive CTE over `lab.par` and rechecked all 11 legs in `trips`.
- Right: Reached 49843, better than the 50012 code mode returned.
- Mistake: The move set in `cand` (message 41) is restricted. A visit is only credited on alighting (`A JOIN WS`), and after the 900 s stay the passenger is placed only on that station's own platforms (`plats p ON p.st=TG.Y`). No walk to a nearby platform of another station is allowed before the next boarding. Tours using such a walk are never generated, and this is the most likely reason the result was not accepted. The grader's expected value is not shown.
- Mistake: Each round was a resent 1 kB statement (messages 37 to 63). `cb` grew to 17.9 million rows and the run used all 38 requests at $0.0606, the dearest tools case.
- Mistake: A bogus expression `A.mask | (1<<0) * 0 + 0` in the first `cand` (37) had to be rewritten. Other errors: `sum(VARCHAR)` (8), `at IS` (16), `at` as an alias (18), `VARCHAR - VARCHAR` (20), `p.ref` on `plats` (70).

**Code mode: failed.** Tried a Python Dijkstra over (platform, mask), abandoned it after about 30 slices, then redid the search as SQL rounds and answered a 9-leg tour back at 50012. It failed, and is 169 s worse than the tools answer of 49843. ($0.19, 60 requests, 10.7 min)
- Right: Recovered from a `MemoryError` by cutting the instance days from five to three.
- Right: Added superset-mask dominance (`SUP`) to prune labels.
- Mistake: Messages 33 to 90: about 30 `run_chunk(300000)`/`run_chunk(450000)` calls moved the frontier only from 36900 to 42672 with no incumbent. It rewrote the loop four times (`run_chunk2` to `run_chunk5`) before giving up. That used roughly half of the 60 requests.
- Mistake: The SQL replacement (message 105) forces a visit: at an unvisited required station `v=1` and the label waits `ta + 900 + nb.w`, with no option to change there in 120 s and visit later. A visit is also only credited when alighting at one of the station's own platforms (`pl.st` of the alight platform), not after a walk in. Both rules exclude valid tours. It should have kept both the visit and the pass-through label, as the tools run did.
- Mistake: Accepted 50012 as soon as the rounds emptied, with no cross-check.
- Mistake: Other errors: `time.time` unsupported (8), a missing service key (12), `del` unsupported (26), a 30 s timeout with session reset (28), type errors (20, 30), `at` and `bY` as column names (92, 94). 60 requests and $0.1937, more than half the code-mode total.
