Why agent tasks need durable requests
Agent tasks often sit behind queues, schedulers, and user-facing actions. A dropped connection or rate-limit response should not force a duplicate task or leave the app guessing.
ReqRun gives the model request an rr_ id, controlled retries, and a status endpoint so the application can recover cleanly.
Where common approaches break
Direct SDK calls are simple until the upstream times out, returns 429, or the worker process restarts mid-call.
Ad hoc retry code can duplicate work unless every caller uses the same idempotency rules.
How ReqRun fits
Send the same OpenAI-style chat completion shape to ReqRun. ReqRun stores the request, runs it through the worker, records attempts, and returns either the result or an rr_ request id.
const response = await reqrun.chat.completions.create({
model: "gpt-5-nano",
messages: [{ role: "user", content: "Run the agent task." }],
wait: false,
idempotency_key: "agent-task-991",
});
if (response.object === "chat.completion.async") {
const request = await reqrun.requests.get(response.id);
console.log(request.status, request.attempts);
}