---
title: "Qwen3.8 Max (0902) 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 80%, code mode 100%; rank 16 of 44."
canonical: https://pydantic.dev/models/list/qwen3.8-max-0902/sql_data_analysis/
---

# Qwen3.8 Max (0902) 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 80%, code mode 100%; rank 16 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/qwen3.8-max-0902/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.8-max-0902/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time      |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | --------- |
| Tool calling | 80%   | 8 of 10      | $9.66 | 489      | 588        | 245.5 min |
| Code mode    | 100%  | 10 of 10     | $7.40 | 360      | 389        | 211.8 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

Qwen3.8-max passed 18 of 20 cases: 8/10 with tool calling and 10/10 in code mode. Both failures were tool-calling runs of the tour questions: `timed_tour` had a suboptimal answer and `tour` hit the 80-request limit. Code mode was also cheaper: 360 requests and about $7.40 in total, against 489 requests and about $9.70 for tool calling.

#### Where it does well

- **Single journeys:** both modes solved all of them (`one_vehicle`, `saturday_direct`, `one_change`, `walking_change`, `after_midnight`, `arrive_by`), including the walking transfers and the service day after midnight.
- **Multi-answer questions:** `departure_profile` and `meeting_point` passed in both modes, and the two modes gave the same answers.
- **Constraints:** in `timed_tour` both modes chose the same correct visit order and respected every opening window.
- **SVGs:** every SVG followed the coordinate formula. In tools mode it often checked marker coordinates by hand before finishing.

#### Mistakes it makes

- **Claims optimality without checking:** in `timed_tour` (tools) the last-leg search from Mickten missed the direct `R20f18e60+34` from platform `P792663d1` at 43260, which arrives at 44160. It accepted a two-vehicle return arriving at 44820 and said "verified and optimal". It never listed all departures from all Mickten platforms after 43200.
- **Runs out of requests on searches:** in `tour` (tools) it built a bitmask search over the visit stations in SQL. It spent many requests debugging it (one query returned null), then traced the path back one leg per request and ran out at 80. Its candidates at that point (Hbf at 50012) were already worse than code mode's 48660.
- **High request counts in general:** tool-calling runs averaged about 49 requests. `departure_profile` used 78.
- **Inconsistent departure times:** some answers gave the first board time as the departure, others the origin start time (e.g. 33484 vs 33300). The checker accepted both.
- **Bloated SVGs in code mode:** many code-mode SVGs drew every network stop as a dot, which made them 80k–160k characters.

#### Tool calling compared with code mode

Code mode was better on every measure that matters here. It passed both tour cases, and it used fewer requests on 9 of 10 cases: `departure_profile` took 37 requests against 78, and `tour` took 71 against more than 80. Writing loops and searches in Python avoided the one-SQL-query-per-step pattern that drained the request budget in tool calling. The one drawback seen in code mode was the oversized SVG output.

## Runs

### one_vehicle

**Tool calling: passed.** Found the direct bus `R27f8d4b1+2`, 29940→30480, including the walk to Strehlener Platz. Passed. ($0.39, 27 requests, 14.1 min)
- Right: Cheapest tools case: 27 requests, $0.39

**Code mode: passed.** Same direct bus `R27f8d4b1+2`. Passed for $0.27. ($0.27, 25 requests, 9.1 min)
- Right: Compact SVG and a cheap run

### saturday_direct

**Tool calling: passed.** Found the Saturday direct tram `Rb28d92d7`, 33484→34560. Passed. ($0.53, 42 requests, 23.2 min)
- Right: Used the correct Saturday service
- Mistake: Reported the departure as the board time, 33484, where code mode used the origin time, 33300. It passed anyway

**Code mode: passed.** Same tram `Rb28d92d7`, departure 33300, arrival 34560. Passed in 23 requests for $0.23. ($0.23, 23 requests, 15.3 min)
- Right: Cheapest case overall
- Mistake: SVG over 155k characters

### one_change

**Tool calling: passed.** Found `Rafeef850` → 72 m walk → `R620ec7d9`, arriving at 28440. Passed. ($0.66, 34 requests, 30.6 min)
- Right: Handled the walking transfer at Straßburger Platz correctly

**Code mode: passed.** Same two legs, arriving at 28440, in 23 requests. Passed. ($0.46, 23 requests, 17.0 min)
- Right: Efficient
- Mistake: Departure was given as 27669 (the board time) rather than 27600
- Mistake: SVG over 160k characters

### walking_change

**Tool calling: passed.** Found `R76d2117b+4` then `R3a0dccd4+54`, arriving at 63480. Passed. ($0.82, 53 requests, 28.4 min)
- Right: Correct arrival
- Mistake: 53 requests
- Mistake: Gave departure 61560 (the board time), while code mode gave 61500 including the walk. It still passed

**Code mode: passed.** Same legs as tools mode, with departure 61500 (including the walk) and arrival 63480. Passed in 30 requests. ($0.37, 30 requests, 14.7 min)
- Right: Counted the walk to the first platform in the departure time

### after_midnight

**Tool calling: passed.** Found the 4200→6420 journey with two legs (`R93fefd15`, `R900bf42f+2`) and drew a detailed SVG. Passed. ($0.69, 39 requests, 25.7 min)
- Right: Got the earliest arrival, 6420, across the midnight service-day boundary
- Right: SVG has `data-place`/`data-run` elements at the correct coordinates
- Mistake: 39 requests for a two-leg journey: heavy step-by-step SQL exploration

**Code mode: passed.** Same arrival, 6420, but with three legs (`Rca4e4824` added before `R93fefd15`). Passed. ($0.69, 37 requests, 25.0 min)
- Right: Correct earliest arrival
- Mistake: The SVG was about 86k characters because it drew grid lines and context dots one element at a time

### arrive_by

**Tool calling: passed.** Answered with a departure at 63360 and arrival at 64500 via `R1aabe4da+29` then `R54c1ee76+5`. Passed. ($0.65, 45 requests, 24.1 min)
- Right: Correct latest departure of 63360
- Mistake: 45 requests

**Code mode: passed.** Departure 63360, arriving at 64440 via `Rfd6f9e2d+67` for the second leg. Passed. ($0.56, 36 requests, 18.5 min)
- Right: Same latest departure as tools mode, in fewer requests (36)
- Mistake: SVG over 126k characters because it plotted every station as a context dot

### departure_profile

**Tool calling: passed.** Produced the full list of profile journeys (from 25327 on). Passed, but it was the most expensive case at 78 requests and $2.20. ($2.20, 78 requests, 53.4 min)
- Right: Journey list matches the code-mode answer
- Mistake: 78 requests, very close to the 80 limit. Each journey was worked out with separate SQL round trips

**Code mode: passed.** Produced the same profile journeys as tools mode in 37 requests ($0.83, against 78 requests and $2.20). Passed. ($0.83, 37 requests, 29.0 min)
- Right: Looped over departures in Python instead of one tool call per journey

### meeting_point

**Tool calling: passed.** Chose station `Sbb9212fa` with a meeting time of 33701 and one leg for each friend. Passed. ($0.85, 47 requests, 25.9 min)
- Right: Correct meeting station and time
- Mistake: 47 requests

**Code mode: passed.** Same station `Sbb9212fa` and time 33701. Departures were given as board times (33300, 32460) rather than 32400. Passed. ($0.98, 41 requests, 32.6 min)
- Right: Correct meeting point
- Mistake: SVG about 80k characters

### timed_tour

**Tool calling: failed.** The first four legs and visits were right, but the return from Mickten took two vehicles (`R269bf307` to Postplatz, then `Rd49d751b+30`) and arrived at 44820. Code mode found a direct `R20f18e60+34` from Mickten platform `P792663d1` at 43260 that arrives at 44160. Failed. ($1.19, 44 requests, 15.2 min)
- Right: Chose the correct visit order and respected the opening windows for Prohlis, TU, Pohlandplatz and Mickten
- Right: Checked the repeat counts and SVG coordinates
- Mistake: Final leg search (msgs 63–69): its reachability tables `leg5_s1`/`leg5_r1`, starting at 43200 from Mickten, never surfaced the direct tram from the nearby Mickten platform `P792663d1`. The model reported 'direct ride + walk = 44909' and accepted the 2-ride result of 44820
- Mistake: It declared 'The plan is verified and optimal' without listing every departure from every Mickten platform after 43200, which would have found the direct 43260 ride

**Code mode: passed.** Same first four legs, then the direct `R20f18e60+34` from Mickten at 43260, back at 44160. Passed. ($1.07, 37 requests, 38.5 min)
- Right: Found the direct return leg that tools mode missed
- Right: Respected all opening windows

### tour

**Tool calling: error.** Built a bitmask search over the 5 stations in SQL (tables `pred`, `all_runs2`), then traced the best path back one leg per request. It hit the 80-request limit mid-trace and gave no answer. ($1.70, 80 requests, 4.8 min)
- Right: A sound approach: subset masks over the 5 visit stations with a 15-minute dwell
- Mistake: Spent about 40 requests on setup and debugging the search (e.g. msg 150 returned `tgt` null). Later candidates still reached Hbf at 50012, well after the 48660 that code mode found
- Mistake: Traced the path back with one SQL query per leg (msgs 154–158) instead of one recursive query, and used up the request budget

**Code mode: passed.** Solved the 5-station tour with 12 legs, back at Hauptbahnhof at 48660, in 71 requests. Passed. ($1.94, 71 requests, 12.2 min)
- Right: Finished within the budget where tools mode ran out
- Mistake: 71 requests and $1.94, close to the limit
