---
title: "Qwen3.5-Flash on Pydantic AI - Billing ops"
description: "Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 30%, code mode 40%; rank 40 of 44."
canonical: https://pydantic.dev/models/list/qwen3.5-flash-02-23/billing_ops/
---

# Qwen3.5-Flash on Pydantic AI - Billing ops

> Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 30%, code mode 40%; rank 40 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/qwen3.5-flash-02-23/billing_ops/. 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/billing_ops.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 | 30%   | 3 of 10      | $0.14 | 96       | 127        | 13.6 min |
| Code mode    | 40%   | 4 of 10      | $0.32 | 192      | 190        | 23.3 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

Qwen3.5-Flash passed 7 of 20 cases, 3 of 10 in tools mode and 4 of 10 in code mode. Every case that needed a single lookup passed in both modes: the invoice total and the void-and-reissue correction. Every case that needed a sum or a check across many records failed in tools mode. Cost was low, from $0.001 to $0.148 per case.

#### Where it does well

- **Multi-step changes:** both runs of `large-correction-2` chained `update_attendance` → `void_invoice` → `create_invoice` correctly, finding the student through `get_client`.
- **Scanning every record in code:** in code mode it fetched all 384 invoices with `asyncio.gather(get_invoice…)` and found the right IDs for duplicate_lines and missed_billed. In tools mode it got both wrong.
- It applied the rounding rules correctly when it got that far, e.g. 937.5 → 938, and 5250/4 → 1313 per student.

#### Mistakes it makes

- **Giving up and answering empty (4 tools cases):** duplicate_lines, missed_billed and both wrong_invoices. It checked a sample, said so ("I haven't exhaustively checked all 384 invoices… Given the time constraints"), and returned `[]` or a partial list.
- **Missing handbook rules (4 cases):** no check of `is_taxable` in either small tutor_margin run (the tools run was out by exactly 4×917). The two record_payment runs ignored existing allocations (tools put 50126 on an invoice with 37626 left) or skipped allocating entirely (code).
- **Bugs in code (5 cases):** `if num_charged == 0: continue` skipped tutor pay in both code tutor_margin runs. One run read a made-up `list_allocations` field on `get_invoice` and threw away a real 3563 allocation it had seen. The large wrong_invoices script found 4 of 12.
- **Hand arithmetic:** large tutor_margin in tools mode summed 67 lessons in its reasoning and was 4000 out.
- **Format:** in 10 of 20 runs the first answer was plain text, not `final_result`, and needed a validation retry.

#### Tool calling compared with code mode

Code mode won the bulk scans (duplicate_lines and missed_billed passed only there) but was more expensive: 44–50 requests and up to $0.148. Code mode lost small-owed_on_invoices, which tools passed, because of the made-up field. Neither mode got a margin right, and the code-mode margins were further off (72870 and 132341, against 61377 and 116741 in tools). In code mode it often made one awaited call per `run_code` instead of writing a whole script.

## Runs

### small-invoice_total-1

**Tool calling: passed.** One `get_invoice` call gave `total` 89700, which was correct. ($0.0010, 3 requests, 5 s)
- Right: Took the total straight from the record and checked it as net + tax
- Mistake: First answer was plain text and needed a validation retry, which cost one extra request

**Code mode: passed.** `await get_invoice(...)` returned a total of 89700, which was correct. ($0.0010, 3 requests, 5 s)
- Right: One code call
- Mistake: Its first answer was plain text, so it needed a validation retry

### small-owed_on_invoices-1

**Tool calling: passed.** Listed client CL-0007's unpaid invoices, called `list_allocations` for each, and computed 39452−3563+49315 = 85204, which was correct. ($0.0020, 6 requests, 12 s)
- Right: Took the existing 3563 allocation off INV-00155
- Mistake: Needed a validation retry because its first answer was plain text

**Code mode: failed.** Read allocations from a `list_allocations` field on `get_invoice` that does not exist. It got `[]` and answered 88767 instead of 85204, even though `list_allocations(client_id=…)` showed the 3563 allocation on INV-00155. ($0.0033, 8 requests, 18 s)
- Right: Found the right two unpaid invoices
- Mistake: Made up the key: `invoice.get('list_allocations', [])` always returned an empty list
- Mistake: Saw the real allocation (id 169, 3563 on INV-00155) and threw it away: 'I should trust the get_invoice result'

### large-tutor_margin-3

**Tool calling: failed.** Fetched tutor TU-002's 67 October lessons and their attendance, then worked out each lesson's margin by hand in its reasoning and summed them. It got 116741 against the expected 120741, 4000 short. ($0.017, 6 requests, 3.8 min)
- Right: Paid the tutor for lessons where every student missed, which gave negative margins such as -4800
- Right: Rounded split lessons correctly per student, e.g. 5250/4 → 1313
- Mistake: Did the sum of 67 lessons by hand, with recounting such as 'That's 4 entries of 1500, not 3', and ended up 4000 out
- Mistake: Said 'I'll trust my calculation but note that there could be small errors' and did not recheck
- Mistake: First final answer was plain text and needed a validation retry

**Code mode: failed.** Wrote a margin script over the October lessons and got 132341 against the expected 120741. ($0.021, 20 requests, 88 s)
- Right: Rounded gross tax per line as the handbook says, after first fixing a `quantize('0.01')` bug
- Mistake: Put `if num_charged == 0: continue` before the tutor-pay step, so the tutor was not paid for lessons where every student missed
- Mistake: Paid the tutor the rate once for `hourly_split` lessons, where the handbook says per hour
- Mistake: Did not check `is_taxable`

### small-tutor_margin-3

**Tool calling: failed.** Counted and computed Kai Iyer's 37 billable lessons correctly, including tutor pay for missed lessons, and got 61377 against the expected 65045. ($0.0081, 5 requests, 2.2 min)
- Right: Kept the two `cancelled` lessons out and still paid the tutor for the four lessons where the student missed
- Right: Rounded gross tax correctly, e.g. 5625/6 → 938 → net 4687
- Mistake: Never checked the clients' `is_taxable`. The 3668 shortfall equals 4 × 917 of gross tax it took off client CL-0037's 5500 History lessons, which are untaxed for a non-taxable client

**Code mode: failed.** Pasted the attendance data into its script by hand and computed a margin of 72870 against the expected 65045. ($0.012, 8 requests, 1.6 min)
- Right: Left out the cancelled lessons and handled split charge types in the code
- Mistake: `continue` on lessons with no charged students skipped tutor pay, so tutor pay came to 110902 instead of 122390
- Mistake: Computed gross net as `round(cost/1.2)` (4688) instead of cost − round(tax) (4687)
- Mistake: Did not apply `is_taxable` for CL-0037

### large-duplicate_lines-1

**Tool calling: failed.** Listed the October invoices, opened them one by one with `get_invoice` (around 35, the INV-0577x–0578x range), found no duplicates and answered `[]`. The expected answer was INV-06060, INV-06073 and INV-06097. ($0.0096, 7 requests, 29 s)
- Right: Correct method: look for a repeated (`lesson_id`, `student_id`) pair within each invoice's lines
- Mistake: Stopped after a sample of the 384 non-void invoices and said 'Based on my extensive checking of many invoices (at least 35+)'. It never reached the INV-060xx range where the duplicates are
- Mistake: Took the sample as proof of a negative answer, reasoning that 'the system appears to properly prevent such duplicates'

**Code mode: passed.** Fetched all 384 non-void October invoices in batches with `asyncio.gather(get_invoice…)`, counted (`lesson_id`, `student_id`) pairs and found the three expected invoices. Passed. ($0.027, 23 requests, 68 s)
- Right: Checked every invoice, not a sample
- Right: Rechecked INV-06060 with a `Counter`
- Mistake: Spread the work over 23 requests in batches of about 60, where one loop could have done it

### large-missed_billed-1

**Tool calling: failed.** Sampled invoices and attendance, relied on the `invoiced=false` flag on missed records, and answered `[]`. The expected answer was INV-05821, INV-05846 and INV-06080. ($0.021, 13 requests, 79 s)
- Right: Read the question correctly: invoice lines for students whose attendance is `missed`
- Mistake: Admitted 'I haven't exhaustively checked all 384 invoices… Given the time constraints, I'll proceed', then answered empty
- Mistake: Trusted the attendance `invoiced` flag instead of comparing invoice lines with attendance
- Mistake: First final answer was plain text and needed a validation retry

**Code mode: passed.** Checked every invoice's lines against `list_attendance` over 44 requests, found INV-05821, INV-05846 and INV-06080, and checked each one again. Passed. ($0.081, 44 requests, 10.0 min)
- Right: Checked all 384 invoices
- Right: Ran a final pass confirming the student with `missed` status on each
- Mistake: Expensive: 44 requests and $0.081, the second-highest cost in the run

### large-wrong_invoices-1

**Tool calling: failed.** Spot-checked invoices over 21 requests, confirming tax rules client by client with `get_client`, found nothing and answered `[]`. Twelve invoices were expected. ($0.042, 21 requests, 2.8 min)
- Right: Checked `is_taxable` before treating a tax of 0 as an error
- Mistake: Gave up: 'Given the time I've spent… I cannot find any overcharged invoices among the ones I examined'
- Mistake: Never systematically recomputed the 384 invoices, so it missed duplicated lines, charges for missed students, and wrong rates and tax

**Code mode: failed.** Recomputed all 384 invoices in batches over 50 requests ($0.148) and reported 4 overcharged invoices (INV-06080, INV-06016, INV-05877, INV-06017). Twelve were expected. ($0.15, 50 requests, 6.7 min)
- Right: Covered every invoice and got the four it reported right to the penny
- Mistake: The recomputation missed 8 invoices, including the duplicate-line invoices (INV-06060/06073/06097) and missed-student invoices (INV-05821/05846) that it found itself in the separate duplicate_lines and missed_billed cases
- Mistake: Its final answer was plain text and needed a validation retry

### small-wrong_invoices-1

**Tool calling: failed.** Spot-checked invoices over 23 requests and found only INV-00162 (863, tax charged to a non-taxable client). It missed INV-00158, INV-00172 and INV-00176. ($0.039, 23 requests, 2.3 min)
- Right: Found the 863 tax error and checked it against `is_taxable`
- Mistake: Did not recompute every line of every invoice and stopped 'given the time constraints'
- Mistake: Its plain-text answer had to go through a validation retry

**Code mode: failed.** Recomputed lines for some invoices and found INV-00162 (863) and INV-00172 (600). It missed INV-00158 (4050) and INV-00176 (6000). ($0.021, 23 requests, 86 s)
- Right: Found a wrong rate (6500 instead of 6000) by recomputing from lesson data
- Right: Found tax charged to a non-taxable client
- Mistake: Did not find every wrong invoice and stopped with 2 of the 4

### large-correction-2

**Tool calling: passed.** Found student `ST-0332` under client `CL-0234`, found lesson `LS-045235`, then called `update_attendance` (missed), `void_invoice` and `create_invoice` with the other three lessons, all dated 2026-11-13. Passed. ($0.0029, 8 requests, 17 s)
- Right: Worked out that Yara Baker is a student of client Freya Baker through `get_client`
- Right: Narrowed `list_lessons` to the single day, which gave the lesson ID straight away
- Right: Took the three remaining lines from the voided invoice's response, so no extra lookup was needed
- Mistake: Its first final answer was plain text, not `final_result`, so it took a validation retry to finish

**Code mode: passed.** Ran the same steps as in tools mode in separate `run_code` calls: looked up the client, lesson and attendance, then `update_attendance`, `void_invoice` and `create_invoice`. Passed. ($0.0034, 9 requests, 19 s)
- Right: Checked attendance (`attended`, `invoiced: true`) and the invoice before changing anything
- Mistake: One awaited call per `run_code` (9 requests) and no batching; this did no harm here
- Mistake: First call used a tool name directly, `search_clients`, and got 'Unknown tool name'

### large-record_payment-1

**Tool calling: failed.** Found `CL-0294` and listed the unpaid invoices, then called `record_payment` with all 50126 allocated to INV-02840. That invoice only had 37626 left to pay, and the expected 12500 to INV-03247 was missing. ($0.0017, 4 requests, 13 s)
- Right: Found the client, converted £501.26 to 50126, and applied the payment oldest due date first
- Mistake: Compared the payment with INV-02840's full `total` of 58778 and never called `list_allocations`, so it missed the part already paid. It should have allocated 37626 to INV-02840 and the remaining 12500 to INV-03247

**Code mode: failed.** Called `record_payment` with `allocations=[]`, so the whole 50126 was left as unallocated credit. The expected allocations were 37626 to INV-02840 and 12500 to INV-03247. ($0.0014, 4 requests, 11 s)
- Right: Found the client after correcting `clients[0]["client_id"]` to `["id"]`
- Mistake: Ignored the handbook rule that a payment is applied to unpaid invoices oldest due date first, and never listed the invoices or their allocations
- Mistake: First call used `search_clients` as a direct tool and got 'Unknown tool name'; then a `KeyError: client_id`
