Actor-Model Agents
Implement each agent as an independent actor with its own mailbox — agents communicate only via async messages, never share mutable state, and crashes stay isolated.
Intent & Description
🎯 Intent
Implement each agent as an independent actor with its own mailbox, processing async messages one at a time and never sharing mutable state with peers.
📋 Context
Building a multi-agent system where several agents must run concurrently, react to events as they arrive, and keep going even when one crashes. There’s no single conversational chair driving turn order, and agents may live in different processes or machines.
💡 Solution
Model each agent as an actor — a process or coroutine with its own mailbox, local state, and a message-handler that runs messages in receive order. Agents communicate only by sending messages: directly to a known agent id, or by publishing to a topic. The runtime supervises actor lifecycles, restarts on crash, and routes messages across processes or machines. Pair with role-assignment when agents need stable personas, and with supervisor when a coordinator is needed.
Real-world Use Case
- Agents must run concurrently with fully isolated state — no shared memory.
- The system must survive partial failures of individual agents without cascading.
- Communication is naturally event- or message-driven rather than turn-based dialogue.
- The agent population is expected to scale to dozens or more participants.
Source
📌 TL;DR
Give each agent its own mailbox and ban shared state — concurrent multi-agent systems without locks, with crash isolation and distribution for free.
Advantages
- Concurrent agents without ad-hoc locks or shared-state hazards.
- Per-actor crash recovery — one agent’s failure cannot corrupt its peers.
- Distributable across processes and machines under the same programming model.
- Fits event-driven and pub/sub communication shapes naturally.
Disadvantages
- Message-driven debugging is harder to follow than a linear conversation trace.
- Each agent needs its own mailbox queue with explicit back-pressure rules.
- Cross-agent transactions aren’t first-class — saga-style compensation is required.