跳到正文
DEV Community· journeysofar·· 4 天前AI 評分58

AI 智能體請求逾時,不代表操作已失敗

A timeout is not proof that your AI agent failed

AI 導讀

Journey So Far 的原創練習指出,AI 智能體請求逾時或沒有回覆,不能證明底層操作失敗;盲目重試可能重複建立訂單、預約或提交。文章建議確認操作、請求 ID、狀態查詢方式及操作是否會改變狀態,再以明確的冪等性契約處理重試,並測試回應遺失、並行重試、操作失敗及狀態服務不可用等情況。

正文

An assistant submits a request, waits, and gets no reply. The tempting next step is “try again”. But a missing response does not tell us whether the underlying action happened. A second attempt could create a second order, booking or submission.

This makes a useful practice question for software developers moving into AI engineering: how would you find out what happened and decide what the assistant should do next?

Start by separating the conversation from the action. The model proposing a retry is not evidence that repeating the operation is safe. Identify the operation, its request ID, whether it changes state, and whether the tool exposes a status query. An explicit permission check may also be needed before a consequential action.

Then consider idempotency. A robust application can recognise that two requests represent the same intended action, rather than treating each transport attempt as a new instruction. That behaviour needs an explicit contract. Reusing a key with a different payload should not silently create ambiguity.

Testing the happy path is not enough. Include a response lost after successful processing, two concurrent retries, a genuinely failed operation and an unavailable status service. For each case, specify what can be confirmed, what remains unknown and when the system should stop or escalate.

Finally, explain the outcome honestly to the user. “I cannot confirm completion yet” may be a better response than claiming failure or creating another side effect. Record a bounded retry policy and a trace that makes the decision reviewable.

This is one possible reference approach, not a single employer's answer key. Before reading it, try explaining your own design in two minutes. What would you query? What would you refuse to repeat? Which failure would your test catch?

We make original scenarios like this at Journey So Far. Choose a role, practise a question, reveal a reference approach and explore free learning materials. No signup is needed.

Practice: https://journeysofar.net/en/singapore/explore/questions/?industry=it&role=it%3Aai_application&topics=rp-ai_application-2%3Atopic

Technical background, not the source of a copied interview question: https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/

Disclosure: this article is from Journey So Far, the site behind these exercises. The scenario is fictional and project-authored; it is not a reported company interview.

來源:DEV Community · dev.to