---
title: "Qwen3.8 Max (0902) on Pydantic AI - Billing ops"
description: "Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 90%, code mode 100%; rank 4 of 44."
canonical: https://pydantic.dev/models/list/qwen3.8-max-0902/billing_ops/
---

# Qwen3.8 Max (0902) on Pydantic AI - Billing ops

> Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 90%, code mode 100%; rank 4 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/qwen3.8-max-0902/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.8-max-0902/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 90%   | 9 of 10      | $6.36 | 128      | 679        | 79.6 min |
| Code mode    | 100%  | 10 of 10     | $0.99 | 131      | 138        | 32.9 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

19 of 20 cases passed: 9/10 in tool calling and 10/10 in code mode. The one failure was `large-wrong_invoices-1` in tool calling, where the model reported 6 of the 12 overcharged invoices. No case hit a provider error. All 4 write tasks (`correction`, `record_payment`) produced exactly the expected changes in both modes.

#### Where it does well

- **Write tasks.** It applies the handbook's rules correctly: void → credit note → allocations released (`released_on`) → reissued invoice paid from credit, and payments allocated oldest due date first.
- **Arithmetic.** Margins (120741, 65045), outstanding totals and per-line overcharges were exact in every case. That includes gross-priced lines and half-up rounding.
- **Spotting the planted errors.** In both modes it compared the voided invoices with their replacements to work out what kinds of error were planted.
- **Self-correction in code mode.** It found a bug in its own missing-lines check (it needed a `client_id` filter). It also saw that comparing line by line cannot catch repeated lines, so it re-totalled each invoice from unique lesson/student pairs.

#### Mistakes it makes

- **Narrowing the search because of context (1 failure).** In the tool-calling `large-wrong_invoices-1` run, it judged that ~384 `get_invoice` calls and ~384 `get_client` calls were too many. It fell back on proxies instead: a tax/total ratio check and a scan for `missed`+`invoiced:true` attendance rows. It never re-priced invoice lines and never looked for repeated lines, even though it had listed both as possible errors. That missed 3 wrong-rate invoices (600, 750, 500) and 3 invoices with a repeated line (3563, 4500, 9900).
- **Brute-force reading in tool calling.** `duplicate_lines`, `missed_billed` and `small-wrong_invoices` passed only because it read hundreds of records directly into its context. Along the way it kept noting that its context was nearly full, and the runs cost $1.72, $1.20 and $0.93.

#### Tool calling compared with code mode

Code mode was more accurate (10/10 against 9/10) and far cheaper: about $0.99 in total against $6.36. On the large audit tasks the gap was 7–26×: `duplicate_lines` $0.067 against $1.72, `wrong_invoices` $0.28 against $2.01, `missed_billed` $0.092 against $1.20. Code mode could run `asyncio.gather` over all invoices, lessons, attendance and clients, keep the results in variables and re-price everything. Tool calling had to choose between running out of context and checking only part of the data; in the one failure it checked only part. On small or single-step tasks the two modes performed about the same.

## Runs

### small-invoice_total-1

**Tool calling: passed.** Answered 89700 in 2 requests. Passed. ($0.014, 2 requests, 13 s)
- Right: Low cost and correct

**Code mode: passed.** Answered 89700 in 3 requests. Passed. ($0.015, 3 requests, 14 s)
- Right: Correct

### small-owed_on_invoices-1

**Tool calling: passed.** Answered 85204 in 5 requests. Passed. ($0.024, 5 requests, 15 s)
- Right: Correct outstanding sum

**Code mode: passed.** Answered 85204 in 3 requests. Passed. ($0.018, 3 requests, 27 s)
- Right: Correct

### large-tutor_margin-3

**Tool calling: passed.** Worked out a margin of 120741 pence, which is correct. ($0.22, 9 requests, 6.7 min)
- Right: Correct figure in 9 requests

**Code mode: passed.** Answered 120741. Passed. ($0.15, 16 requests, 5.3 min)
- Right: Correct
- Mistake: 16 requests, against 9 in tools mode

### small-tutor_margin-3

**Tool calling: passed.** Answered a margin of 65045 in 9 requests. Passed. ($0.14, 9 requests, 4.6 min)
- Right: Correct

**Code mode: passed.** Answered 65045 in 9 requests. Passed. ($0.065, 9 requests, 2.7 min)
- Right: Correct, for half the tools-mode cost

### large-duplicate_lines-1

**Tool calling: passed.** Called `get_invoice` by hand on roughly 384 non-void October invoices, in batches of about 20–30, and found the repeated lines in INV-06060, INV-06073 and INV-06097. Passed. ($1.72, 22 requests, 8.8 min)
- Right: Re-ran pages 2–4 with the `sent_from`/`sent_to` filter after page 2 came back unfiltered
- Right: Finished the full scan, so the answer is complete
- Mistake: It kept noting in its reasoning that context was 'critical', at about 200k tokens. This brute-force read of every invoice cost $1.72, about 26× the code-mode run ($0.067)
- Mistake: It spent a lot of reasoning looking for a cheaper signal and never found one

**Code mode: passed.** Fetched all the invoices in `run_code` and found the repeated lines programmatically. Correct 3 ids for $0.067. ($0.067, 15 requests, 4.9 min)
- Right: Batched `asyncio.gather` calls kept the raw data out of context

### large-missed_billed-1

**Tool calling: passed.** Found INV-05821, INV-05846 and INV-06080, which bill students marked `missed`. Passed. ($1.20, 17 requests, 45 s)
- Right: Correct ids
- Mistake: Cost $1.20 over 17 requests, against $0.092 in code mode: the same pattern of reading large record sets in context

**Code mode: passed.** Found the 3 invoices billing missed students. Passed, for $0.092 over 20 requests. ($0.092, 20 requests, 5.0 min)
- Right: Correct ids, cheaply

### large-wrong_invoices-1

**Tool calling: failed.** Out of 384 October invoices, it reported 6 of the 12 overcharged ones: three non-taxable clients charged tax, found with a tax/total ratio check, and three `missed` students billed, found by scanning about 30 `list_attendance` batches for `missed`+`invoiced:true`. Failed. ($2.01, 28 requests, 37.1 min)
- Right: Each of the 6 amounts it reported was exact (e.g. INV-05846 11700, INV-06105 1875)
- Right: It worked out from the voided/reissued invoices what kind of errors were planted
- Mistake: At step 13 it decided that calling `get_invoice` for every invoice and `get_client` for every client was too many calls. So it never re-priced invoice lines, and it missed the wrong-rate lines on INV-05791 (600), INV-05877 (750) and INV-06017 (500)
- Mistake: It never looked for repeated lines, and missed INV-06060 (3563), INV-06073 (4500) and INV-06097 (9900)
- Mistake: It spent most of the context on the missed-attendance scan, worried aloud about the token budget, and answered without checking the other error types it had itself listed (pricing errors and duplicates)

**Code mode: passed.** Ran `get_invoice` on all 384 non-void invoices, in batches of 90, plus `get_lessons`, `list_attendance` and `get_client`, then re-priced all 3108 lines with half-up rounding. That found 9 bad lines; a separate check for repeated lines found 3 more. All 12 overcharges were exact. Passed. ($0.28, 25 requests, 4.9 min)
- Right: Re-priced every line, covering split charges, gross/net and taxability
- Right: Caught its own bug: the missing-lines check needed a `client_id` filter
- Right: Realised that line-by-line matching can't see repeated lines, and re-totalled each invoice from unique lesson/student pairs

### small-wrong_invoices-1

**Tool calling: passed.** Found all 4 overcharged invoices with exact amounts (INV-00158 4050, INV-00162 863, INV-00172 600, INV-00176 6000). Passed. ($0.93, 20 requests, 18.3 min)
- Right: The small dataset fit in context, so it could check thoroughly
- Mistake: 20 requests and $0.93, against $0.18 in code mode

**Code mode: passed.** Found all 4 overcharged invoices with exact amounts. Passed. ($0.18, 24 requests, 6.5 min)
- Right: Correct, for $0.18

### large-correction-2

**Tool calling: passed.** Marked ST-0332 `missed` on LS-045235, voided INV-06372 (which released the 22800 allocation), and re-raised a 17100 invoice paid from credit. Every change matched the expected one. Passed. ($0.053, 8 requests, 69 s)
- Right: Followed the void → credit note → re-invoice → auto-pay-from-credit sequence correctly
- Right: Done in 8 requests for $0.053

**Code mode: passed.** Same correction as in tools mode: changed attendance, voided INV-06372, reissued a 17100 invoice paid from credit. Every change matched. Passed. ($0.066, 7 requests, 1.8 min)
- Right: 7 requests, $0.066

### large-record_payment-1

**Tool calling: passed.** Recorded the 50126 payment and allocated it oldest due first: 37626 to INV-02840, which is now paid, and 12500 to INV-03247. Passed. ($0.045, 8 requests, 1.8 min)
- Right: Allocation order and the status change were correct
- Right: 8 requests, $0.045

**Code mode: passed.** Recorded the payment and allocated 37626 to INV-02840 and 12500 to INV-03247. Passed. ($0.058, 9 requests, 72 s)
- Right: Correct allocations
- Mistake: Its summary says 12,504p is still owed on INV-03247; tools mode gave 12500p for the same invoice. The summary wasn't graded
