---
title: "Put record IDs in jobs instead of copies · Agent Wranglers"
url: https://agentwranglers.se/playbook/scaling/background-jobs-and-queues/ids-in-jobs
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Put record IDs in jobs instead of copies

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Background jobs and queues](https://agentwranglers.se/playbook/scaling/background-jobs-and-queues.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- ID: SCL-21
- Level: Recommended
- Chapter: [Background jobs and queues](https://agentwranglers.se/playbook/scaling/background-jobs-and-queues)
- Rule: Store the record's ID and the few inputs the job needs in the job. The worker reads the current record when it runs.
- How: A job that holds a full copy acts on old data when the record changes meanwhile. An email then goes to the address the customer just replaced. Large payloads also fill the queue server's memory. Personal data in jobs is one more copy to find and erase, outside the [source of truth](https://agentwranglers.se/playbook/data/caches-and-copies/source-of-truth). When the record is gone by the time the job runs, mark the job done and stop.
- Check: No job definition puts an email address, a name or a whole record in its payload. The largest payload in the queue on the busiest day of the last 30 is under 10 KB.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
// Bad: a copy of the customer, stale by the time the job runs
await queue.add('receipt', { email: customer.email, name: customer.name, order });
// Good: the worker loads what is current
await queue.add('receipt', { orderId: order.id });
```

### Python example

```python
# Bad: a copy of the customer, stale by the time the job runs
queue.enqueue(send_receipt, customer.email, customer.name, order)
# Good: the worker loads what is current
queue.enqueue(send_receipt, order.id)
```

## Related rules

- [Name the source of truth](https://agentwranglers.se/playbook/data/caches-and-copies/source-of-truth) in Data

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/scaling/background-jobs-and-queues/ids-in-jobs">Agent Wranglers scaling playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Keep urgent jobs in their own queue](https://agentwranglers.se/playbook/scaling/background-jobs-and-queues/urgent-queue)
- Next: [Spread scheduled work across the hour](https://agentwranglers.se/playbook/scaling/background-jobs-and-queues/spread-scheduled-jobs)
- [Background jobs and queues](https://agentwranglers.se/playbook/scaling/background-jobs-and-queues)
