面试题库
共 328 题,当前筛选 1 题。
课程全部30 天从前端工程师到 Agent 工程师5 天提示词工程零基础Claude 高效使用:从对话到 Claude CodeCodex 与 OpenAI Agents SDK 高效使用7 天 MCP:把工具接进任何 Agent7 天 Agent Skills:把经验做成可复用能力5 天上下文工程14 天 RAG:从检索到可信回答14 天用 Agent 搭一条 AI 短剧生产线
标签
全部#ux1#reliability10#cost9#observability7#architecture5#streaming5#api-design4#deployment4#distributed-systems4#error-handling4#idempotency3#message-bus3
还有 92 个标签收起标签
#operations3#rag3#security3#tool-calling3#cost-control2#langgraph2#latency2#mcp2#model-routing2#multi-agent2#ordering2#protocol2#react2#redis-streams2#routing2#sse2#system-design2#agent-design1#agent-loop1#agent-quality1#async1#atomicity1#auth1#behavioral1#capacity-planning1#checkpointing1#chunking1#communication1#compression1#concurrency1#context-compression1#context-engineering1#data-modeling1#database1#debugging1#deliberate-practice1#docker1#documentation1#engineering-tradeoffs1#evaluation1#event-driven1#fan-out1#forking1#framework-design1#framework-selection1#interrupt-merge1#interview-prep1#isolation1#knowledge-organization1#lease1#loop-guard1#mobile1#multi-tenancy1#nodejs1#orchestration1#performance1#persistence1#pgvector1#portfolio1#prompt-engineering1#provider-abstraction1#quiet-hours1#ranking1#rate-limiting1#redis1#reflection1#reporting1#rerank1#retrieval-quality1#retry1#retry-semantics1#rrf1#sandboxing1#scalability1#schema-design1#secrets-management1#self-assessment1#self-presentation1#service-architecture1#session-management1#sharding1#state-machine1#state-management1#stateless1#structured-output1#system-prompt1#testing1#tool-execution1#tracing1#trade-offs1#transport1#vector-database1
30 天从前端工程师到 Agent 工程师
D25 前端侧 Agent 体验:流式渲染、工具调用可视化、打断/重试、SSE hooks
失败重试怎么设计才不会产生重复副作用?工具调用过程要不要暴露给用户?How do you design retry so it does not duplicate side effects, and should the tool-call process be visible to the user?
国内高频海外高频进阶#idempotency#retry#ux分析过程 · 先想清楚再作答
- 这题把两件事绑在一起问,考的是你能不能看出它们的共同点:**都是「把不可见的中间状态变成可控的」**。分开答也行,但点出这层关系会显得成熟。
- 重试这一半的推导链:重试意味着同一句话可能被执行两遍 → 两倍 token,还可能两次不可逆的工具调用(比如退款打两次钱)→ 所以要幂等 → 幂等键必须由**客户端在第一次发送时生成**并在重试时原样带上 → 后端拿它做唯一约束,命中就把已有 run 的流接回来,而不是新建。
- 关键判据要说清:**什么时候该换新键?** 判据是「要发送的内容变没变」,不是「用户点了哪个按钮」。同一句话重试用同一个键;用户改了内容重新发,那是新的一句话,必须换新键。
- 顺带提一句这一招的复用面会很加分:落库去重、定时任务防止一个 tick 被消费两次、跨服务调用防重复投递、前端重试——同一个形状用在四个层面,最终裁判永远是数据库的唯一约束,不是应用层的先查后写。
- 工具可视化这一半:中间过程要暴露,理由有三条——用户能判断要不要打断(不然他只能盲等);等待变得可以忍受(十几秒的转圈会让人刷新页面,而刷新意味着这一轮的钱白花);出问题时用户能说清「卡在查订单那一步」,客服和你都省事。
- 可预期的追问:全都暴露会不会泄露内部实现?会,所以要过滤——工具名用人话不用函数名,参数里的用户标识、内部 id、密钥一律不显示,错误显示归类后的原因而不是原始堆栈。**可视化的是过程,不是内部结构。**
How to reason about it · think before answering
- The question bundles two topics, and the test is whether you see what they share: both turn invisible intermediate state into something the user can act on. Answering them separately is fine, but naming the link reads as senior.
- Chain for retry: retrying means the same message may execute twice, costing double tokens and possibly duplicating irreversible tool calls such as issuing a refund twice. Hence idempotency. The key must be generated by the client on the first attempt and resent unchanged on retry, and the backend enforces it with a unique constraint, reattaching to the existing run instead of creating a new one.
- State the decision rule clearly: when do you mint a new key? The rule is whether the content being sent changed, not which button the user pressed. Same message retried keeps the key; edited content is a new message and needs a new key.
- Mentioning how far this pattern reaches scores well: write deduplication, cron ticks consumed exactly once, cross-service delivery, and frontend retry — the same shape at four layers, with the database's unique constraint always the final arbiter rather than an application-level check-then-write.
- For tool visibility: expose the process, for three reasons. The user can decide whether to interrupt instead of waiting blind; waiting becomes tolerable, since a spinner for fifteen seconds invites a page refresh that wastes the whole turn; and when something breaks the user can say 'it hung on looking up my order', which saves everyone time.
- Expected follow-up: does exposing everything leak internals? It can, so filter. Show human-readable tool names rather than function names, hide user identifiers, internal ids and secrets from the arguments, and show classified error reasons rather than raw stack traces. You are surfacing the process, not the internal structure.
答题要点
- 重试要带客户端首次生成的幂等键,后端用唯一约束命中后把已有 run 的流接回来,不新建。
- 换不换键的判据是「内容变没变」:同一句话重试用同一个键,改了内容才换新键。
- 同一招在落库、定时任务、跨服务调用、前端重试四处复用,最终裁判永远是数据库的唯一约束。
- 工具调用要可视化:用户才能判断要不要打断、等待变得可忍受、出问题时说得清卡在哪一步。
- 但要过滤:工具名用人话、参数里的内部 id 与密钥不显示、错误显示归类原因而不是原始堆栈。
Key points
- Retry carries the idempotency key minted on the first attempt; the backend hits a unique constraint and reattaches to the existing run.
- The rule for minting a new key is whether the content changed — same message keeps the key, edited content gets a new one.
- The same pattern recurs in write dedup, cron ticks, cross-service delivery and frontend retry, always arbitrated by a database unique constraint.
- Make tool calls visible so users can decide whether to interrupt, tolerate the wait, and describe where it hung.
- But filter: human-readable tool names, no internal ids or secrets in the arguments, classified error reasons instead of raw stack traces.