Write run_agent: total the refunds issued on an order

Agent buildMedium30 min

Money questions punish an agent that reports the first number it sees.

Your task

Write run_agent. It totals the refunds actually issued on an order.

  • search(query) returns the ids of documents containing that text, shortest first
  • fetch(doc_id) returns that document, or None when the id does not exist
  • the order's record lists its refund ids; each refund is stored under its own id, such as R-881
  • only refunds in state issued count; declined and pending ones have paid nothing
  • answer in whole euros, such as 35, or 0 when nothing was issued, or not found when the order has no record
  • each scenario carries a token budget; going over it fails that scenario

At submit the suite runs your agent against orders you have not seen, each with its own documents.