# 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.

- **Category**: Agentic AI
- **Subcategory**: Multi-Agent
- **Canonical URL**: https://designpattern.fyi/patterns/actor_model_agents/

---

## 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.



## Use Cases
- 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.






## Trade-offs


### 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.




### Considerations & Drawbacks

- 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.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/actor-model-agents/)

