Phase 14 · Lesson 14 of 54

The Actor Model for Agents — Async Messages and Typed Runtimes

Agents as actors: async message exchange, event-driven handlers, fault isolation, natural concurrency. AutoGen v0.4 (Microsoft Research, Jan 2025) redesigned agent orchestration around this model; the framework is now in maintenance mode, with Microsoft Agent Framework (public preview Oct 2025) as its production successor.

Lesson 14 of 54Learn + Build~75 minutesPython (stdlib)

Before this: Lesson 1 of Phase 14 (Agent Loop), lesson 12 of Phase 14 (Workflow Patterns)

On this page

Learning Objectives

  • Describe the actor model: agents as actors, messages as the only IPC, failure isolation per actor.
  • Name AutoGen v0.4's three API layers — Core, AgentChat, Extensions — and what each is for.
  • Explain why decoupling message delivery from handling gives fault isolation and natural concurrency.
  • Implement a stdlib actor runtime in Python and port a two-agent code-review flow onto it.

The Problem

Most agent frameworks are synchronous: one agent produces, one agent consumes, in a call stack. Failures crash the stack. Concurrency is bolted on. Distribution requires rewriting.

AutoGen v0.4's answer: the actor model. Each agent is an actor with a private inbox. Messages are the only interaction. The runtime decouples delivery from handling. Failures isolate to one actor. Concurrency is native. Distribution is just different transport.

The Concept

Actors

An actor has:

  • A private state (never directly touched from outside).
  • An inbox (message queue).
  • A handler: receive(message) -> effects where effects can be "reply," "send to other actor," "spawn new actor," "update state," "stop self."

Two actors cannot share memory. They can only send messages.

Three API layers

AutoGen v0.4 splits its surface into three:

  1. Core. Low-level actor framework. AgentRuntime, Agent, Message, Topic. Async message exchange, event-driven.
  2. AgentChat. Task-driven high-level API (replacement for v0.2's ConversableAgent). AssistantAgent, UserProxyAgent, RoundRobinGroupChat, SelectorGroupChat.
  3. Extensions. Integrations — OpenAI, Anthropic, Azure, tools, memory.

Why decoupling matters

In the v0.2 model, calling agent_a.chat(agent_b) synchronously blocks agent_a until agent_b returns. In v0.4, send(agent_b, msg) puts the message in agent_b's inbox and returns. The runtime delivers later. Three consequences:

  • Fault isolation. Agent B crashing does not crash Agent A — the runtime catches the failure in B's handler and decides what to do (log, retry, dead-letter).
  • Natural concurrency. Many messages in flight at once; actors process their inbox concurrently.
  • Distribution-ready. Inbox + transport is the same abstraction whether the actor is in-process or on another host.

Topologies

  • RoundRobinGroupChat. Agents take turns in a fixed rotation.
  • SelectorGroupChat. A selector agent picks who goes next based on conversation context.
  • Magentic-One. Reference multi-agent team for web browsing, code execution, file handling. Built on AgentChat.

Observability

OpenTelemetry support is built in. Every message emits a span; tool calls carry gen_ai.* attributes per the 2026 OTel GenAI semantic conventions (Lesson 23).

Status: maintenance mode

Early 2026: AutoGen v0.7.x is stable for research and prototyping. Microsoft has shifted active development to the Microsoft Agent Framework, the production successor (public preview Oct 1 2025; 1.0 GA was targeted for end of Q1 2026). AutoGen patterns port forward cleanly — the actor model is the durable idea.

actor-mailbox

Build It

code/main.py implements a stdlib actor runtime:

  • Message — typed payload with sender, recipient, topic, body.
  • Actor — abstract with receive(message, runtime).
  • Runtime — event loop with a shared queue, delivery, failure isolation.
  • A two-actor demo: ReviewerAgent reviews code, ChecklistAgent runs a checklist; they exchange messages until consensus.

Run it:

python3 code/main.py

The trace shows message delivery, a simulated failure in one actor that does not crash the other, and convergence on a shared verdict.

Use It

  • AutoGen v0.4/v0.7 (maintenance) — stable for research, prototyping, multi-agent patterns.
  • Microsoft Agent Framework — the production successor (public preview Oct 2025); same actor-model ideas in a refreshed API.
  • LangGraph swarm topology (Lesson 13) — similar pattern via shared-tool handoffs.
  • Custom actor runtime — when you need specific transport (NATS, RabbitMQ, gRPC).

Ship It

outputs/skill-actor-runtime.md generates a minimal actor runtime plus a team template (RoundRobin or Selector) for a given multi-agent task.

Exercises

  1. Add a dead-letter queue: when a handler raises, park the failing message for human inspection. How often does DLQ get hit in your toy?
  2. Implement SelectorGroupChat: a selector actor picks who processes the next message based on conversation state.
  3. Add distributed transport: swap the in-process queue for a JSON-over-HTTP server so actors can run in separate processes.
  4. Wire an OTel span per message (or a no-op stand-in). Emit gen_ai.agent.name, gen_ai.operation.name per Lesson 23.
  5. Read AutoGen v0.4's architecture post. Port your toy to the real autogen_core API. What did you skip that matters in production?

Key Terms

Term What people say What it actually means
Actor "Agent" Private state + inbox + handler; no shared memory
Message "Event" Typed payload; the only way actors interact
Inbox "Mailbox" Per-actor queue of pending messages
Runtime "Agent host" Event loop that routes messages and isolates failures
Topic "Channel" Named publish-subscribe route between actors
Fault isolation "Let it crash" One actor failing does not crash others
RoundRobinGroupChat "Fixed-rotation team" Agents take turns in order
SelectorGroupChat "Context-routed team" Selector picks who goes next
Magentic-One "Reference team" Multi-agent squad for web + code + files

Further Reading

Check yourself

Quick quiz

  1. What is the only legal way actors interact in AutoGen v0.4?

    1. Direct access to a shared dict
    2. Mutating each other's prompts
    3. Shared SQL transactions
    4. Asynchronous messages exchanged through inboxes; no shared memory
    Show the answer

    D. Asynchronous messages exchanged through inboxes; no shared memory Actors have private state and an inbox; messages are the only interaction.

  2. What are the three API layers of AutoGen v0.4?

    1. Core, AgentChat, Extensions
    2. Frontend, Backend, Database
    3. Tools, Models, Memory
    4. Plan, Act, Reflect
    Show the answer

    A. Core, AgentChat, Extensions Core is the low-level actor framework, AgentChat is the task-driven high-level API, Extensions are integrations.

  3. Why does decoupling delivery from handling give fault isolation?

    1. The runtime catches handler failures in B without crashing A; A's send() returned immediately and never blocked
    2. Each actor runs on a separate machine
    3. Handlers are pure functions
    4. The runtime restarts the OS on failure
    Show the answer

    A. The runtime catches handler failures in B without crashing A; A's send() returned immediately and never blocked send() puts the message in the recipient's inbox and returns; a handler crash is local to that actor.

  4. Which AgentChat topology rotates agents in a fixed order?

    1. SelectorGroupChat
    2. Magentic-One
    3. RoundRobinGroupChat
    4. Supervisor
    Show the answer

    C. RoundRobinGroupChat RoundRobinGroupChat is fixed rotation; SelectorGroupChat uses a selector to pick next.

  5. What is Magentic-One in this lesson?

    1. A reference multi-agent team for web browsing, code execution, and file handling built on AgentChat
    2. An OTel exporter
    3. A new LLM model
    4. A serialization format
    Show the answer

    A. A reference multi-agent team for web browsing, code execution, and file handling built on AgentChat Magentic-One is Microsoft's reference team that demonstrates the AgentChat API.

  6. What is the lesson's stated status of AutoGen v0.4 in early 2026?

    1. Deprecated and removed
    2. Replaced by LangGraph
    3. Just announced
    4. Stable but in maintenance mode; Microsoft Agent Framework is the forward path
    Show the answer

    D. Stable but in maintenance mode; Microsoft Agent Framework is the forward path AutoGen v0.7.x is stable for research; active development has shifted to Microsoft Agent Framework.

  7. Which observability standard does AutoGen v0.4 emit by default?

    1. Datadog APM
    2. Prometheus metrics only
    3. OpenTelemetry spans with gen_ai.* attributes per the OTel GenAI semantic conventions
    4. StatsD
    Show the answer

    C. OpenTelemetry spans with gen_ai.* attributes per the OTel GenAI semantic conventions Every message emits a span; tool calls carry gen_ai.* attributes per OTel GenAI conventions.

Questions people ask

What is Microsoft AutoGen?

AutoGen is an open-source framework from Microsoft Research for multi-agent systems. Version 0.4 rebuilt it around asynchronous messaging between agents. It is now in maintenance mode, and Microsoft points new production work to Microsoft Agent Framework.

What is the actor model in software?

The actor model treats each component as an actor that keeps its own state and talks to others only through messages. Actors run at the same time and fail independently, which makes systems easier to scale and recover.

Next lessonRole-Based Agent Teams — Roles, Tasks, ProcessesPrevious: Stateful Graph Orchestration — Durable Execution and Checkpoints

Lessons from AI Engineering from Scratch by Rohit Ghumare and contributors, MIT license. Notes for owners by Lozo. License

Next step

Rather have it built for you?

Reading is optional. Tell me what's stuck and I'll build it into the business you already run.

  • A real conversation, not a pitch
  • You keep your accounts
  • Nothing sends without your yes