---
title: "Qwen3.8 27B on Pydantic AI - Billing ops"
description: "Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 70%, code mode 30%; rank 21 of 44."
canonical: https://pydantic.dev/models/list/qwen3.8-27b/billing_ops/
---

# Qwen3.8 27B on Pydantic AI - Billing ops

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

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 70%   | 7 of 10      | $1.62 | 99       | 967        | 40.3 min |
| Code mode    | 30%   | 3 of 10      | $0.14 | 60       | 65         | 24.4 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

Qwen3.8-27B passed 10 of 20 cases: 7 of 10 in tool calling and 3 of 10 in code mode. Every failure came from the same habit: it calls `final_result` too early, often with a made-up answer, and often straight after writing down a next step it never takes. Only one failure had a different cause, an HTTP 400.

#### Where it does well

- **Simple lookups (3 of 4 passed):** `small-invoice_total-1` passed in both modes, and `small-owed_on_invoices-1` passed in tool mode, where it subtracted the unreleased 3563p allocation.
- **Hand arithmetic is careful when it finishes:** both tutor-margin cases passed in tool mode (65045 and 120741), with correct half-up rounding of splits and gross tax.
- **Changes to the books:** in tool mode both `large-correction-2` and `large-record_payment-1` matched the expected diff exactly, including void → credit → reissue paid from credit.
- `small-wrong_invoices-1` (tools) found all four kinds of error, though it cost $0.52.

#### Mistakes it makes

- **Placeholder or invented final answers (8 of 10 failures).** It submitted `ids: []` while saying "continue with page 2" (duplicate_lines, tools). It submitted dummy rows `CL-0001: 100` after finding real duplicates (wrong_invoices, tools). In code mode it invented 11395, 40100, `IN-1107`/`IN-1119` and an `IN-...` reissue without making any change or call, in 4 cases on its first or second turn.
- **Large scans one invoice at a time in tool mode:** it called `get_invoice` per invoice across about 384 invoices. That put 212k–648k characters into the context, and `large-missed_billed-1` ended in HTTP 400.
- **Corrupted code arguments:** code came out cut off at `name=`, with `\r` injected, or as nonsense like `get_batch(Object):nid_list)`. It also restarted the session by accident and sent dependent calls at the same time (2 failures).

#### Tool calling compared with code mode

Tool calling did much better: 7/10 against 3/10. Code mode failed 6 cases that tool mode passed: correction, record_payment, owed, small tutor_margin, small wrong_invoices, and large-correction. Most of those failures were invented answers given with almost no calls, at 1–3 requests. When code mode did stick at a task, it helped on large scans. `large-duplicate_lines-1` passed only in code mode ($0.04, against a tool-mode failure), and large tutor_margin cost $0.05 against $0.23. Code mode is cheaper per case, but this model often doesn't use the sandbox at all, or sends code that is cut off or garbled.

## Runs

### small-invoice_total-1

**Tool calling: passed.** It made one `get_invoice` call and read off the total of 89700, then checked it by adding up the lines. It passed. ($0.0036, 2 requests, 3 s)
- Right: Took the most direct route: 2 requests

**Code mode: passed.** Its first call failed because `json` was not imported. After fixing that it read the total, 89700. It passed. ($0.0045, 3 requests, 4 s)
- Right: Recovered quickly from the missing import
- Mistake: Wasted one request on the `json` error

### small-owed_on_invoices-1

**Tool calling: passed.** It made the calls `search_clients`, `list_invoices(status=unpaid)` and `list_allocations`, then worked out (39452−3563) + 49315 = 85204. It passed. ($0.0034, 4 requests, 5 s)
- Right: Subtracted the 3563p credit allocation, which had no release date, from INV-00155
- Mistake: Ran one redundant `list_allocations` by client alongside the calls for each invoice

**Code mode: failed.** Two `run_code` calls arrived cut off at `search_clients(name=`. After a retry it found CL-0007, then submitted the made-up figure 40100 without fetching invoices or allocations. It failed. ($0.0031, 3 requests, 3 s)
- Right: Found the right client, CL-0007
- Mistake: Its stated next step was to fetch the unpaid invoices, but it submitted an invented 40100 instead. It should have called `list_invoices` and `list_allocations` (answer 85204)

### large-tutor_margin-3

**Tool calling: passed.** It worked out each lesson's net charge and tutor pay by hand: 360316 − 239575 = 120741. That is correct. ($0.23, 12 requests, 3.4 min)
- Right: Applied half-up rounding correctly to split costs and gross tax (for example 1312.5 → 1313 and 812.5 → 813)
- Right: Handled non-taxable gross lessons correctly
- Mistake: Called `get_settings` again after it already had the final answer, and kept long running totals in its own reasoning instead of letting a tool add them up

**Code mode: passed.** In code it computed the net charge and tutor pay for every lesson and printed `MARGIN: 120741`. It then tried to cross-check against invoices, ran into the limit of 100 calls per run, and submitted 120741. That is correct. ($0.049, 12 requests, 12.8 min)
- Right: Put all the arithmetic in code, so the sum came straight out of the program
- Mistake: After it already had the answer, it spent requests on an invoice cross-check that pulled in about 100 `get_invoice` results

### small-tutor_margin-3

**Tool calling: passed.** It worked through every lesson by hand and got net charges of 187435 and tutor pay of 122390, a margin of 65045. It passed. ($0.086, 13 requests, 89 s)
- Right: Checked each lesson's length and the rounding (1687.5 → 1688, 937.5 → 938)
- Right: Left out the cancelled lesson and counted the `missed_chargeable` lesson as billable

**Code mode: failed.** With no tool call at all, it submitted the made-up figure 11395 right after planning to look up the tutor. It failed. ($0.0008, 1 requests, 2 s)
- Right: Its plan restated the margin rules correctly
- Mistake: Gave a number on its first turn without fetching any data (expected 65045)

### large-duplicate_lines-1

**Tool calling: failed.** It listed the October invoices and called `get_invoice` one invoice at a time across page 1. After its own note "Still nothing. Let's continue with page 2", it called `final_result` with `{"ids": []}`, so it failed. ($0.071, 7 requests, 40 s)
- Right: Read the question correctly: it was looking for repeated (lesson_id, student_id) pairs inside one invoice
- Mistake: At the final turn it said it would go on to page 2 (INV-05861 onward) but submitted an empty answer instead. The three duplicate invoices (INV-06060, INV-06073, INV-06097) are on later pages
- Mistake: Fetched each invoice with its own `get_invoice` call, which put about 212k characters into the context

**Code mode: passed.** It looped over the 384 non-void October invoices in code to find repeated (student, lesson) pairs, then fetched the 3 hits again to confirm them. It returned INV-06060, INV-06073 and INV-06097, which is correct. ($0.041, 17 requests, 42 s)
- Right: Did the duplicate check in code instead of reading through the records itself
- Right: Checked the three hits before answering
- Mistake: Needed 17 requests, though it still cost only $0.04

### large-missed_billed-1

**Tool calling: error.** It started fetching every October invoice with `get_invoice` so it could check attendance. After 13 requests and about 648k characters of results, the provider returned HTTP 400 `Invalid request`. ($0.36, 13 requests, 5.7 min)
- Right: Read the question correctly: the target was invoice lines for students marked `missed`, which is different from `missed_chargeable`
- Mistake: Fetched the full detail of hundreds of invoices into the conversation. The request most likely became too large, and the provider rejected it with HTTP 400 before any attendance was checked

**Code mode: failed.** Its code arguments came out garbled (`async def batch(inv'):null`, `get_batch(Object):nid_list)`), and an accidental `restart: true` wiped its saved state. It rebuilt the invoice list (384 non-void) and then submitted `INV-05765` without having checked any invoice, so it failed. ($0.021, 12 requests, 10.4 min)
- Right: Noticed the state had been lost and rebuilt `inv_store` correctly
- Mistake: Sent malformed or cut-off code several times and set `restart: true` by mistake
- Mistake: Sent two dependent `run_code` calls at the same time
- Mistake: Right after saying it would look at one sample invoice, it submitted an invoice ID it had never checked

### large-wrong_invoices-1

**Tool calling: failed.** Over 27 requests it fetched October invoices and spotted the duplicates on INV-06060 and INV-06073 and the tax on non-taxable INV-05851 and INV-06016. Then it submitted made-up placeholder rows `CL-0001: 100, CL-0002: 200`, so it failed. ($0.32, 27 requests, 2.7 min)
- Right: Identified several kinds of planted error along the way (duplicate lines, tax charged to non-taxable clients)
- Mistake: On its final turn its notes said "Continuing: 06077-06104", yet it called `final_result` with dummy client IDs and amounts that had nothing to do with its findings
- Mistake: Never got as far as recomputing the cost of each line

**Code mode: failed.** It wrote out a full plan, then called `final_result` with `{"rows": []}` without running any code. It failed. ($0.0039, 1 requests, 5 s)
- Right: Its plan was sound: recompute the cost and tax of each line and compare with what was billed
- Mistake: Submitted an empty answer on its first turn when it should have run the plan

### small-wrong_invoices-1

**Tool calling: passed.** It fetched all 37 October invoices together with lessons and attendance, and found 4 overcharges: INV-00158 4050, INV-00162 863, INV-00172 600 and INV-00176 6000. It passed. ($0.52, 5 requests, 5.7 min)
- Right: Found four different kinds of error: a duplicate line, tax charged to a non-taxable client, a wrong rate, and a charge for a student marked `missed`
- Right: Checked its work again and caught the LS-001346 `missed` line it had missed on the first pass
- Mistake: At $0.52 it was the most expensive case, because about 280k characters of records went through the context

**Code mode: failed.** It listed the 37 invoices and settings. Its next code arrived cut off or with `\r` characters injected, and after two no-op calls it submitted `{"id": "none", "pence": 0}`. It failed. ($0.011, 7 requests, 13 s)
- Right: Got the invoice list and settings in one run
- Mistake: Its tool arguments were corrupted (truncated strings, `\r` inside quoted strings), and it did not fall back to simpler code it could have retried
- Mistake: Submitted a dummy row instead of checking the invoices, when tool mode found all 4 answers on the same data

### large-correction-2

**Tool calling: passed.** It found client CL-0234 and student ST-0332, marked LS-045235 as `missed`, voided INV-06372 and reissued it as INV-06548 (17100p, paid from credit). Every change matched the expected diff, so it passed. ($0.018, 8 requests, 33 s)
- Right: Took the void and reissue steps in the right order, which turned the 22800p payment into credit that then paid the new invoice
- Right: Checked the ledger afterwards and confirmed the client was left with 5700p of credit, the price of the dropped lesson
- Right: Gave an accurate summary that named LE-013560, INV-06548 and the due date

**Code mode: failed.** It ran two `run_code` calls that found CL-0234 and ST-0332. Then it called `final_result` with a summary saying it had voided the invoice and reissued it as `IN-...`, although it had made no changes, so it failed. ($0.0034, 3 requests, 5 s)
- Right: Worked out correctly that Yara Baker is a student of client Freya Baker
- Mistake: Its very next step was meant to find the lesson and the invoice. Instead it reported changes it had never made, with a placeholder invoice number. It should have gone on to update the attendance, void INV-06372 and reissue the invoice

### large-record_payment-1

**Tool calling: passed.** It recorded payment LE-013560 of 50126p with `record_payment`. The system put 37626p on INV-02840 and 12500p on INV-03247, and it confirmed this with `list_invoices`. It passed. ($0.015, 8 requests, 20.0 min)
- Right: Took into account an earlier allocation of 21152p on INV-02840, so its figure for what was left on that invoice was correct
- Right: Checked the unpaid list after recording, and its summary matched the expected allocations

**Code mode: failed.** With no tool call at all, it submitted a summary claiming it had recorded the payment against invented invoices `IN-1107` and `IN-1119` and left £200 of credit. It failed. ($0.0018, 1 requests, 3 s)
- Mistake: Called `final_result` straight after planning to search for the client. It should have called `search_clients`, then `record_payment`
