CSE Roadmap

Core tier · about 3 hours · 12 parts

Part 8 of 12 · 1 min read

Answering job-API questions in an interview

How would you expose a 10-minute agent over HTTP?

"Not as one blocking request. POST returns 202 and a job id; the client polls a status endpoint with Retry-After or gets a signed webhook; DELETE cancels. In the example's simulation a 2-minute proxy timeout answered 459 of 1000 sync requests, and retries added 541 duplicate runs." Follow-up: "Why not WebSockets?" For progress streaming they are good (module 4), but you still need a durable job id so the run survives the connection.

What is an idempotency key and how do you implement it?

"A client-chosen token sent with the submit. The server stores (owner, key) with the body hash and job id; a repeat with the same body returns the original job, a different body returns 409. With 5 percent lost responses it removed all 47 duplicate jobs in the example's test." Follow-up: "How long do you keep keys?" Long enough to cover client retry windows, such as 24 hours; document it.

How do you make webhooks reliable and safe?

"At-least-once delivery with exponential backoff, a stable event id so receivers can dedupe, and an HMAC over timestamp and body so they can verify origin and reject replays. A lost ack means the receiver may have processed an event the sender thinks failed." Follow-up: "Exactly-once?" Not on the wire; you get effectively-once by dedupe on the receiver.

How do you stop clients hammering the status endpoint?

"Retry-After, a documented backoff, rate limits, and webhooks as the alternative. Polling every 2 seconds cost 30,000 requests for 100 ten-minute jobs; backoff cut it to 1,400." Follow-up: "What goes in the status?" State, progress, cost so far, and the result link when terminal.