/pattern/actor-model/

04 · ProductionRuntime ArchitectureActor-based RuntimeAgent ActorsMessage Actors

Actor Model.
Each agent is its own mailbox, its own state, its own supervisor.

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

  • Concurrency and isolation are critical.
  • Agents possess their own internal state.
  • Scaling should occur via independent units.

When it backfires

  • A simple synchronous workflow suffices.
  • The message model creates unnecessary complexity.
  • Global transactions are central.

The tradeoff

Strong isolation and scalability are gained against more complex messaging and error semantics.

The effect

What it actually does.

Isolated actors pass messages to coordinate.

messageactoractor
Pitfalls

Two ways this pattern will hurt you.

Lost messages disappear without a trace

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.

A slow actor's mailbox grows without bound

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.

Framework support

Where Actor Model is native.

Microsoft Agent Frameworkactor runtimeNative
AutoGen / AG2actor agentsNative
AWS Strandsagent actorsNative

Search

Search patterns, frameworks, and pages.