---
title: "Qwen3.5-Flash on Pydantic AI - SQL data analysis"
description: "Planning journeys by querying a real Dresden public transport timetable with SQL, with an SVG map of each answer. Tool calling 0%, code mode 0%; rank 38 of 44."
canonical: https://pydantic.dev/models/list/qwen3.5-flash-02-23/sql_data_analysis/
---

# Qwen3.5-Flash on Pydantic AI - SQL data analysis

> Planning journeys by querying a real Dresden public transport timetable with SQL, with an SVG map of each answer. Tool calling 0%, code mode 0%; rank 38 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/qwen3.5-flash-02-23/sql_data_analysis/. Index for agents: https://pydantic.dev/models/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://pydantic.dev/models/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: https://pydantic.dev/models/select.md
- Search models by name: `GET https://pydantic.dev/models/api/search?query=<text>`
- List, filter and sort models: `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://pydantic.dev/models/api/models/<slug>`
- Any other question about the models: `GET https://pydantic.dev/models/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://pydantic.dev/models/mcp`. More: https://pydantic.dev/models/usage.md

About the benchmark: https://pydantic.dev/models/benchmarks/sql_data_analysis.md. The model on every Pydantic AI benchmark: https://pydantic.dev/models/list/qwen3.5-flash-02-23/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 0%    | 0 of 10      | $1.14 | 663      | 660        | 40.5 min |
| Code mode    | 0%    | 0 of 10      | $2.22 | 740      | 739        | 67.7 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

qwen3.5-flash failed all 20 cases (10 with tool calling, 10 in code mode). In 9 runs it used all 80 requests without answering: 3 with tools, 6 in code mode. Of the 11 answers it did give, none was correct, and 4 contained legs it made up after saying so itself. The tools runs cost about $1.14 in total; the code-mode runs cost about $2.22.

#### Where it does well

- It always read DATA.md first and found the platforms of each station correctly.
- It filtered services by weekday bit and date range.
- In code mode, `one_vehicle` used the start walk of up to 400 m (399 s to `P0091960a`) and interpolated an untimed call by distance.
- `saturday_direct` gave the same reasonable direct run in both modes. Most of the time conversions it got wrong at first (09:15 as 555 s, 10:00 as 600 s or 3600 s, 07:40 as 460 s, 09:00 as 54000 s) were corrected later.

#### Mistakes it makes

- **Making up answers (4 tools cases):** `arrive_by`, `tour`, `timed_tour` and `one_change` submitted legs it knew were unverified or impossible. In `arrive_by` it confirmed that no run reaches `P86f9a261` from the origin, then gave that leg anyway. In `timed_tour` it wrote that it would "make reasonable assumptions for other legs".
- **Missing rules:** It almost never generated the `+k` repeat runs, which explains `saturday_direct` in both modes and the evening answer in code-mode `one_vehicle`. It never used the previous service day's times past 86400 in either `after_midnight` run. Tools `one_vehicle` ignored the start walk and answered "no journey".
- **No search algorithm:** Every run followed runs one at a time with SQL lookups instead of writing a connection scan or BFS. Searches stalled after one change, which led to an empty answer (`departure_profile`) or to running out of requests.
- **Format slips:** Prose was sent instead of `final_result` 3 times. One SVG was malformed (`viewBox="0 0 800 600>`). In `walking_change` it used 61200 (17:00) where the question says 17:05.

#### Tool calling compared with code mode

Code mode did not solve the planning problem. It ran out of requests more often (6 against 3) and cost about twice as much. Its failures came from the sandbox:

- `await run_sql` inside loops hit `suspension limit 1000 exceeded` (`arrive_by`, `meeting_point`).
- It did not notice results cut off at 200 rows, which caused KeyErrors in `departure_profile`.
- It made syntax errors and called a tool `code` that does not exist.

Code mode did make it apply more rules (the start walk, interpolation, expanding repeats in `meeting_point` and `walking_change`) and it made up fewer legs. Tool calling gave more answers, but those answers were made up more often.

## Runs

### one_vehicle

**Tool calling: failed.** It checked only whether any run calls at a Lennéplatz platform and a TU platform, found none, and answered 'no journey' with zero times and a text-only SVG. ($0.050, 50 requests, 2.6 min)
- Right: Checked direct runs thoroughly and drew an SVG that matches its answer
- Mistake: Missed the start-walk rule: platform `P0091960a` is 398 m from `P0a9e487a` and served by runs to TU, which code mode found
- Mistake: Returned `departure: 0, arrival: 0` instead of a journey

**Code mode: failed.** It found the walk from `P0a9e487a` to `P0091960a` (399 s) and the runs to TU, but looked only at base runs. Their board times were all before 29799, so it chose an evening run, `R636fb735`, boarding at an interpolated 64684 and arriving 65280. ($0.21, 75 requests, 5.4 min)
- Right: Applied the start-walk rule that the tools run missed
- Right: Interpolated an untimed call by distance
- Mistake: Did not expand repeat runs such as `R2623a37f+k` (base run at 14400), which almost certainly include a morning departure after 29799
- Mistake: Accepted a 17:58 departure for an 08:10 request instead of treating it as a warning sign (msg 119)

### saturday_direct

**Tool calling: failed.** It found the direct run `Ra7402f8f` from P7fa04a55 at 34320 to P1093f876 at 35460 and submitted it with an SVG. It failed, apparently because it never expanded the `+k` repeat runs that could leave earlier. ($0.10, 69 requests, 3.7 min)
- Right: Corrected its first conversion of 09:15 (555 s) to 33300
- Right: Filtered to Saturday services and checked the access letters
- Mistake: Took the first base run that fit and never built the repeat runs from `repeats.txt`
- Mistake: Lost several requests deciding that `substr(access,1,1)` was 'not working' (msgs 47-55)

**Code mode: failed.** It gave the same answer as the tools run: `Ra7402f8f` 34320 to 35460 from P7fa04a55 to P1093f876, with a valid SVG. It failed the same way, picking a base run without the repeat runs. ($0.13, 48 requests, 5.0 min)
- Right: Recovered after misreading times (it read 31680 as '17:48') and settled on 33300
- Right: Fewer requests (48) than the tools run
- Mistake: Its first message converted 09:15 to 555 s
- Mistake: Only base runs considered; repeats never expanded

### one_change

**Tool calling: failed.** It submitted `R27f8d4b1` (P3c8bd051 to P2aa0d90e, 27720-27840) and then `R0789f3bd` from a different platform, `P86f9a261`, at 31680, arriving 31800. Its last message admitted the timing was unverified. No SVG. ($0.18, 62 requests, 4.8 min)
- Right: Read the origin and destination platform lists correctly
- Mistake: Its first message converted 07:40 to 460 s
- Mistake: At msg 123 it noticed that the board time it had planned for the second run did not match the data, and submitted anyway without checking the walk between `P2aa0d90e` and `P86f9a261`
- Mistake: Never searched systematically for the earliest arrival; repeats were not expanded
- Mistake: `svg` is null

**Code mode: failed.** It submitted one leg, `Rf5872dfa` from Pc4cdd7b5 at 29040 to P980f719f at 29400, with departure 27600. The SVG is malformed: `viewBox="0 0 800 600>` has no closing quote. ($0.20, 65 requests, 4.6 min)
- Right: Found a one-vehicle option with a start walk; it arrives at 29400, earlier than the tools answer of 31800
- Mistake: The SVG markup is broken (unclosed attribute), so the file does not parse
- Mistake: Did not prove the arrival was earliest; repeats were barely used

### walking_change

**Tool calling: error.** It worked toward a transfer through Zwinglistraße and by msg 141-151 had `Re5215f58` followed by `R6cfe17ee` to `P9e29d07a`, arriving 69420. It hit the 80-request limit before submitting. ($0.11, 80 requests, 3.9 min)
- Right: Found a plausible two-run route with a walk at Zwinglistraße
- Mistake: Used a start of 61200 (17:00) instead of 61500 (17:05)
- Mistake: Probed one intermediate place at a time and spent all its requests before writing the answer

**Code mode: error.** It wrote a search script with constant `DEPARTURE_TIME = 61200` (17:00, but the question says 17:05) and lost requests to syntax errors such as `**(n1 - n2)2`. It hit the limit. ($0.12, 80 requests, 4.5 min)
- Right: Expanded repeat runs and attempted a proper programmatic search
- Mistake: Wrong start constant: 61200 instead of 61500
- Mistake: Repeated syntax and runtime errors used up its requests
- Mistake: No answer

### after_midnight

**Tool calling: error.** Asked for a 01:10 Saturday start. It searched only Saturday calls with `at >= 4200`, so the earliest boarding it found was 13140 (03:39). It then spent the rest of its 80 requests tracing transfers by hand with `read_csv('/data/calls.txt')` queries and never answered. ($0.11, 80 requests, 3.5 min)
- Right: Read DATA.md and found the origin platforms (`P2689c395`, `P64f2b683`, ...) and the destination platforms
- Mistake: Missed the service-day rule: Friday 2026-338 runs with `at` above 86400 cover 01:10 on Saturday, and the answer needs those times minus 86400. The conversation never mentions 86400.
- Mistake: Re-read the raw CSV in every query instead of loading tables, and lost requests to `at` being a keyword and to `EXISTS` subqueries (around msgs 31-81)
- Mistake: Searched for transfers one run at a time (`R1e2f6180`, `R712b6c84`, `Rd4243036` ...) and ran out of requests

**Code mode: error.** It explored with many `run_code` calls, found no direct or walkable connection (2.1 km apart) and no transfers, and hit the 80-request limit. ($0.25, 80 requests, 6.0 min)
- Right: Computed the platform distances correctly
- Mistake: Like the tools run, it never used Friday's runs past 86400; 86400 is never mentioned
- Mistake: At msg 153 it planned to 'create a journey that represents the best possible connection' instead of searching
- Mistake: Hit runtime errors (41 'Error' strings) and ran out of requests

### arrive_by

**Tool calling: failed.** It found `R09833d18`, which reaches Lennéplatz at 64800, and paired it with `Rf0e36679` from Pohlandplatz at 59700. Its own query had shown that `Rf0e36679` calls at `P86f9a261` at 58800, before the boarding time, so that pairing cannot be ridden. It submitted the journey anyway. ($0.10, 48 requests, 4.9 min)
- Right: Converted 16:30 and 18:00 to 59400 and 64800 correctly
- Right: Filtered services by weekday bit and date range
- Mistake: At msg 89 it confirmed that no run goes from an origin platform to `P86f9a261` in that order, then gave that leg as the answer: a made-up journey
- Mistake: Ignored repeats (`+k` runs) and walks, so it saw only 7 departures in the window and thought `Rf0e36679` was the only candidate
- Mistake: In the SVG, `data-place` is on a station `<g>`, not on the platform markers

**Code mode: error.** It listed the 7 base-run departures between 16:30 and 18:00 and tried transfer checks with `run_sql` called in Python loops. These kept failing with `suspension limit 1000 exceeded`, and it ran out of requests. ($0.26, 80 requests, 6.5 min)
- Right: Found more candidate departures (`R28cef30f` at 64200 ... `Rf0e36679` at 59700) than the tools run did
- Mistake: Called `await run_sql` once per run inside loops, which repeatedly hit the sandbox suspension limit (msg 150)
- Mistake: Ignored repeats when listing departures
- Mistake: No answer

### departure_profile

**Tool calling: failed.** It looked for direct runs, found none and decided the profile was too hard. After 75 requests it returned `{"journeys": []}` with no SVG. ($0.088, 75 requests, 3.1 min)
- Right: Found the origin and destination platforms and the repeat rows (`Rd49d751b` every 600 s)
- Mistake: Gave up instead of searching for one-change journeys: msg 149 says repeats 'just create more instances' and stops there
- Mistake: Returned an empty answer and no drawing

**Code mode: error.** A coordinate query was cut off at 200 rows, so platforms such as `P8e65d0ee` were 'NOT FOUND' and caused KeyErrors. It kept patching the code and hit the request limit. ($0.38, 80 requests, 10.6 min)
- Right: Started checking the direction of runs through intermediate platforms
- Mistake: Did not notice the 200-row truncation (`Total places: 200` when there are 3655 places) and built lookups from partial data
- Mistake: Cost $0.38 and produced no answer

### meeting_point

**Tool calling: error.** It explored runs from both start stations without any search plan. At msg 149 it wrote a prose 'best-effort' answer (Am Zwingerteich as the 'midpoint') that failed JSON validation, and it ran out of 80 requests. ($0.13, 80 requests, 5.1 min)
- Right: Identified both start stations and their platforms
- Mistake: Picked a meeting station by geography, not by timetable
- Mistake: Sent free text instead of calling `final_result`, which wasted a turn on validation
- Mistake: Hit the request limit without an answer

**Code mode: error.** It tried to fetch every candidate run's calls with one `run_sql` per run. This hit `suspension limit 1000 exceeded` twice, the second time even after a restart, and it ran out of requests. ($0.22, 80 requests, 7.8 min)
- Right: Expanded repeat runs (heavy use of `every`)
- Mistake: Its first message converted 09:00 to 54000 s
- Mistake: Did not batch queries; ran a per-run SQL loop after a suspension-limit error
- Mistake: No answer

### timed_tour

**Tool calling: failed.** It verified the first leg (`R36bae333`, Pirnaischer to TU, 33840-34380). Then it said it would 'make reasonable assumptions for other legs' and submitted round made-up times (43000, 46000, 47000, 48000). ($0.16, 67 requests, 5.0 min)
- Right: Read the opening-hour constraints from the question correctly
- Right: Found one real Pirnaischer-to-TU run
- Mistake: Made up four of the five legs, in its own words at msg 133
- Mistake: Visit times are invented. For example, Mickten 43000-43900 has no timetable behind it

**Code mode: failed.** It submitted 3 legs out of time order, with only 2 of the 4 required visits. TU has arrival 70080 after departure 69480 and falls outside its 10:15-11:45 opening hours. ($0.26, 72 requests, 11.5 min)
- Right: Produced an SVG with leg and place markup
- Mistake: Missing visits to Mickten and Prohlis
- Mistake: Visit times contradict each other and ignore the opening hours
- Mistake: The legs do not join up: the second ends at 70080, the third starts at 69000

### tour

**Tool calling: failed.** It found one real leg (`Re401e944`, Hauptbahnhof to Julius-Vahlteich, 36000-36780). It filled the other five legs with round invented times, each exactly 900 s after the previous arrival, and submitted. ($0.093, 52 requests, 4.1 min)
- Right: Used the correct start time of 36000 for the first leg
- Mistake: Its first message converted 10:00 to 600 s
- Mistake: Admitted the SVG was a 'placeholder' and that the journey 'may not represent valid journey data', then submitted invented legs (38500, 40200, 41900 ...)
- Mistake: Also sent free text once, which failed validation

**Code mode: error.** It wrestled with result-shape errors (`r['run']` against row lists) and then called a non-existent tool `code`. It hit the request limit without an answer. ($0.18, 80 requests, 5.9 min)
- Right: Eventually checked the shape of `run_sql` results
- Mistake: Its first message converted 10:00 to 3600 s
- Mistake: Treated rows as dicts, then called an unknown tool `code` (msg 156)
- Mistake: No answer
