agent failed to convert currency: rate api returned 500 mid-run
Makes agent currency conversion resilient to rate-API outages with caching and a fallback provider. Use when a rate API 500s mid-run break currency conversion. Not for wrong-rate disputes.
TL;DR
The rate API is down, but the audit does not have to stop. Cache the last good rates with their dates, fall back to a secondary rate source on 500s, and mark converted amounts with their rate source so finance can see which figures used fallback rates.
Error
agent failed to convert currency: rate api returned 500 mid-runSteps
- Catch the 500 per conversion instead of letting it abort the run. Expected: the failure is isolated to the rate lookup.
- Serve the last cached rate for the currency pair and date, marked as cached. Expected: conversion continues with slightly stale rates.
- If no cached rate exists, try a secondary rate provider. Expected: a fresh rate from the fallback source.
- Record the rate source and date on every converted amount. Expected: an audit trail showing which conversions used fallback rates.
- When the primary API recovers, optionally refresh the fallback conversions. Expected: final figures use primary rates where it matters.
When to use
- A rate API returns 500s mid-run.
- Currency conversion is one step in a larger audit, not the whole job.
When not to use
- The rate returned is wrong but the API is healthy (see the FX rate skill).
- No rate exists for an exotic currency pair (handle as unconvertible).
Tool compatibility
- Exchange-rate APIs; custom agent conversion steps.
Variant phrasings
Rate service unavailable during conversion
Same outage, generic wording.
Currency API 500 mid-audit
The HTTP-level phrasing of the same failure.
Why it happens
Rate APIs have outages like any service, and agents that treat the API as infallible halt the entire audit on the first 500. Cached and fallback rates keep the run moving.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_rgRu2w3JCTqNzvxlwYoUsg