---
title: "MiniMax M3.1 Flash 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 80%; rank 22 of 32."
canonical: https://models.pydantic.dev/models/minimax-m3.1-flash/transit_planner/
---

# MiniMax M3.1 Flash 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 80%; rank 22 of 32.
>
> Markdown copy of https://models.pydantic.dev/models/minimax-m3.1-flash/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/minimax-m3.1-flash.md

| Mode         | Score | Tasks passed | Cost | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ---- | -------- | ---------- | -------- |
| Tool calling | 50%   | 5 of 10      | –    | 669      | 759        | 80.7 min |
| Code mode    | 80%   | 8 of 10      | –    | 435      | 1372       | 64.3 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`gateway/openrouter:minimax/minimax-m3.1-flash` passed 13/20 runs: 5/10 with tools and 8/10 in code mode. Code mode is the stronger choice here, but neither mode passed either tour task. The failures comprise three request-limit exhaustions, two incorrect ordinary journeys, one empty submission, and one rejected tour.

#### Where it does well

Both modes passed midnight rollover, latest departure, meeting-point selection, one-vehicle routing, and Saturday service selection. Successful runs handled repeated vehicles, distance-based interpolation, platform walks, and SVG output. Both found the Albertplatz meeting at `33701`; both found the midnight arrival at `6420`.

Code mode additionally solved the two transfer cases and returned all 12 departure-profile journeys. It sometimes caught substantial implementation errors: the profile run detected 3188 instances with decreasing arrival times and repaired its timetable.

#### Mistakes it makes

Small input and join errors have large effects. Tools mode converted 07:40 to `28000` rather than `27600`, missing a connection and arriving six minutes late. Its walking-change run used `61200` rather than `61500` and joined repeated instance ids directly to base calls, dropping all repeats.

Budget management is poor. Three tools runs exhausted 80 requests; timed-tour code returned empty data despite just finding `44160`. Tour search omitted walking arrivals and forced visits at target-station transfers.

Recovery is persistent but wasteful: repeated SQL schema mistakes, unavailable Python imports, memory resets, inaccessible file reads, and redundant verification recur.

#### Tool calling compared with code mode

Code mode used fewer model requests in every pair: 435 total versus 669, a 35% reduction. It preserved all five tools-mode passes and added three.

Fewer requests did not mean fewer tool calls: the conversations contain 1372 tool-call parts in code mode versus 752 with tools, including final submissions. Code-mode `arrive_by` alone made 711 calls, including 209 numbered `done` prints; `one_vehicle` recorded 39 failed `pickle` imports. Engineers should distinguish model-round savings from actual execution efficiency.

## Runs

### one_vehicle

**Tool calling: passed.** Passed in 45 requests. It found a walk to Strehlener Platz followed by one bus, arriving at `30480`. (–, 45 requests, 2.1 min)
- Right: Included starting and ending walks in the one-vehicle search.
- Right: Returned `R27f8d4b1+2`: `P0091960a` at `29940` to `P6e8c05a2` at `30480`; the initial walk takes 399 seconds.
- Mistake: The interpolation setup twice failed on bare `at`, then referenced nonexistent `effcalls_tmp`.
- Mistake: After writing the SVG twice, it attempted both `read_text` and `run_sql(read_csv(...))` on `/out/journey.svg`; neither interface permitted that read.

**Code mode: passed.** Passed in 23 requests with the same 399-second initial walk and `R27f8d4b1+2` ride as tools mode. Low request count concealed 160 tool calls. (–, 23 requests, 5.0 min)
- Right: Enumerated boarding and alighting platforms within 400 metres of the endpoint stations.
- Right: Compared 81 distinct candidate runs and selected boarding `29940`, arrival `30480`.
- Right: Read back the SVG and checked its platform and run attributes.
- Mistake: One response issued 111 `run_code` calls. The conversation recorded 39 failures importing unavailable `pickle`.
- Mistake: It repeatedly reloaded the same files and initially attempted `import duckdb` instead of the provided `run_sql` interface.
- Mistake: `times_of` searched backward through already-filled `t` values, allowing interpolated calls to become interpolation anchors. It should use only original timed calls; the selected journey still passed.

### saturday_direct

**Tool calling: passed.** Passed in 60 requests with `Rb28d92d7`, boarding at `33484` and arriving at `34560`. The selected ride remained valid despite mistakes in the search inputs. (–, 60 requests, 3.3 min)
- Right: Filtered Saturday services and interpolated the boarding call at `P7fa04a55`.
- Right: Returned the direct ride to `P1093f876` and drew its route with `data-run="Rb28d92d7"`.
- Mistake: Search queries and the final departure used `33000` for 09:15 instead of `33300`. This was harmless to the selected ride because its departure was `33484`.
- Mistake: Initial boarding queries tested `substr(access,2,1)='Y'`, the alighting letter; later queries corrected this to the first letter.
- Mistake: After producing the SVG, it made three consecutive `SELECT 1` calls and repeated an unsupported SVG read.

**Code mode: passed.** Passed in 24 requests. It used the correct `33300` start and returned `Rb28d92d7`, arriving at `34560`. (–, 24 requests, 3.0 min)
- Right: Filtered Saturday services, expanded instances, and searched from the origin's platforms and nearby walking options.
- Right: Returned `P7fa04a55` at `33484` to `P1093f876` at `34560` and produced the SVG.
- Mistake: Initial loading called nonexistent `tool_sql`; later search setup attempted unavailable `heapq`.
- Mistake: Diagnostic code looked up suffixed instance ids directly in the base-run dictionary, causing `KeyError` for `Ree22098b+2` and `R07273aa7+1`.
- Mistake: The first SVG-generation attempt omitted an argument required by a format string; the next attempt repaired it.

### one_change

**Tool calling: failed.** Failed by returning arrival `28800`, six minutes later than the passing code-mode journey's `28440`. Its search used the wrong starting time. (–, 50 requests, 3.6 min)
- Right: Expanded repeated runs, interpolated calls, and checked the selected transfer using `28440 + 61 + 120 <= 28703`.
- Right: Wrote an SVG for the two returned vehicle legs.
- Mistake: The direct and first-leg queries used `dep >= 28000` for 07:40; the correct value is `7*3600 + 40*60 = 27600`.
- Mistake: That excluded `Rafeef850`, boarding `P0708873e` at `27669`, which connects to `R620ec7d9` and arrives at `28440`.
- Mistake: After writing the SVG, it repeated inaccessible `/out` reads and issued both `SELECT 'ok'` and `SELECT 1` instead of checking the input-time conversion.

**Code mode: passed.** Passed in 26 requests, arriving at `28440` using two vehicles. It used the correct `27600` start time that tools mode missed. (–, 26 requests, 4.2 min)
- Right: Selected `Rafeef850`: `P0708873e` at `27669` to `P66c27b1c` at `27960`, then `R620ec7d9`: `P3b6efaff` at `28200` to `P4c09fc0c` at `28440`.
- Right: Checked the 72-second transfer walk: `27960 + 72 + 120 = 28152`, before the second departure.
- Right: Compared profile-based results with brute-force two-vehicle searches.
- Mistake: After finding the route, responses contained many overlapping checks of the same services, interpolation, and alternatives.
- Mistake: SVG generation repeatedly failed when assigning `A = s.append`; it eventually used supported direct list operations.
- Mistake: It also attempted unavailable `pickle` and unsupported `os.W_OK`.

### walking_change

**Tool calling: failed.** Failed with three vehicles arriving at `66720`, versus `63480` in the passing code-mode run. Its timetable silently excluded repeated vehicles, and its journey began before the requested time. (–, 54 requests, 4.1 min)
- Right: Implemented walk-distance limits and transfer-state labels.
- Right: Checked the returned vehicles and drew all three legs.
- Mistake: When creating `stops`, it used `FROM inst i JOIN c2 ON c2.run = i.run`. Since repeated instance ids contain `+k` but `c2.run` contains base ids, every repeat was dropped. It needed a separate base-run key for this join.
- Mistake: It initialized `lbl_0` with `61200` for 17:05 instead of `61500`, then returned a first boarding at `61200`.
- Mistake: Correcting both errors would retain candidates such as `R76d2117b+4` and `R3a0dccd4+54`, used by the passing run.

**Code mode: passed.** Passed in 48 requests with two vehicles arriving at `63480`, 3240 seconds earlier than tools mode's answer. (–, 48 requests, 6.6 min)
- Right: Used the correct `61500` start and retained repeated instances.
- Right: Returned `R76d2117b+4`: `Pff25da30` at `61560` to `P6e794064` at `62040`, then `R3a0dccd4+54`: `P72ccec8b` at `62520` to `P9e29d07a` at `63480`.
- Right: Checked raw calls, nearby platforms, and the final SVG's `data-place` and `data-run` attributes.
- Mistake: Repeatedly attempted unsupported features including `heapq`, `globals`, `compile`, `time.time`, and `yield`, and issued undefined placeholder expressions such as `check2`.
- Mistake: Reloading data after patching its heap exceeded the 256 MiB memory limit and reset the session; it recovered using smaller saved scripts.
- Mistake: The final XML validation attempted unavailable `xml.dom.minidom`, although the SVG had already been written.

### after_midnight

**Tool calling: passed.** Passed in 70 requests. It included the previous service day and returned two buses arriving at `6420`, with the required SVG. (–, 70 requests, 7.7 min)
- Right: Expanded repeats and converted service-day times using `-(339 - ri.doy)*86400`.
- Right: Selected `R93fefd15`: `P99202dfd` at `5280` to `P96dc02de` at `5492`, then `R900bf42f+2`: `P983fcb99` at `5700` to `P453df67b` at `6420`.
- Right: Checked the 76-second transfer walk and the required 120-second margin.
- Mistake: During interpolation, `cseq.s` was initially null at each run's first call, leaving 3620 arrival times null; it rebuilt the tables to correct this.
- Mistake: Several `run_sql` calls failed on unquoted `at`, a missing `dwell` column, and recursive CTE structure. After writing the SVG, it also attempted an unsupported `read_text('/out/journey.svg')` and issued `SELECT 1`.

**Code mode: passed.** Passed in 41 requests, returning the same two vehicle legs and `6420` arrival as tools mode. It recovered from substantial sandbox incompatibilities. (–, 41 requests, 5.8 min)
- Right: Included Friday services crossing midnight, expanded repeats, and checked the chosen runs against raw calls through `run_sql`.
- Right: Used a custom heap and spatial walk neighbours, then checked possible final walks.
- Right: Generated and inspected the SVG using Python file access.
- Mistake: Early `run_code` calls attempted unavailable imports including `io`, `pyai`, `heapq`, and `gc`; a memory failure also required rebuilding state.
- Mistake: SVG generation repeatedly tried extracting `svg.append` as a callable, which the sandbox rejected, and attempted a forbidden `/tmp/part1.svg` write before switching approaches.

### arrive_by

**Tool calling: passed.** Passed on its 80th request. It found a latest departure of `63360` and arrival of `64500`, before the `64800` deadline. (–, 80 requests, 5.6 min)
- Right: Returned `R1aabe4da+29` from `P10db34c8` at `63360` to `P3b6efaff` at `63900`, followed by `R54c1ee76+5` from `P6ea0167f` at `64320` to `P53270352` at `64500`.
- Right: Investigated additional transfers and destination walks when checking whether a later departure was possible.
- Mistake: The timetable-building stage repeatedly needed repair: ambiguous `place`, nonexistent `c.run`, omitted departure information, and missing or already-created tables.
- Mistake: It rebuilt several search tables to recover predecessor fields, then attempted to read the SVG through a tool restricted to `/data`. It finished with no request budget remaining.

**Code mode: passed.** Passed in 48 requests with departure `63360` and arrival `64440`. The conversation nevertheless contained 711 tool calls, including extensive redundant work. (–, 48 requests, 67 s)
- Right: A reverse latest-arrival search covered 2380 platforms and identified `63360` as the latest feasible first departure.
- Right: Returned `R1aabe4da+29` followed by `Rfd6f9e2d+67`, with a 64-second walk between `P3b6efaff` and `P6ea0167f`.
- Mistake: The first response issued 113 `run_code` calls, including queries for nonexistent files such as `/data/stations.csv` and `/data/trips.csv`, before adapting to the documented files.
- Mistake: Another response issued 267 calls; across the conversation, 209 calls merely printed numbered `done` messages.
- Mistake: Search development also encountered memory exhaustion, a sandbox execution timeout, repeated missing-state errors, and unsupported `len(h)` on its custom heap.

### departure_profile

**Tool calling: error.** Computed useful departure/arrival values but exhausted 80 requests while investigating connections. It returned neither an answer nor an SVG. (–, 80 requests, 8.0 min)
- Right: Built `233360` expanded calls and propagated destination-arrival values through `val` and `val_next`.
- Right: Its intermediate results included `25327 → 27420` and `25620 → 27828`, matching entries in the passing code-mode profile.
- Mistake: Early `run_sql` calls mixed `VARCHAR` coordinates with numeric bounds and referenced nonexistent `r.run` and `rp.cnt` fields.
- Mistake: After computing arrival values, it spent the remaining requests inspecting individual routes and comparing `l2arr` with `val`. The final query still investigated `Rae8ae060`.
- Mistake: It should have reserved requests for applying the later-departure dominance filter, reconstructing the surviving journeys, and writing `/out/journey.svg`.

**Code mode: passed.** Passed in 76 requests with 12 nondominated journeys. Departures ranged from `25327` to `28620`, with corresponding arrivals from `27420` to `30780`. (–, 76 requests, 11.3 min)
- Right: Used memoized arrival calculations and a descending-departure suffix minimum to test dominance against later departures.
- Right: Checked initial walks and added `(p,0)` neighbours for same-platform changes.
- Right: Reconstructed the surviving journeys and generated their SVG.
- Mistake: The initial timetable produced 3188 instances with decreasing arrival times, and recursive searches hit recursion limits. It rebuilt interpolation; the subsequent check reported zero nonmonotonic runs.
- Mistake: Earlier exhaustive exploration exhausted memory and exceeded the sandbox's 30-second execution limit, requiring state reconstruction.
- Mistake: Late SVG checks attempted unavailable `xml` support; generation also needed a repair to an invalid `str.join` call.

### meeting_point

**Tool calling: passed.** Passed in 70 requests. It selected Albertplatz, `Sbb9212fa`, with meeting time `33701`. (–, 70 requests, 7.1 min)
- Right: Computed arrival labels for both origins and compared stations using `greatest(a.t,b.t)`.
- Right: Returned `Rc0124950`, arriving at `P291e54d3` at `33701`, and `Rfa439a34`, arriving at `Pcb3f34ed` at `33692`.
- Right: Checked label relaxation and vehicle-edge coverage before submitting both journeys.
- Mistake: During search construction, it referenced `labels` before creation and inferred null-only predecessor columns that could not accept strings.
- Mistake: After finding the result, several verification calls failed on nonexistent fields, `%d` formatting of floats, and `strftime(INTERVAL, ...)`; these did not improve the journey.

**Code mode: passed.** Passed in 26 requests with the same Albertplatz meeting and journeys as tools mode. Its search reached 1081 stations from each origin. (–, 26 requests, 3.6 min)
- Right: `run_from` handled initial walks, transfer walks, and final walks, then ranked common stations by `max(A[s][0], B[s][0])`.
- Right: Found `33701` at Albertplatz, ahead of the next reported candidate at `33780`.
- Right: Verified the selected runs and SVG attributes.
- Mistake: Search setup attempted unavailable `heapq` and needed a custom heap repair.
- Mistake: The final tie check compared a numeric time with `rows[0][0]`, the first character of a station-id string, so it printed an empty tie list. It should have compared against the minimum meeting time.
- Mistake: An unnecessary `os.listdir('/')` inspection was denied.

### timed_tour

**Tool calling: error.** Found a candidate return at `44160`, but exhausted 80 requests while rerunning the search. No final journey or SVG was returned. (–, 80 requests, 8.5 min)
- Right: Implemented a visited-station bitmask and minimum visit durations in SQL.
- Right: Reconstructed a candidate through Prohlis, Technische Universität, Pohlandplatz, and Mickten, returning to `P72ccec8b`.
- Mistake: The `stw` table encoded the 11:45 closing times as `41100`; they should be `42300`.
- Mistake: Initial origin access charged station-centre distances. It later rebuilt origin access from platforms, but created `candv2` before `front2` and then referenced nonexistent `dist2`.
- Mistake: It repeated nearly the entire relaxation process after already finding `44160`. It should have corrected the constraints earlier and reserved budget for reconstruction and SVG output.

**Code mode: failed.** Failed after 58 requests by submitting `arrival: 0`, empty legs, and empty visits, with no SVG. Its immediately preceding search had reported `Tbest 44160`. (–, 58 requests, 7.9 min)
- Right: Implemented visited-station masks, opening windows, and visit durations.
- Right: Recovered from memory resets, added same-platform boarding options, and independently checked candidate vehicle calls.
- Right: The final search reported a finite return time with 10041 standing states and 108434 riding states.
- Mistake: The first search omitted `(p,0)` from walk neighbours, excluding same-platform boarding; adding it materially improved the candidate.
- Mistake: Its walk validator compared a vehicle leg's endpoints, `P72ccec8b → P430d1c87`, as though they were a transfer walk, producing a spurious 6393-metre failure.
- Mistake: After rebuilding the search and obtaining `44160` again, it called `final_result` with empty data. It should have reconstructed and validated the candidate, written the SVG, and submitted the actual tour.

### tour

**Tool calling: error.** Exhausted 80 requests on timetable preparation and route exploration. It never submitted a tour or SVG. (–, 80 requests, 30.9 min)
- Right: Built interpolated calls, expanded Saturday instances, and identified connections among the requested stations.
- Right: Created `sched`, `leg0`, and `relcall` tables that could support a tour search.
- Mistake: After building the timetable, it repeatedly listed line sequences, shared stations, and individual runs rather than completing a search over visited-station subsets.
- Mistake: The final requests still created `st_seq`, `rel_lines`, and `rel_lines2` and inspected `Raec2024e`. It should have moved to a bitmask search with 900-second visits and predecessor reconstruction much earlier.

**Code mode: failed.** Returned an 11-leg tour with five visits and arrival `50012`, but failed the benchmark. Its own checks validated the selected legs and drawing, while the search omitted permitted alternatives. (–, 65 requests, 15.7 min)
- Right: Used a 32-mask search and processed 55849 states.
- Right: Checked selected vehicle times, access letters, walk lengths, and transfer margins; `verify()` returned `problems []`.
- Right: Reported visit durations of 971, 1241, 900, 927, and 900 seconds and verified all 11 SVG leg geometries.
- Mistake: In `search_step`, a visit could only be credited at a vehicle's alighting platform, and the return condition required `p2 in HBF_SET`. Walking arrivals at visits or the final destination were omitted.
- Mistake: The branch `if bb and not (mask&bb)` forced a 900-second visit whenever alighting at an unvisited target, without retaining an ordinary-transfer alternative.
- Mistake: It described the result as an earliest return from a full search despite these omissions. It needed complete walk/visit transitions and an independent optimality check; the supplied result does not identify the exact rejected check or correct return time.
