Skip to content

Lesson 8 of 9 · 6 min read

Mailboxes and Actors: Message Passing Between Agents

Agents that coordinate through a shared transcript or shared state inherit every concurrency problem of shared memory. The alternative is the actor model: each agent owns private state and a mailbox, handles one message at a time, and talks to other agents only by sending messages. That removes lost updates by construction and makes each agent testable alone. It also imports the problems of any message system, and a design has to answer each one: a request needs a correlation id so the reply can be matched; delivery is at least once, so handlers are idempotent; a mailbox can fill, so producers feel backpressure instead of growing the queue without limit; a message nobody can process goes to a dead-letter queue with its history instead of being retried forever. Compared with an orchestrator calling workers, mailboxes buy decoupling and independent failure, and cost visibility, which a trace that follows the correlation id across mailboxes restores.

Premium lessonReviewed By the AIAgentInterviews editorial team
Get full Premium access · $25

All 19 topics with every worked answer, all lessons and courses, the full practice bank, and anything new that appears during your access.

6 months · One payment · No auto-renewal

Practise it as an interviewer asks it

Related lessons