When to reach for it
- Concurrency and isolation are critical.
- Agents possess their own internal state.
- Scaling should occur via independent units.
/pattern/actor-model/
Agents or components run as independent actors: each owns its private state, processes one message at a time from its mailbox, and can spawn further actors — so there is no shared-memory contention and a crash is contained to a single actor.
In practiceA high-throughput document-processing system assigns each uploaded file to an independent actor, so a crash in one file's processing actor never affects the others running in parallel.
When to reach for it
When it backfires
The tradeoff
Strong isolation and scalability are gained against more complex messaging and error semantics.
Isolated actors pass messages to coordinate.
An actor crashes between receive and ack. The message vanishes; the sender thinks it was processed; the system silently loses work.
Fix · Use at-least-once delivery with idempotent handlers, or persist the inbox before processing. Make message loss a visible failure, not a silent one.
One actor consumes messages slower than they arrive. Its mailbox swells until memory is exhausted, and the backlog latency cascades to everyone waiting on its replies.
Fix · Bound mailboxes and apply backpressure or load-shedding when full; monitor queue depth per actor and scale or shed before it becomes an outage.
Keep going
Search patterns, frameworks, and pages.