--- license: cc-by-4.0 pretty_name: Gmail Corrected Invoice Test language: - en task_categories: - text-generation - question-answering tags: - agents - agent-evaluation - tool-calling - function-calling - email - gmail - accounts-payable - invoices - synthetic size_categories: - n<1K configs: - config_name: runs data_files: runs.jsonl default: true - config_name: tasks data_files: tasks.jsonl --- # Gmail Corrected Invoice Test [Blog post](https://layerlens.ai/blog/test-case-agent-corrected-invoice-emails?utm_source=huggingface&utm_medium=referral&utm_campaign=test-packs&utm_content=gmail-corrected-invoice-test&utm_term=readme) | [LayerLens](https://layerlens.ai/?utm_source=huggingface&utm_medium=referral&utm_campaign=test-packs&utm_content=gmail-corrected-invoice-test&utm_term=readme) 8 agents, each built on a different foundation model, ran once each on 1 question in a simulated Gmail inbox for an accounts payable team, the people who pay supplier bills. A supplier's invoice thread states 10,475 USD in message 1 and corrects it to 10,625 USD in message 3, and the question asks what the invoice should read. All 8 runs passed an exact-value grader that looked for 10625 in the answer. 5 of the 8 answers also contain the original 10,475 USD. The grade confirms that the corrected number appears; it does not show which message an agent relied on, and the buyer's reply in message 4 states 10,625 USD as well. The suppliers, buyer, invoices and email addresses are fictional, and every address ends in .example. All 8 runs happened inside LayerLens Environments, which simulates services such as Gmail so an agent can be tested on records with known answers. This pack holds the graded run records, not full traces; 1 of the 8 traces was read event by event. ## Load ```python from datasets import load_dataset runs = load_dataset("LayerLens/gmail-corrected-invoice-test", "runs", split="train") tasks = load_dataset("LayerLens/gmail-corrected-invoice-test", "tasks", split="train") ``` ## Results | Foundation model (as shown in LayerLens) | Grade | Answer contains 10,625 | Answer contains 10,475 | Tool calls | |---|---|---|---|---| | Claude Haiku 4.5 | Pass | Yes | Yes | 2 | | Claude Opus 5.5 | Pass | Yes | Yes | 2 | | Claude Sonnet 5 | Pass | Yes | Yes | 2 | | Claude Sonnet 5.5 | Pass | Not read | Yes | Not read | | Gemini 3.1 Pro Preview | Pass | Yes | No | 2 | | Gemini 3.8 Flash | Pass | Yes | Yes | 2 | | GPT-5.4 Mini | Pass | Yes | No | 3 | | GPT-5.5 | Pass | Yes | No | 2 | 8 of 8 passed. 5 of 8 answers mention 10,475 USD next to the corrected amount. Of the 7 runs whose traces were read, 6 used 1 search and 1 thread read, and the GPT-5.4 Mini run searched twice before reading the thread. The Claude Sonnet 5.5 run is counted from the task page only; its trace was not read. ## The task > Sundial Foundry corrected invoice INV-2025-0003 partway through the thread. What amount should it read, in USD? Known answer: 10625, recorded when the task was written (task version 1). Every run got the same short instruction: work against a Gmail API with the tools given, then reply with a final answer in plain text. Nothing in it mentions invoices. The thread an agent has to read holds 5 messages: | Position | From | Text | |---|---|---| | 1 | Supplier | Invoice INV-2025-0003 is for 10,475 USD and is due on 2025-08-26. | | 2 | Buyer | Received INV-2025-0003 and routed it to approvals. | | 3 | Supplier | Correction: INV-2025-0003 should read 10,625 USD, not 10,475 USD. A freight line was left off it. | | 4 | Buyer | Updated INV-2025-0003 to 10,625 USD. Payment is scheduled for 2025-08-26. | | 5 | Supplier | Payment reference PAY-2025-0003 will appear on your statement for INV-2025-0003. | ## The environment `gmail-ap-inbox`, version 2, in LayerLens Environments: 1 buyer's mailbox with 8 threads and 22 messages. An agent can call 6 tools, all reads: `get_label`, `get_message`, `get_profile`, `get_thread`, `list_labels` and `search_messages`. None of them sends mail, edits an invoice or moves money. ## 1 run, step by step The Claude Sonnet 5 run (run `corrected-invoice-claude-sonnet-5`, read from a field-by-field copy of the original trace) made 2 tool calls: 1. `search_messages` with `q: "INV-2025-0003"` returned 5 message IDs, all in 1 thread. 2. `get_thread` on that thread returned all 5 messages. Its answer: > The corrected amount for INV-2025-0003 is **10,625 USD** (up from the original 10,475 USD, due to a freight line that had been omitted). The due date remained 2025-08-26. The run used 7,940 input tokens and 176 output tokens and cost 0.01764 USD. The trace records no text from the foundation model between tool calls, so it does not show which message the answer came from. ## What the grader checks and what it does not The grader is an exact-value check with a numeric match against the recorded answer, 10625. Its logged reason for the inspected run: `looked for "10625" in the agent's answer`. It does not check: - which message an agent used. Messages 3 and 4 both state 10,625 USD. - whether the answer presents 10,475 USD as a past amount or as the amount to pay. Whether an answer that asserts 10,475 as final but mentions 10,625 would pass is a Marin question. A probe for it was written but not run, because this grader runs only inside environment runs and the catalog graders that score imported traces are judges, not exact-value checks. - any ledger. The environment holds no invoice object, so the known answer is the value recorded with the task. ## Reproduce on LayerLens In LayerLens Environments, open `gmail-ap-inbox` version 2, task set `invoice_corrected_amount`, and run the task on an agent. Each attempt is graded by the exact-value check and saved as a trace with its tool calls, answer and grade. Whether this environment is open to accounts outside the LayerLens team is a Marin question. ## Limitations - 8 runs, 1 per foundation model, on 1 thread in 1 small mailbox. The pack does not show how often any foundation model answers this way. - 7 of the 8 rows come from showcase copies of the original traces, read for tool sequence, amounts and grade. Only the Claude Sonnet 5 copy was compared field by field with its original trace. - The Claude Sonnet 5.5 row comes from the task page: grade and whether the answer contains 10,475. No trace ID or tool-call count was read for it. - Full answer text is in the pack for 1 run. The other rows record only whether each amount appears. - The trace metadata says `provider: "simulated"` while LayerLens shows the foundation model served by its provider. The pack reads this as the simulated Gmail service; confirming it is a Marin question. - These runs happened inside the LayerLens product and cannot be rerun from this pack. ## Files | File | Contents | |---|---| | `runs.jsonl` | 1 row per run: run key, foundation model, grade, amounts in the answer, tool calls | | `tasks.jsonl` | The task, the answer key, the grader, the instruction and the 5 thread messages | ## Citation ```bibtex @misc{layerlens2026gmailcorrectedinvoice, title = {Gmail Corrected Invoice Test}, author = {{LayerLens}}, year = {2026}, howpublished = {\url{https://huggingface.co/datasets/LayerLens/gmail-corrected-invoice-test}} } ```