---
title: "Muse Spark Open on Pydantic AI Transit Planner"
description: "Journey planning over a real Dresden public transport timetable, with an SVG map of each answer. Tool calling 20%, code mode 70%; rank 27 of 32."
canonical: https://models.pydantic.dev/models/muse-spark-open/transit_planner/
---

# Muse Spark Open on Pydantic AI Transit Planner

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

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 20%   | 2 of 10      | $6.03 | 774      | 804        | 36.2 min |
| Code mode    | 70%   | 7 of 10      | $6.69 | 432      | 424        | 57.3 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

The model passed **9/20 runs**: **2/10 with tools** and **7/10 in code mode**. Ten failures exhausted the 80-request budget; the remaining failure, code-mode `timed_tour`, exhausted tool retries. No recorded failure was a provider outage.

Completion reliability is the main concern. Several failed runs already contained useful routes, but never delivered the required structured answer and SVG.

#### Where it does well

Successful runs handle substantial timetable detail: service calendars, repeated run identifiers, distance-based interpolation, initial walks, and the 120-second transfer margin. Code mode solves the midnight journey, latest-departure journey, 12-journey departure profile, and two-origin meeting problem.

Both modes select the same vehicle legs in their two shared successes. Code-mode `meeting_point` finds Albertplatz at `33701`; `departure_profile` checks departures beyond the requested window before retaining its 12 journeys.

#### Mistakes it makes

Normal tool calling repeatedly spends requests on counts, individual platform lookups, and multi-statement SQL whose earlier results are not returned. Unquoted `at` repeatedly causes parser errors. `arrive_by`, `one_change`, and `meeting_point` find the eventual successful answers but fail to deliver them.

Code mode introduces unsupported imports and functions, oversized intermediate data, sandbox execution limits, and reconstruction errors. `timed_tour` additionally encodes 10:45 as `39600` instead of `38700`. Its provisional result is therefore not a verified solution.

Output handling can fail independently of planning: `walking_change` writes its SVG, receives a JSON validation error, then spends dozens of calls printing intentions to submit.

#### Tool calling compared with code mode

Code mode reduces total model requests from **774 to 432**, while increasing observed total cost from **$6.0342 to $6.6938**. These totals include failed runs. Python loops and compact connection representations help complete searches that tool mode leaves unfinished, but bulk SQL pagination can exhaust sandbox interaction limits.

For this benchmark, code mode is clearly stronger, though neither mode completes either tour case. Engineers should prioritize bounded searches, compact path storage, and reliable final-result submission.

## Runs

### one_vehicle

**Tool calling: passed.** Passed in 79 requests with a 399-second initial walk and bus `R27f8d4b1+2`, boarding at `29940` and arriving at `30480`. Wrote the required SVG and submitted departure `29541`. ($0.56, 79 requests, 3.0 min)
- Right: Allowed walking before the single vehicle and correctly used `29940 - 399 = 29541` for setting off.
- Right: Expanded the repeat by `2400` seconds and marked the boarding and alighting platforms in the SVG.
- Mistake: Late interpolation queries twice failed on unquoted `at`; another failed on unquoted `offset`.
- Mistake: Repeatedly inspected individual runs, repeat rows, interpolation calculations, and coordinates. Finishing at request 79 left almost no margin for another error.

**Code mode: passed.** Passed in 25 requests with the same bus as tool mode: `R27f8d4b1+2`, boarding at `29940` and arriving at `30480`. Submitted departure `29940` and wrote the SVG. ($0.38, 25 requests, 2.1 min)
- Right: Found the initial walk to Strehlener Platz and preserved the one-vehicle restriction.
- Right: Verified the SVG’s required `data-place` and `data-run` attributes.
- Mistake: During loading, imported unavailable `subprocess` and indexed repeat rows with `row['ref']` instead of `row['run']`.
- Mistake: After creating the SVG, repeatedly reread and inspected it over several cells.
- Mistake: The accepted departure field was the vehicle boarding time, whereas tool mode reported setting off at `29940 - 399 = 29541`; the two outputs therefore differ despite both passing.

### saturday_direct

**Tool calling: passed.** Passed in 55 requests with `Rb28d92d7`, from `P7fa04a55` at `33484` to `P1093f876` at `34560`, and wrote the SVG. ($0.44, 55 requests, 1.6 min)
- Right: Handled Saturday services and the interpolated boarding time.
- Right: Searched for a faster one-transfer alternative; that query returned no rows.
- Right: Used `east/35.0` and `600-north/35.0` for plotting coordinates.
- Mistake: Initial CSV loading disabled autodetection without supplying columns.
- Mistake: Setup queries failed on unquoted `offset` and twice on unquoted `at`; repeated exploration made a direct journey require 55 requests.

**Code mode: passed.** Passed in 38 requests with `Rb28d92d7`, `33484 → 34560`, and the SVG. ($0.47, 38 requests, 3.3 min)
- Right: Expanded Saturday services, interpolated the boarding call, and checked alternative journeys.
- Right: Recovered from sandbox errors and submitted the exact boarding and alighting platforms.
- Mistake: Some early `await run_sql(...)` cells did not print returned data, leading to additional retrieval calls.
- Mistake: Bulk pagination exceeded a tool-call limit; the error reported 100 calls already executed.
- Mistake: Later cells tried unavailable `heapq` and `globals()`. The first SVG-writing cell contained the invalid Python fragment `origin_station=S65a2d7d7? actually ...`, requiring a corrected retry.

### one_change

**Tool calling: error.** Found the successful two-vehicle journey arriving at `28440`, but used all 80 requests on computation and verification. No final answer or SVG was produced. ($0.53, 80 requests, 58 s)
- Right: The two-leg query found `Rafeef850`, `27669 → 27960`, then `R620ec7d9`, `28200 → 28440`.
- Right: Included the 72-second walk between `P66c27b1c` and `P3b6efaff`, plus the 120-second transfer margin.
- Mistake: Messages 111–128 repeatedly counted overlapping subsets of the same timetable, including repeated multi-statement queries whose earlier results were not returned.
- Mistake: After finding the route in message 140, spent the remaining calls inspecting platforms, lines, and departures individually.
- Mistake: Should have fetched all required coordinates in one query and completed `write_file` and the final result.

**Code mode: passed.** Passed in 57 requests with `Rafeef850` and `R620ec7d9`, arriving at `28440`, plus the SVG. ($0.71, 57 requests, 5.9 min)
- Right: Called `run_sql` from Python to compute interpolated and repeated services.
- Right: Returned the correct four platforms, including the 72-second transfer walk and boarding times `27669` and `28200`.
- Mistake: Before the first successful SQL invocation, spent several cells printing test messages and probing `dir()`, `globals()`, and unavailable `types`.
- Mistake: After discovering `await run_sql(...)` worked, continued with many separate exploratory SQL cells instead of consolidating the search.
- Mistake: Used 57 requests, the highest count among successful code-mode cases.

### walking_change

**Tool calling: error.** Found transfer candidates and investigated the Prager Straße–Altmarkt walk, but exhausted 80 requests before submitting the journey or SVG. ($0.58, 80 requests, 4.9 min)
- Right: Built interpolated, repeated Friday services and walking links.
- Right: Investigated `R76d2117b+4` and `R3a0dccd4+54`, the same runs later selected in code mode.
- Right: Included walking time and the 120-second transfer allowance in readiness calculations.
- Mistake: Early queries repeatedly failed on unquoted `at`, including `max(at)` and `WHERE at IS NULL`.
- Mistake: Messages 125–147 repeatedly inspected the same transfer platforms and coordinates through separate queries.
- Mistake: Continued into third-vehicle candidate tables without completing reconstruction and output. A consolidated route check and artifact-writing step were needed.

**Code mode: error.** Computed a two-leg journey arriving at `63480` and wrote the SVG, but never submitted a valid structured answer. After prose failed validation, repeated Python print calls consumed the remaining requests. ($0.95, 80 requests, 5.5 min)
- Right: Found `R76d2117b+4`, `61560 → 61920`, followed by `R3a0dccd4+54`, `62458 → 63480`.
- Right: Checked the 341-second walk: the available gap was `538`, exceeding `341 + 120 = 461`.
- Right: Verified four platform markers and two run lines in `/out/journey.svg`.
- Mistake: Message 53 returned prose instead of the required JSON; message 55 explicitly reported `json_invalid`.
- Mistake: After that feedback, called `run_code` with `code: 1`, then repeatedly executed statements such as `print('final_result call next')` rather than submitting the result.
- Mistake: Also attempted to write `/tmp/result.json`, which was denied. The existing journey should have been returned directly as valid JSON or through `final_result`.

### after_midnight

**Tool calling: error.** Built interpolated timetables for Friday and Saturday, including previous-day offsets, but exhausted 80 requests before completing the transfer search. No answer or SVG was returned. ($0.51, 80 requests, 4.2 min)
- Right: Read `/data/DATA.md` and converted Friday times using `-86400` in `schedule_eff`.
- Right: Built 15,047 platform transfer pairs and identified 67 eligible initial departures in the filtered timetable.
- Mistake: During setup, repeatedly counted and recreated tables and inspected individual runs instead of proceeding to the journey search.
- Mistake: The final `run_sql` creating `leg1` joined on nonexistent `od.r1`; it should have used `od.variant_run_id`. Earlier queries also failed on unquoted `at` and ambiguous `kind`.
- Mistake: The transfer search began too late to leave requests for reconstruction, `write_file`, and the final answer.

**Code mode: passed.** Passed in 32 requests with `R93fefd15`, `5280 → 5492`, then `R900bf42f+2`, `5700 → 6420`, and the required SVG. ($0.50, 32 requests, 5.7 min)
- Right: Considered current and previous service days and ran timetable relaxation until no improvement in round six.
- Right: Reconstructed the two rides through Südhöhe and recovered from output validation errors.
- Mistake: Early code imported unavailable `textwrap`; service lookup later raised `KeyError: V3db19490` because an exception-only service was absent from the base service dictionary.
- Mistake: Two verification attempts raised `IndexError` from inconsistent platform indexing; multiple cells rebuilt the same structures.
- Mistake: Near the end, emitted literal `<atem:function_calls>` text instead of valid JSON, then corrected it after validation feedback.

### arrive_by

**Tool calling: error.** Found the eventual successful route, departing at `63360` and arriving at `64440`, but continued inspecting schedules until the 80-request limit. It never submitted the journey or SVG. ($0.49, 80 requests, 4.5 min)
- Right: `tmp_transfers` found `R1aabe4da+29` followed by `Rfd6f9e2d+67`, with a 64-second platform walk.
- Right: Calculated journey departure after subtracting initial walking and enforced the arrival deadline.
- Mistake: Early `read_csv(..., auto_detect=false)` omitted required column definitions; subsequent SQL also used invalid `INTERSECT` syntax and unquoted `at`.
- Mistake: After the route appeared in messages 136–138, repeated queries inspected `repeats` and the same base runs. Multi-statement queries returned only the final result, prompting further repeats.
- Mistake: A verification query used nonexistent `dep1` instead of `board_dep`. It should have consolidated validation and produced the artifacts.

**Code mode: passed.** Passed in 36 requests, selecting departure `63360` and arrival `64440` via `R1aabe4da+29` and `Rfd6f9e2d+67`. ($0.42, 36 requests, 4.3 min)
- Right: Found 4,050 feasible one-transfer journeys and tested later first departures for reachability before the deadline.
- Right: Verified the 64-second walk and repeat offsets `29*1200 = 34800` and `67*600 = 40200`.
- Right: Wrote and checked the SVG’s platform and run attributes.
- Mistake: After finding the route, building every ride pair in the time window exceeded the `268435456`-byte memory limit and reset the session.
- Mistake: The first reload indexed a list with potentially `None` values and failed type checking. It recovered with more compact structures, but should have avoided the large intermediate representation.

### departure_profile

**Tool calling: error.** Computed candidate journeys and dominance tables, but reached 80 requests without reconstructing and submitting the profile or drawing it. ($0.64, 80 requests, 3.4 min)
- Right: Used initial departure minus walking time and compared against departures beyond the requested window.
- Right: Computed suffix minima for dominance and compared one-transfer and two-transfer candidates; results included `25327 → 27420` and `25620 → 27828`.
- Mistake: Early date queries tried `'2026-342'::DATE` and nonexistent `TO_DATE`; `strptime('2026-342', '%Y-%j')` subsequently worked.
- Mistake: Repeated setup and count queries, unquoted `at`, and a reference to nonexistent table `direct` consumed requests.
- Mistake: The final dominance query returned 200 rows with `truncated=true`. It should have filtered to surviving departures in SQL and retrieved their legs rather than repeatedly printing candidate tables.

**Code mode: passed.** Passed in 27 requests with 12 nondominated journeys, departing from `25327` through `28620`, and an SVG containing the journeys. ($0.64, 27 requests, 6.6 min)
- Right: Accounted for initial walking in departure times and checked later departures for dominance.
- Right: Returned the frontier from `25327 → 27420` through `28620 → 30780` in departure order.
- Right: Recovered from an overlarge search by rebuilding and narrowing subsequent computations.
- Mistake: Early code encountered unsupported file iteration and unavailable `heapq`.
- Mistake: A later-departure search attempted 515 candidates in one cell and hit the 30-second execution limit after reporting progress through 300.
- Mistake: The first rebuild failed type checking on `places.get(prev_place, ...)`; it should have bounded the search and guarded optional keys from the outset.

### meeting_point

**Tool calling: error.** Computed Albertplatz as the meeting station with arrivals `33701` and `33692`, but exhausted 80 requests while examining the result. Neither journeys nor SVG were submitted. ($0.65, 80 requests, 3.6 min)
- Right: Performed six timetable relaxation rounds for each origin and compared station arrival times.
- Right: Identified `Sbb9212fa` and meeting time `33701`, matching the successful code-mode result.
- Mistake: During setup, three consecutive SQL attempts failed on unquoted `at`; the walk-table query also contained an extra parenthesis.
- Mistake: Repeated counts, timetable rebuilding, and manually issued relaxation rounds used most of the budget.
- Mistake: After selecting the meeting station, continued platform inspection instead of reconstructing both paths and writing `/out/journey.svg`.

**Code mode: passed.** Passed in 22 requests, choosing Albertplatz (`Sbb9212fa`) at `33701`, with one friend arriving at `33701` and the other at `33692`. ($0.56, 22 requests, 5.5 min)
- Right: Used 132,604 connection tuples to compute station arrival times for both origins.
- Right: Returned `R465985dd` and `Rc0124950` for the first friend and `Rfa439a34` for the second.
- Right: Verified the same-platform transfer: `32640 + 120 <= 32953`, and drew both journeys.
- Mistake: Setup used unsupported `date.timetuple()` and `time.time()`; a rebuild exceeded the 256 MiB memory limit.
- Mistake: Subsequent cells failed on assigning `None` into integer lists, undefined `index_platform`, and mistyped station `S023c6aebe`.
- Mistake: Repeated full pipeline rebuilding was wasteful, although the compact tuple representation ultimately succeeded.

### timed_tour

**Tool calling: error.** Loaded and expanded the timetable and explored station-to-station connections, but exhausted 80 requests before producing a complete timed tour. ($0.85, 80 requests, 6.3 min)
- Right: Built interpolated timing data, walking edges, and direct segment views for the five relevant stations.
- Right: Examined connections involving the visit stations and return station.
- Mistake: Messages 25–36 repeatedly failed on the same unquoted `at` field while changing unrelated aliases.
- Mistake: Much of the later work queried individual direct connections and `via_pirnaischer`, rather than completing a search over visit order and opening windows.
- Mistake: The final query printed Mickten-to-Prohlis departures across the day. It should have used bounded candidate searches and reserved requests for a complete itinerary and SVG.

**Code mode: error.** Evaluated visit orders and reported a provisional return at `44160`, but repeatedly failed during path reconstruction. The run ended after 35 requests when `run_code` exceeded its eight-retry limit. ($0.82, 35 requests, 7.9 min)
- Right: Built interpolated services, spatially bucketed walking links, and evaluated permutations of the four visits.
- Right: Reported three feasible permutations under its implemented constraints.
- Mistake: The `windows` dictionary encoded Pohlandplatz opening as `39600` (11:00), although the question specified 10:45, or `38700`.
- Mistake: From message 50 onward, reconstruction repeatedly exceeded `268435456` bytes while following predecessor arrays and appending legs. It should have checked predecessor termination and cycles, and used compact immutable path records before repeatedly rebuilding.
- Mistake: Recovery attempts used unsupported `del` statements and undefined names. The final retry failed because `calls_by_orig.setdefault(...).append(...)` and `.sort()` were inferred as operating on possibly `None` values.

### tour

**Tool calling: error.** Developed timetable relaxation queries and began a visit-state table, but reached 80 requests after only partial tour exploration. ($0.78, 80 requests, 3.7 min)
- Right: Created `expanded_calls`, walking edges, and `search_states` with a visit mask.
- Right: Computed initial arrival candidates from Hauptbahnhof, including Wasaplatz at `36900` and Julius-Vahlteich-Str. at `37200`.
- Mistake: Exploration tried unsupported `SHOW FUNCTIONS`, a disallowed `LOAD`, and `CREATE ... FUNCTION ... LANGUAGE PYTHON`.
- Mistake: Repeated unquoted `at` errors and an incorrect `ar.base_run` reference added avoidable work.
- Mistake: `search_states` was only initialized near the end. It should have implemented the visit-mask search earlier instead of manually repeating individual origin searches.

**Code mode: error.** Eventually reconstructed an 11-leg candidate tour returning at `50012`, but reached 80 requests before writing the SVG or submitting a result. ($1.25, 80 requests, 10.4 min)
- Right: Implemented a visit-mask search with 900-second stays and walking-aware visit departures.
- Right: The final search reported `50012` after 14,748 iterations and reconstructed all five visits.
- Mistake: Spent many cells paginating `all_calls` in 200-row chunks, exceeding tool-call limits and the cumulative `1000`-suspension limit twice, then restarted and repeated retrieval.
- Mistake: Subsequent searches hit the 30-second sandbox limit; recovery also encountered unsupported `heapq`, `globals()`, and repeated optional-index type errors.
- Mistake: The last cell calculated visit departures successfully, then failed on another `dir()` call. It should have stopped probing the environment and completed the SVG and structured answer.
- Mistake: The A\* heuristic used journey durations sampled at a particular departure time; the conversation did not establish those values as admissible lower bounds for all later departures.
