Check expense reports against company policy with AI
An agent reads a policy and a list of expenses and flags each violation with the clause it breaks.
- Files
- Budget cap
Watch a real run
A real run on Oct 7, 2026, replayed. Model: openai/gpt-6-luna.
- Queuedbudget $0.03 reserved
- MicroVMmicroVM ready
- MicroVMworker started · shell off · web off
- File
read expense-policy.md - File
read expenses.csv - MicroVMmicroVM destroyed
- Succeeded2 model calls, 3,564 tokensRecorded output (English)
{ "violations": [ { "line": 2, "clause": 1, "reason": "The expense includes wine, and alcohol is never reimbursed." }, { "line": 6, "clause": 2, "reason": "The $52 expense is missing a receipt." }, { "line": 7, "clause": 5, "reason": "The Sunday ride has no note naming a business reason." }, { "line": 9, "clause": 6, "reason": "This expense is an exact duplicate of line 10." }, { "line": 10, "clause": 6, "reason": "This expense is an exact duplicate of line 9." }, { "line": 5, "clause": 4, "reason": "$410 for two nights is $205 per night, exceeding the $180 limit." }, { "line": 12, "clause": 4, "reason": "$205 for one night exceeds the $180 per-night limit." } ], "needs_human": [ { "line": 2, "question": "How many people were covered by this meal, so the $60 per-person daily limit can be checked?" }, { "line": 3, "question": "Was this 11-hour business-class flight approved in advance by a director?" }, { "line": 6, "question": "Was the airport taxi taken for a business trip?" }, { "line": 7, "question": "Was this ride part of a business trip?" } ], "compliant_lines": 4 } - Worker destroyed$0.00491 charged, $0.02509 released
Run it yourself
Open the sample in the playground with the whole request filled in. It runs on your own account, within the budget shown, against the same read-only sample systems.
Budget for this sample: $0.03
How it works
Both the policy and the expense lines are read-only files. The answer cites the line number and the clause number for every flag, so a reviewer can verify it in seconds. Lines that comply are not listed.
What the agent can and cannot do
The permissions are part of the request. Anything not listed here is not available to the run.
| Setting | Allowed |
|---|---|
| Connections | None |
| Web | Off |
| Shell | Off |
| Files | expense-policy.md, expenses.csv (read-only) |
| Zero data retention | Off: the record is kept for 30 days |
| Budget | $0.03, a hard cap |
| Timeout | 60 seconds |
Credentials never enter the machine: a broker adds them to each call and enforces the methods above.
The code
This is the exact request the sample sends. Set EPHEMERAL_API_KEY to a member key of your organization.
curl -X POST $EPHEMERAL_URL/v1/runs \
-H "Authorization: Bearer $EPHEMERAL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d @request.jsonFiles in the request
Passed inline, so nothing is uploaded first. The agent sees each one as a read-only file.
expense-policy.md
# Expense policy
1. Meals: at most 60 USD per person per day. Alcohol is never reimbursed.
2. Every expense of 25 USD or more needs a receipt.
3. Flights: economy class only, unless the flight is longer than 8 hours and a director approved it in advance.
4. Hotels: at most 180 USD per night.
5. Taxis and rides: only for business trips; weekend rides need a note naming the business reason.
6. The same expense must not be claimed twice.
expenses.csv
line,date,employee,category,description,amount_usd,receipt,approved_by
1,2026-09-14,a.nguyen,meal,Team lunch (4 people),88.00,yes,
2,2026-09-14,a.nguyen,meal,Wine with client dinner,64.00,yes,
3,2026-09-15,b.keller,flight,Frankfurt to Tokyo business class (11h),4210.00,yes,
4,2026-09-15,b.keller,flight,Tokyo to Frankfurt economy (11h),980.00,yes,
5,2026-09-16,c.ortiz,hotel,Hotel Osaka 2 nights,410.00,yes,
6,2026-09-17,c.ortiz,taxi,Airport taxi,52.00,no,
7,2026-09-20,d.smith,taxi,Sunday ride home,31.00,yes,
8,2026-09-21,a.nguyen,meal,Breakfast,14.50,no,
9,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,
10,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,
11,2026-09-23,f.hall,meal,Dinner (1 person),47.00,yes,
12,2026-09-24,c.ortiz,hotel,Hotel Kyoto 1 night,205.00,yes,
Full request body request.json
The same body, with the files inline.
{
"prompt": "Check every line of expenses.csv against expense-policy.md. Reply with one JSON object and nothing else: {\"violations\": [{\"line\": number, \"clause\": number, \"reason\": string}], \"needs_human\": [{\"line\": number, \"question\": string}], \"compliant_lines\": number}. Report a violation only when the file proves it. When a rule cannot be checked from the data (for example advance approval), put the line in needs_human instead of guessing. A line can appear more than once if it breaks several clauses.",
"files": [
{
"path": "expense-policy.md",
"content": "# Expense policy\n\n1. Meals: at most 60 USD per person per day. Alcohol is never reimbursed.\n2. Every expense of 25 USD or more needs a receipt.\n3. Flights: economy class only, unless the flight is longer than 8 hours and a director approved it in advance.\n4. Hotels: at most 180 USD per night.\n5. Taxis and rides: only for business trips; weekend rides need a note naming the business reason.\n6. The same expense must not be claimed twice.\n"
},
{
"path": "expenses.csv",
"content": "line,date,employee,category,description,amount_usd,receipt,approved_by\n1,2026-09-14,a.nguyen,meal,Team lunch (4 people),88.00,yes,\n2,2026-09-14,a.nguyen,meal,Wine with client dinner,64.00,yes,\n3,2026-09-15,b.keller,flight,Frankfurt to Tokyo business class (11h),4210.00,yes,\n4,2026-09-15,b.keller,flight,Tokyo to Frankfurt economy (11h),980.00,yes,\n5,2026-09-16,c.ortiz,hotel,Hotel Osaka 2 nights,410.00,yes,\n6,2026-09-17,c.ortiz,taxi,Airport taxi,52.00,no,\n7,2026-09-20,d.smith,taxi,Sunday ride home,31.00,yes,\n8,2026-09-21,a.nguyen,meal,Breakfast,14.50,no,\n9,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,\n10,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,\n11,2026-09-23,f.hall,meal,Dinner (1 person),47.00,yes,\n12,2026-09-24,c.ortiz,hotel,Hotel Kyoto 1 night,205.00,yes,\n"
}
],
"shell": false,
"timeout_seconds": 60,
"max_cost_micros": 30000
}