Distribute incoming work evenly across a team by rotating through assignees in order. Simple, predictable, fair — and exactly right when skill is uniform and load balance matters.
Rendering diagram…
Use round-robin when:
Use something smarter (skill-based, workload-aware, territory-based) when the work genuinely varies or agents have different specialties.
Keep a cursor pointing at the next assignee. When a task arrives, assign to the cursor's agent and advance the cursor. When it hits the end of the list, wrap around.
The trick: the cursor must be durable. Lose it on restart and you'll double-assign the last task or skip the next one. Put it in a small DB table, a Redis counter, or a single row with SELECT ... FOR UPDATE.
Pure round-robin ignores availability. An agent on vacation will still get every Nth task. Always combine with an "out of office" flag or an active-agent list.
Who's in the rotation today? Pull from your identity/HR system. People on PTO should be skipped, not assigned.
One agent must advance it at a time. Postgres: UPDATE rotation SET cursor = cursor + 1 RETURNING cursor in a single statement, modulo the list length.
Not all agents work the same hours. A junior agent on 50% should get half the tasks. Weight the rotation: [A, A, B, C] gives A twice the load.
Every task should record: when assigned, who got it, what the cursor was, who was in the active set. Fairness complaints ("I got 12 tickets, Mark got 4") need a paper trail.
Sometimes you need to skip a specific agent for a specific task ("Anna is already handling the parent ticket for this case"). Design override paths so they don't silently break the rotation.
Split a workload into parallel branches, process them simultaneously, then aggregate the results. Dramatically reduces processing time for batch operations.