---
title: "Muse Spark 1.3 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 10%, code mode 50%; rank 35 of 44."
canonical: https://pydantic.dev/models/list/muse-spark-1.3/sql_data_analysis/
---

# Muse Spark 1.3 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 10%, code mode 50%; rank 35 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/muse-spark-1.3/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/muse-spark-1.3/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time      |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | --------- |
| Tool calling | 10%   | 1 of 10      | $12.36 | 793      | 802        | 183.7 min |
| Code mode    | 50%   | 5 of 10      | $11.68 | 724      | 724        | 126.7 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

muse-spark-1.3 passed 6 of 20 runs: 1 of 10 in tool calling and 5 of 10 in code mode. All 14 failures ended the same way, hitting the 80-request limit (`UsageLimitExceeded`) with no answer and no SVG. None of the failures was a wrong answer. Every answer it did submit passed, so the problem is speed of convergence, not accuracy.

#### Where it does well

- It reads `/data/DATA.md` first and picks up the tricky rules:
  - repeat runs (`R27f8d4b1+2`, `R3a0dccd4+54`)
  - interpolated stop times (33484 in saturday_direct)
  - walk-adjusted departures
  - the 120 s change time
  - overnight runs past 86400 (after_midnight in code mode)
- Its SVGs were consistently valid: correct `east/35`, `600-north/35` transform, `data-run` on legs, `data-place` on platforms, and walks drawn without `data-run`.
- When it finished, it was right: one_vehicle got the same answer in both modes.

#### Mistakes it makes

- **It explores without converging.** It never commits to an answer. In saturday_direct (tools) it had found the right tram candidates by message 34, then spent about 120 more messages announcing it would "confirm nothing earlier".
  - It repeated the same `GROUP BY r.service` query at least 5 times.
  - It dropped and reloaded every table at message 129.
- **It sends multi-statement `run_sql` calls but gets only the last result.** Seen in saturday_direct: it then re-asks for the missing results, which wastes calls.
- **It makes many tiny calls.** In after_midnight (code mode) most `run_code` cells held one query (`count(*)`, `max(at)`, `LIMIT 20`). It traced candidate runs by hand and started planning a full search only around message 145 of 159.
- **The harder question types were never solved in either mode:**
  - tours (tour, timed_tour)
  - arrive_by
  - departure_profile
  - after_midnight
- **Passes were often tight:** meeting_point used 78 of 80 requests and saturday_direct 75.

#### Tool calling compared with code mode

Code mode was clearly better: 5 passes against 1. Every code-mode pass came from loading the files into Python, interpolating times, expanding repeats and enumerating journeys there (one_change, saturday_direct, walking_change, meeting_point). Tool calling has no way to run a search loop, so the model fell back on manual SQL lookups and timed out on 9 of 10 cases. That included three simple point-to-point cases code mode solved: saturday_direct, one_change and walking_change.

Code mode was also cheaper per pass. one_vehicle cost $0.71 in 51 requests against $2.07 in 73 with tools. Failures cost about $0.8–1.7 each in both modes.

## Runs

### one_vehicle

**Tool calling: passed.** Found a 399 s walk to Strehlener Platz, then bus run `R27f8d4b1+2` from `P0091960a` at 29940 to `P6e8c05a2` at 30480 (departure 29400). It passed, matching code mode exactly. ($2.07, 73 requests, 28.3 min)
- Right: Handled the repeat-run suffix `+2` and the walk-adjusted departure time (29940 − 399 → 29400 incl. rounding)
- Right: SVG uses the correct coordinate transform, has `data-run` on the leg, and draws the walk without a `data-run`
- Mistake: Expensive: 73 requests and $2.07, nearly three times the $0.71 code-mode cost, for a single-vehicle question

**Code mode: passed.** Same answer as tools mode: 399 s walk, then `R27f8d4b1+2` from `P0091960a` 29940 to `P6e8c05a2` 30480. Passed in 51 requests for $0.71. ($0.71, 51 requests, 8.9 min)
- Right: Correct repeat instance and walk handling
- Right: Cheapest pass in the set

### saturday_direct

**Tool calling: error.** Saturday trip from Spenerstraße to Anton-/Leipziger Str. It spotted tram candidates early (msg 34: `R2aa4cdd7` at `P8bf17a40` 33480), then looped and hit 80 requests with no answer. Code mode found tram 9 `Rb28d92d7` at 33484. ($1.58, 80 requests, 24.1 min)
- Right: Quickly narrowed to the right lines (tram 9/12) and the right time window
- Mistake: Sent multi-statement `run_sql` calls (e.g. msgs 5, 25, 137) but got back only the last statement's result, so it kept re-asking
- Mistake: Repeated the same `SELECT r.service, count(*) ... GROUP BY r.service` query at least 5 times (msgs 25, 57, 73, 97, 125)
- Mistake: Even dropped and reloaded all tables at msg 129
- Mistake: Kept saying it would 'confirm no earlier option' but never committed to an answer. It should have answered once the direct tram was verified.

**Code mode: passed.** Parsed the files, interpolated base times, expanded repeats, checked nearby walkable stations, and found tram 9 `Rb28d92d7` from `P7fa04a55` 33484 to `P1093f876` 34560. Passed in 75 requests. ($1.04, 75 requests, 7.2 min)
- Right: Handled an interpolated boarding time (33484) correctly
- Right: Switched to Python walk computation when `run_sql` truncated at 200 rows (msg 101)
- Mistake: Used 75 of 80 requests for a direct-tram question, partly on re-reading raw files (msg 61)

### one_change

**Tool calling: error.** Earliest arrival from Gret-Palucca-Straße to Pirnaischer Platz with at most 2 vehicles. Ran out at 80 requests ($0.79), and code mode solved it. ($0.79, 80 requests, 16.2 min)
- Right: Read the data description
- Mistake: Hand-explored candidate runs with SQL instead of enumerating all one- and two-vehicle combinations, and exhausted the budget

**Code mode: passed.** Loaded the timetable into Python, interpolated times and expanded repeats, then enumerated direct and two-vehicle journeys. The answer is `Rafeef850` 27669→27960, then `R620ec7d9` 28200→28440. Passed in 55 requests. ($0.90, 55 requests, 12.1 min)
- Right: Built a proper in-Python search (msgs 61–71) and checked the transfer walk plus the 120 s change time (msg 81)
- Mistake: The SVG drew every platform in the network as background dots, giving output of more than 216k characters. Harmless but bloated.

### walking_change

**Tool calling: error.** Friday 17:05 trip from Chemnitzer Straße to Marienberger Straße. Hit the 80-request limit, though code mode solved it (bus 62 + walk + tram 2). ($1.01, 80 requests, 9.0 min)
- Right: Read DATA.md
- Mistake: Did not search transfers that need a walk between platforms, and spent the budget on manual SQL

**Code mode: passed.** Bus `R76d2117b+4` from `Pff25da30` 61560 to `P86f9a261` 61920, walk, then tram `R3a0dccd4+54` from `P9cd5b9a9` 62458 to `P9e29d07a` 63480. Passed in 65 requests. ($1.03, 65 requests, 7.4 min)
- Right: Found a transfer that needs a walk, on repeat-run instances
- Right: SVG draws the walk dashed with no `data-run`

### after_midnight

**Tool calling: error.** Saturday 01:10 trip from Reichenbachstraße to Wasaplatz. The run used all 80 requests (159 messages) and never gave an answer or wrote an SVG. ($0.92, 80 requests, 9.3 min)
- Right: Read /data/DATA.md first, as the handbook says
- Mistake: Explored with many small `run_sql` calls and never built a systematic earliest-arrival search over the overnight runs. It hit the request limit without an answer.

**Code mode: error.** Correctly reasoned that Friday-service runs past 86400 (e.g. `Rca4e4824` at 90780) are the ones to use after 01:10 Saturday. Still issued one tiny `run_sql` per `run_code` call and only started planning a full search near msg 145. It hit 80 requests with no answer. ($1.11, 80 requests, 8.6 min)
- Right: Understood the overnight rule: answer time = previous-day run time − 86400
- Right: Checked that repeats of daytime runs do not reach the night window (msg 157)
- Mistake: Wasted many calls on trivial single queries (`count(*) FROM calls`, `max(at)`, `LIMIT 20` samples) instead of loading the data into Python in one cell
- Mistake: Traced runs by hand, checking station coordinates for each candidate run (msgs 103–115), instead of writing the search early

### arrive_by

**Tool calling: error.** Latest departure from Pohlandplatz that still reaches Lennéplatz by 18:00. The run used all 80 requests and gave no answer. ($1.20, 80 requests, 9.6 min)
- Right: Started from DATA.md and loaded the timetable into DuckDB
- Mistake: Kept issuing exploratory SQL without converging on a reverse (latest-departure) search, and ran out of requests before giving an answer

**Code mode: error.** Latest departure that still arrives by 18:00. Used all 80 requests with no answer. ($1.15, 80 requests, 11.0 min)
- Right: Used `run_code` with `run_sql`
- Mistake: Did not get to a working backward search within the budget

### departure_profile

**Tool calling: error.** List every worthwhile journey from Marienberger Straße to Altpieschen leaving between 07:00 and 08:00. Ran out of requests at 80, with no answer. ($1.27, 80 requests, 21.5 min)
- Right: Read the data rules first
- Mistake: A multi-journey profile query needs an algorithmic search. It stayed in manual SQL exploration and exhausted the budget.

**Code mode: error.** Departure-profile listing for 07:00–08:00. Ran out at 80 requests ($1.74, the most expensive code-mode case) with no answer. ($1.74, 80 requests, 24.1 min)
- Right: Worked in Python
- Mistake: Never produced the Pareto-filtered journey list before the limit

### meeting_point

**Tool calling: error.** Find the soonest meeting station for two friends. Hit the 80-request limit with no answer, although code mode solved the same case. ($1.07, 80 requests, 26.7 min)
- Right: Read DATA.md
- Mistake: Never computed earliest-arrival times from both origins to all stations, which a manual SQL approach cannot do in 80 calls

**Code mode: passed.** Found Albertplatz `Sbb9212fa` at 33701. Friend A takes 2 legs (`R465985dd` then `Rc0124950`) and friend B 1 leg (`Rfa439a34`, arriving 33692). Passed, at 78 of 80 requests. ($1.35, 78 requests, 17.3 min)
- Right: Correct meeting station and time, with both journeys and a valid SVG
- Mistake: Finished with only 2 requests to spare, so it barely made it

### timed_tour

**Tool calling: error.** Round trip from Pirnaischer Platz to 4 stations with opening-time windows. Hit the 80-request limit with no answer. ($1.11, 80 requests, 13.9 min)
- Right: Read DATA.md
- Mistake: A multi-stop, time-window tour needs a search over visiting orders. It never got past exploratory SQL.

**Code mode: error.** Tour with opening-time windows. Hit the 80-request limit with no answer. ($1.40, 80 requests, 17.1 min)
- Right: Worked in Python
- Mistake: Ran out of budget before combining point-to-point search with visit-order enumeration

### tour

**Tool calling: error.** Round trip from Hauptbahnhof visiting 5 stations. Ran out at 80 requests with no answer. ($1.34, 80 requests, 25.2 min)
- Right: Read DATA.md
- Mistake: Never built a pairwise earliest-arrival routine to compare visiting orders, and exhausted the budget

**Code mode: error.** Tour of 5 stations from Hauptbahnhof. Hit the 80-request limit with no answer. ($1.24, 80 requests, 12.9 min)
- Right: Worked in Python
- Mistake: Did not finish the visit-order search within 80 requests
