Menu

1 / 4

73 comments later: what we changed so a retrying AI agent doesn't pay twice

DEV Community: api·whiteknightonhorse·about 6 hours ago
#4ckrMQOz
#devtoapi#devto#dev#order#agent
Reading 0:00
15s threshold

Last week I wrote about how we stop an AI agent from paying twice when it retries a paid API call . It got 309 views and 73 comments from 11 people, and most of the comments found a real gap.

This is the follow-up: what each gap was, what we changed, and what is still on the list. Everything below is live on our gateway unless I say otherwise.

The 409 looked final

Lin pointed out that many agent runtimes treat any 409 as terminal. Our payment_in_flight answer said "retry shortly" in prose and nothing else, so a runtime would give up and mint a fresh payment id on the next step.

The in-flight 409 now carries the fields a program can act on:

retry_after : 5 seconds

poll : shop.order.get , the call that shows the order state

order_id , when the order already exists

The agent guide says it plainly: payment_in_flight is not final. Wait retry_after seconds and send the same id again, or read the order.

A crashed request kept its id hostage

Samii asked what happens when the first request dies outright.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.