---
title: "Run long jobs asynchronously · Agent Wranglers"
url: https://agentwranglers.se/playbook/api-design/reliability/long-running-jobs
updated: 2026-10-20
licence: "All rights reserved"
---

# Run long jobs asynchronously

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Reliability](https://agentwranglers.se/playbook/api-design/reliability)
- Rule: When work can take longer than 10 seconds, accept it with 202 and a status resource the client can poll.
- How: Return 202 with a `Location` header pointing to a job, such as `/jobs/job_31c`. The job shows its state, such as `queued`, `running`, `succeeded` or `failed`. When done, it links to the result or holds a problem details object. Send `Retry-After` on the job to pace polling.
- Check: Start an export in a test. The answer is 202 with `Location`, and polling ends in a completed state with a result link.

Example:

```http
POST /exports HTTP/1.1

HTTP/1.1 202 Accepted
Location: /jobs/job_31c
Retry-After: 5
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers api design playbook: https://agentwranglers.se/playbook/api-design/reliability/long-running-jobs`.

- Previous: [Tell clients their rate limit](https://agentwranglers.se/playbook/api-design/reliability/rate-limit-headers)
- [Reliability](https://agentwranglers.se/playbook/api-design/reliability)
