Guide

Building An Agent Request

An agent request is application code that starts an LLM task, submits the model call, and checks the durable outcome.

Install

Install the TypeScript SDK and set REQRUN_API_KEY to a project API key from the dashboard.

TypeScript
npm install @reqrun/sdk

Submit the task

Use wait=false when your agent task can continue in the background. Store the rr_ id next to your own task record.

TypeScript
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);
}